From 61932e5758609e8f3d9ed011781925b6ede9e684 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 11 Apr 2022 22:12:00 +0000 Subject: [PATCH] CodeGen from PR 18624 in Azure/azure-rest-api-specs Merge 0fd3b5e52d23c1fc57da4bf1e1812171ee321581 into 5cb84df7093576b0f78c12b0dd720d4210c668a8 --- .../armdataprotection/CHANGELOG.md | 475 ++++ .../armdataprotection/autorest.md | 6 +- .../dataprotection/armdataprotection/go.mod | 9 +- .../dataprotection/armdataprotection/go.sum | 43 +- ...ted_example_backupinstances_client_test.go | 383 --- ...ated_example_backuppolicies_client_test.go | 183 -- ...backupvaultoperationresults_client_test.go | 36 - ...erated_example_backupvaults_client_test.go | 189 -- ...ated_example_dataprotection_client_test.go | 39 - ...le_dataprotectionoperations_client_test.go | 40 - ...enerated_example_exportjobs_client_test.go | 40 - ...e_exportjobsoperationresult_client_test.go | 36 - .../ze_generated_example_jobs_client_test.go | 61 - ...ted_example_operationresult_client_test.go | 35 - ...ted_example_operationstatus_client_test.go | 35 - ...ated_example_recoverypoints_client_test.go | 65 - ...ated_example_resourceguards_client_test.go | 411 --- ...xample_restorabletimeranges_client_test.go | 42 - .../zz_generated_backupinstances_client.go | 793 ++++-- ..._backupinstancesextensionrouting_client.go | 112 + .../zz_generated_backuppolicies_client.go | 151 +- ...ated_backupvaultoperationresults_client.go | 51 +- .../zz_generated_backupvaults_client.go | 243 +- .../armdataprotection/zz_generated_client.go | 31 +- .../zz_generated_constants.go | 166 +- .../zz_generated_exportjobs_client.go | 55 +- ...erated_exportjobsoperationresult_client.go | 31 +- .../zz_generated_jobs_client.go | 67 +- .../armdataprotection/zz_generated_models.go | 2285 ++--------------- .../zz_generated_models_serde.go | 2252 ++++++++++++++++ .../zz_generated_operationresult_client.go | 31 +- .../zz_generated_operations_client.go | 63 +- .../zz_generated_operationstatus_client.go | 31 +- ...perationstatusbackupvaultcontext_client.go | 115 + ...rationstatusresourcegroupcontext_client.go | 110 + .../armdataprotection/zz_generated_pagers.go | 827 ------ .../armdataprotection/zz_generated_pollers.go | 445 ---- .../zz_generated_polymorphic_helpers.go | 8 +- .../zz_generated_recoverypoints_client.go | 103 +- .../zz_generated_resourceguards_client.go | 355 ++- .../zz_generated_response_types.go | 764 +----- ...z_generated_restorabletimeranges_client.go | 51 +- .../zz_generated_time_rfc3339.go | 4 +- 43 files changed, 4694 insertions(+), 6578 deletions(-) delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupinstances_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backuppolicies_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaultoperationresults_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaults_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotection_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotectionoperations_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobs_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobsoperationresult_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_jobs_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationresult_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatus_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_recoverypoints_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_resourceguards_client_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_restorabletimeranges_client_test.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstancesextensionrouting_client.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusbackupvaultcontext_client.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusresourcegroupcontext_client.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pagers.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pollers.go diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md index 5c8d5203ac9c..67d860e39759 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md @@ -1,5 +1,480 @@ # Release History +## 0.3.0 (2022-04-11) +### Breaking Changes + +- Function `*BackupPoliciesClient.List` return value(s) have been changed from `(*BackupPoliciesClientListPager)` to `(*runtime.Pager[BackupPoliciesClientListResponse])` +- Function `*BackupInstancesClient.BeginAdhocBackup` return value(s) have been changed from `(BackupInstancesClientAdhocBackupPollerResponse, error)` to `(*armruntime.Poller[BackupInstancesClientAdhocBackupResponse], error)` +- Function `*ResourceGuardsClient.GetResourcesInSubscription` return value(s) have been changed from `(*ResourceGuardsClientGetResourcesInSubscriptionPager)` to `(*runtime.Pager[ResourceGuardsClientGetResourcesInSubscriptionResponse])` +- Function `*BackupInstancesClient.BeginCreateOrUpdate` return value(s) have been changed from `(BackupInstancesClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[BackupInstancesClientCreateOrUpdateResponse], error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `*ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects` return value(s) have been changed from `(*ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager)` to `(*runtime.Pager[ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse])` +- Function `NewExportJobsClient` return value(s) have been changed from `(*ExportJobsClient)` to `(*ExportJobsClient, error)` +- Function `*ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects` return value(s) have been changed from `(*ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager)` to `(*runtime.Pager[ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse])` +- Function `NewOperationStatusClient` return value(s) have been changed from `(*OperationStatusClient)` to `(*OperationStatusClient, error)` +- Function `*ExportJobsClient.BeginTrigger` return value(s) have been changed from `(ExportJobsClientTriggerPollerResponse, error)` to `(*armruntime.Poller[ExportJobsClientTriggerResponse], error)` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewOperationResultClient` return value(s) have been changed from `(*OperationResultClient)` to `(*OperationResultClient, error)` +- Function `*BackupInstancesClient.BeginDelete` return value(s) have been changed from `(BackupInstancesClientDeletePollerResponse, error)` to `(*armruntime.Poller[BackupInstancesClientDeleteResponse], error)` +- Function `NewRestorableTimeRangesClient` return value(s) have been changed from `(*RestorableTimeRangesClient)` to `(*RestorableTimeRangesClient, error)` +- Function `*ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects` return value(s) have been changed from `(*ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager)` to `(*runtime.Pager[ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse])` +- Function `*ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects` return value(s) have been changed from `(*ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager)` to `(*runtime.Pager[ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse])` +- Function `*BackupInstancesClient.BeginValidateForBackup` return value(s) have been changed from `(BackupInstancesClientValidateForBackupPollerResponse, error)` to `(*armruntime.Poller[BackupInstancesClientValidateForBackupResponse], error)` +- Function `*ResourceGuardsClient.GetResourcesInResourceGroup` return value(s) have been changed from `(*ResourceGuardsClientGetResourcesInResourceGroupPager)` to `(*runtime.Pager[ResourceGuardsClientGetResourcesInResourceGroupResponse])` +- Function `*ResourceGuardsClient.GetBackupSecurityPINRequestsObjects` return value(s) have been changed from `(*ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager)` to `(*runtime.Pager[ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse])` +- Function `*RecoveryPointsClient.List` return value(s) have been changed from `(*RecoveryPointsClientListPager)` to `(*runtime.Pager[RecoveryPointsClientListResponse])` +- Function `NewBackupInstancesClient` return value(s) have been changed from `(*BackupInstancesClient)` to `(*BackupInstancesClient, error)` +- Function `NewExportJobsOperationResultClient` return value(s) have been changed from `(*ExportJobsOperationResultClient)` to `(*ExportJobsOperationResultClient, error)` +- Function `NewBackupVaultOperationResultsClient` return value(s) have been changed from `(*BackupVaultOperationResultsClient)` to `(*BackupVaultOperationResultsClient, error)` +- Function `*BackupVaultsClient.GetInSubscription` return value(s) have been changed from `(*BackupVaultsClientGetInSubscriptionPager)` to `(*runtime.Pager[BackupVaultsClientGetInSubscriptionResponse])` +- Function `*BackupInstancesClient.BeginValidateForRestore` return value(s) have been changed from `(BackupInstancesClientValidateForRestorePollerResponse, error)` to `(*armruntime.Poller[BackupInstancesClientValidateForRestoreResponse], error)` +- Function `*BackupInstancesClient.BeginTriggerRestore` return value(s) have been changed from `(BackupInstancesClientTriggerRestorePollerResponse, error)` to `(*armruntime.Poller[BackupInstancesClientTriggerRestoreResponse], error)` +- Function `NewRecoveryPointsClient` return value(s) have been changed from `(*RecoveryPointsClient)` to `(*RecoveryPointsClient, error)` +- Function `*BackupInstancesClient.BeginTriggerRehydrate` return value(s) have been changed from `(BackupInstancesClientTriggerRehydratePollerResponse, error)` to `(*armruntime.Poller[BackupInstancesClientTriggerRehydrateResponse], error)` +- Function `NewJobsClient` return value(s) have been changed from `(*JobsClient)` to `(*JobsClient, error)` +- Function `*JobsClient.List` return value(s) have been changed from `(*JobsClientListPager)` to `(*runtime.Pager[JobsClientListResponse])` +- Function `*BackupVaultsClient.BeginUpdate` return value(s) have been changed from `(BackupVaultsClientUpdatePollerResponse, error)` to `(*armruntime.Poller[BackupVaultsClientUpdateResponse], error)` +- Function `NewBackupVaultsClient` return value(s) have been changed from `(*BackupVaultsClient)` to `(*BackupVaultsClient, error)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `NewBackupPoliciesClient` return value(s) have been changed from `(*BackupPoliciesClient)` to `(*BackupPoliciesClient, error)` +- Function `*BackupInstancesClient.List` return value(s) have been changed from `(*BackupInstancesClientListPager)` to `(*runtime.Pager[BackupInstancesClientListResponse])` +- Function `*BackupVaultsClient.BeginCreateOrUpdate` return value(s) have been changed from `(BackupVaultsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[BackupVaultsClientCreateOrUpdateResponse], error)` +- Function `*ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects` return value(s) have been changed from `(*ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager)` to `(*runtime.Pager[ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse])` +- Function `NewResourceGuardsClient` return value(s) have been changed from `(*ResourceGuardsClient)` to `(*ResourceGuardsClient, error)` +- Function `*BackupVaultsClient.GetInResourceGroup` return value(s) have been changed from `(*BackupVaultsClientGetInResourceGroupPager)` to `(*runtime.Pager[BackupVaultsClientGetInResourceGroupResponse])` +- Type of `ErrorAdditionalInfo.Info` has been changed from `map[string]interface{}` to `interface{}` +- Function `RehydrationPriority.ToPtr` has been removed +- Function `*BackupInstancesClientDeletePollerResponse.Resume` has been removed +- Function `*ExportJobsClientTriggerPollerResponse.Resume` has been removed +- Function `*RecoveryPointsClientListPager.PageResponse` has been removed +- Function `*BackupInstancesClientAdhocBackupPoller.Poll` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*BackupVaultsClientGetInSubscriptionPager.PageResponse` has been removed +- Function `*BackupInstancesClientValidateForBackupPollerResponse.Resume` has been removed +- Function `*JobsClientListPager.PageResponse` has been removed +- Function `BackupInstancesClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*BackupInstancesClientValidateForRestorePoller.Poll` has been removed +- Function `*BackupInstancesClientValidateForBackupPoller.Poll` has been removed +- Function `*ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager.NextPage` has been removed +- Function `BackupInstancesClientAdhocBackupPollerResponse.PollUntilDone` has been removed +- Function `RehydrationStatus.ToPtr` has been removed +- Function `*BackupVaultsClientUpdatePoller.FinalResponse` has been removed +- Function `*BackupInstancesClientTriggerRehydratePollerResponse.Resume` has been removed +- Function `*BackupInstancesClientAdhocBackupPoller.FinalResponse` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*ExportJobsClientTriggerPoller.FinalResponse` has been removed +- Function `*ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager.PageResponse` has been removed +- Function `*BackupVaultsClientUpdatePoller.ResumeToken` has been removed +- Function `*ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager.Err` has been removed +- Function `BackupInstancesClientValidateForRestorePollerResponse.PollUntilDone` has been removed +- Function `*ExportJobsClientTriggerPoller.Done` has been removed +- Function `*BackupVaultsClientGetInResourceGroupPager.NextPage` has been removed +- Function `BackupInstancesClientValidateForBackupPollerResponse.PollUntilDone` has been removed +- Function `*BackupInstancesClientValidateForRestorePoller.FinalResponse` has been removed +- Function `*BackupPoliciesClientListPager.PageResponse` has been removed +- Function `*ExportJobsClientTriggerPoller.ResumeToken` has been removed +- Function `*BackupPoliciesClientListPager.NextPage` has been removed +- Function `*JobsClientListPager.Err` has been removed +- Function `RecoveryOption.ToPtr` has been removed +- Function `ExportJobsClientTriggerPollerResponse.PollUntilDone` has been removed +- Function `*BackupVaultsClientGetInSubscriptionPager.NextPage` has been removed +- Function `*ResourceGuardsClientGetResourcesInResourceGroupPager.Err` has been removed +- Function `*ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager.NextPage` has been removed +- Function `*BackupInstancesClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*ResourceGuardsClientGetResourcesInSubscriptionPager.Err` has been removed +- Function `*ExportJobsClientTriggerPoller.Poll` has been removed +- Function `*BackupVaultsClientGetInResourceGroupPager.Err` has been removed +- Function `*ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager.PageResponse` has been removed +- Function `*ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager.PageResponse` has been removed +- Function `*ResourceGuardsClientGetResourcesInSubscriptionPager.NextPage` has been removed +- Function `*RecoveryPointsClientListPager.Err` has been removed +- Function `*BackupInstancesClientValidateForBackupPoller.FinalResponse` has been removed +- Function `DayOfWeek.ToPtr` has been removed +- Function `*BackupInstancesClientTriggerRestorePoller.Done` has been removed +- Function `*BackupVaultsClientCreateOrUpdatePoller.Done` has been removed +- Function `*BackupInstancesClientTriggerRehydratePoller.ResumeToken` has been removed +- Function `*BackupInstancesClientTriggerRehydratePoller.FinalResponse` has been removed +- Function `*BackupInstancesClientAdhocBackupPoller.ResumeToken` has been removed +- Function `*BackupInstancesClientDeletePoller.FinalResponse` has been removed +- Function `*ResourceGuardsClientGetResourcesInSubscriptionPager.PageResponse` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*BackupInstancesClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*BackupInstancesClientAdhocBackupPollerResponse.Resume` has been removed +- Function `CurrentProtectionState.ToPtr` has been removed +- Function `*BackupInstancesClientListPager.Err` has been removed +- Function `*ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager.PageResponse` has been removed +- Function `*ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager.NextPage` has been removed +- Function `Status.ToPtr` has been removed +- Function `*BackupVaultsClientCreateOrUpdatePoller.Poll` has been removed +- Function `SecretStoreType.ToPtr` has been removed +- Function `RestoreTargetLocationType.ToPtr` has been removed +- Function `*BackupInstancesClientTriggerRehydratePoller.Done` has been removed +- Function `*BackupInstancesClientCreateOrUpdatePoller.Poll` has been removed +- Function `*BackupInstancesClientDeletePoller.Done` has been removed +- Function `*ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager.NextPage` has been removed +- Function `StorageSettingStoreTypes.ToPtr` has been removed +- Function `*BackupVaultsClientUpdatePoller.Done` has been removed +- Function `*BackupVaultsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*BackupInstancesClientValidateForRestorePoller.ResumeToken` has been removed +- Function `*BackupInstancesClientDeletePoller.ResumeToken` has been removed +- Function `*BackupInstancesClientDeletePoller.Poll` has been removed +- Function `*BackupInstancesClientValidateForRestorePollerResponse.Resume` has been removed +- Function `*BackupInstancesClientListPager.PageResponse` has been removed +- Function `*ResourceGuardsClientGetResourcesInResourceGroupPager.PageResponse` has been removed +- Function `*BackupInstancesClientTriggerRestorePoller.FinalResponse` has been removed +- Function `WeekNumber.ToPtr` has been removed +- Function `*BackupVaultsClientUpdatePoller.Poll` has been removed +- Function `DataStoreTypes.ToPtr` has been removed +- Function `BackupInstancesClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `FeatureSupportStatus.ToPtr` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `BackupInstancesClientTriggerRehydratePollerResponse.PollUntilDone` has been removed +- Function `BackupVaultsClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `*BackupVaultsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*BackupInstancesClientValidateForBackupPoller.ResumeToken` has been removed +- Function `*ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager.PageResponse` has been removed +- Function `*JobsClientListPager.NextPage` has been removed +- Function `*BackupInstancesClientTriggerRestorePollerResponse.Resume` has been removed +- Function `*BackupInstancesClientTriggerRehydratePoller.Poll` has been removed +- Function `*BackupInstancesClientTriggerRestorePoller.ResumeToken` has been removed +- Function `*BackupInstancesClientValidateForRestorePoller.Done` has been removed +- Function `AbsoluteMarker.ToPtr` has been removed +- Function `*ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager.Err` has been removed +- Function `ResourceMoveState.ToPtr` has been removed +- Function `*ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager.Err` has been removed +- Function `*ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager.Err` has been removed +- Function `BackupInstancesClientTriggerRestorePollerResponse.PollUntilDone` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `*ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager.Err` has been removed +- Function `Month.ToPtr` has been removed +- Function `*ClientCheckFeatureSupportResult.UnmarshalJSON` has been removed +- Function `*ResourceGuardsClientGetResourcesInResourceGroupPager.NextPage` has been removed +- Function `*ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager.NextPage` has been removed +- Function `*BackupPoliciesClientListPager.Err` has been removed +- Function `*BackupInstancesClientAdhocBackupPoller.Done` has been removed +- Function `*ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager.Err` has been removed +- Function `FeatureType.ToPtr` has been removed +- Function `SourceDataStoreType.ToPtr` has been removed +- Function `*BackupInstancesClientValidateForBackupPoller.Done` has been removed +- Function `*BackupInstancesClientListPager.NextPage` has been removed +- Function `*BackupVaultsClientGetInSubscriptionPager.Err` has been removed +- Function `*BackupVaultsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*BackupVaultsClientGetInResourceGroupPager.PageResponse` has been removed +- Function `*BackupInstancesClientCreateOrUpdatePoller.Done` has been removed +- Function `*ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager.NextPage` has been removed +- Function `RestoreSourceDataStoreType.ToPtr` has been removed +- Function `*RecoveryPointsClientListPager.NextPage` has been removed +- Function `*BackupInstancesClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager.PageResponse` has been removed +- Function `*BackupInstancesClientTriggerRestorePoller.Poll` has been removed +- Function `*BackupVaultsClientUpdatePollerResponse.Resume` has been removed +- Function `BackupVaultsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `StorageSettingTypes.ToPtr` has been removed +- Struct `BackupInstancesClientAdhocBackupPoller` has been removed +- Struct `BackupInstancesClientAdhocBackupPollerResponse` has been removed +- Struct `BackupInstancesClientAdhocBackupResult` has been removed +- Struct `BackupInstancesClientCreateOrUpdatePoller` has been removed +- Struct `BackupInstancesClientCreateOrUpdatePollerResponse` has been removed +- Struct `BackupInstancesClientCreateOrUpdateResult` has been removed +- Struct `BackupInstancesClientDeletePoller` has been removed +- Struct `BackupInstancesClientDeletePollerResponse` has been removed +- Struct `BackupInstancesClientGetResult` has been removed +- Struct `BackupInstancesClientListPager` has been removed +- Struct `BackupInstancesClientListResult` has been removed +- Struct `BackupInstancesClientTriggerRehydratePoller` has been removed +- Struct `BackupInstancesClientTriggerRehydratePollerResponse` has been removed +- Struct `BackupInstancesClientTriggerRestorePoller` has been removed +- Struct `BackupInstancesClientTriggerRestorePollerResponse` has been removed +- Struct `BackupInstancesClientTriggerRestoreResult` has been removed +- Struct `BackupInstancesClientValidateForBackupPoller` has been removed +- Struct `BackupInstancesClientValidateForBackupPollerResponse` has been removed +- Struct `BackupInstancesClientValidateForBackupResult` has been removed +- Struct `BackupInstancesClientValidateForRestorePoller` has been removed +- Struct `BackupInstancesClientValidateForRestorePollerResponse` has been removed +- Struct `BackupInstancesClientValidateForRestoreResult` has been removed +- Struct `BackupPoliciesClientCreateOrUpdateResult` has been removed +- Struct `BackupPoliciesClientGetResult` has been removed +- Struct `BackupPoliciesClientListPager` has been removed +- Struct `BackupPoliciesClientListResult` has been removed +- Struct `BackupVaultOperationResultsClientGetResult` has been removed +- Struct `BackupVaultsClientCheckNameAvailabilityResult` has been removed +- Struct `BackupVaultsClientCreateOrUpdatePoller` has been removed +- Struct `BackupVaultsClientCreateOrUpdatePollerResponse` has been removed +- Struct `BackupVaultsClientCreateOrUpdateResult` has been removed +- Struct `BackupVaultsClientGetInResourceGroupPager` has been removed +- Struct `BackupVaultsClientGetInResourceGroupResult` has been removed +- Struct `BackupVaultsClientGetInSubscriptionPager` has been removed +- Struct `BackupVaultsClientGetInSubscriptionResult` has been removed +- Struct `BackupVaultsClientGetResult` has been removed +- Struct `BackupVaultsClientUpdatePoller` has been removed +- Struct `BackupVaultsClientUpdatePollerResponse` has been removed +- Struct `BackupVaultsClientUpdateResult` has been removed +- Struct `ClientCheckFeatureSupportResult` has been removed +- Struct `ExportJobsClientTriggerPoller` has been removed +- Struct `ExportJobsClientTriggerPollerResponse` has been removed +- Struct `ExportJobsOperationResultClientGetResult` has been removed +- Struct `JobsClientGetResult` has been removed +- Struct `JobsClientListPager` has been removed +- Struct `JobsClientListResult` has been removed +- Struct `OperationResultClientGetResult` has been removed +- Struct `OperationStatusClientGetResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `RecoveryPointsClientGetResult` has been removed +- Struct `RecoveryPointsClientListPager` has been removed +- Struct `RecoveryPointsClientListResult` has been removed +- Struct `ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager` has been removed +- Struct `ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResult` has been removed +- Struct `ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResult` has been removed +- Struct `ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResult` has been removed +- Struct `ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResult` has been removed +- Struct `ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResult` has been removed +- Struct `ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResult` has been removed +- Struct `ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResult` has been removed +- Struct `ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager` has been removed +- Struct `ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResult` has been removed +- Struct `ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager` has been removed +- Struct `ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResult` has been removed +- Struct `ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager` has been removed +- Struct `ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResult` has been removed +- Struct `ResourceGuardsClientGetResourcesInResourceGroupPager` has been removed +- Struct `ResourceGuardsClientGetResourcesInResourceGroupResult` has been removed +- Struct `ResourceGuardsClientGetResourcesInSubscriptionPager` has been removed +- Struct `ResourceGuardsClientGetResourcesInSubscriptionResult` has been removed +- Struct `ResourceGuardsClientGetResult` has been removed +- Struct `ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager` has been removed +- Struct `ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResult` has been removed +- Struct `ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager` has been removed +- Struct `ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResult` has been removed +- Struct `ResourceGuardsClientPatchResult` has been removed +- Struct `ResourceGuardsClientPutResult` has been removed +- Struct `RestorableTimeRangesClientFindResult` has been removed +- Field `ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResult` of struct `ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse` has been removed +- Field `BackupInstancesClientTriggerRestoreResult` of struct `BackupInstancesClientTriggerRestoreResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientTriggerRestoreResponse` has been removed +- Field `BackupVaultsClientCheckNameAvailabilityResult` of struct `BackupVaultsClientCheckNameAvailabilityResponse` has been removed +- Field `RawResponse` of struct `BackupVaultsClientCheckNameAvailabilityResponse` has been removed +- Field `BackupInstancesClientGetResult` of struct `BackupInstancesClientGetResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientGetResponse` has been removed +- Field `BackupInstancesClientValidateForRestoreResult` of struct `BackupInstancesClientValidateForRestoreResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientValidateForRestoreResponse` has been removed +- Field `ClientCheckFeatureSupportResult` of struct `ClientCheckFeatureSupportResponse` has been removed +- Field `RawResponse` of struct `ClientCheckFeatureSupportResponse` has been removed +- Field `ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResult` of struct `ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse` has been removed +- Field `BackupInstancesClientAdhocBackupResult` of struct `BackupInstancesClientAdhocBackupResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientAdhocBackupResponse` has been removed +- Field `ResourceGuardsClientPutResult` of struct `ResourceGuardsClientPutResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientPutResponse` has been removed +- Field `JobsClientListResult` of struct `JobsClientListResponse` has been removed +- Field `RawResponse` of struct `JobsClientListResponse` has been removed +- Field `RawResponse` of struct `ExportJobsClientTriggerResponse` has been removed +- Field `BackupVaultsClientGetInResourceGroupResult` of struct `BackupVaultsClientGetInResourceGroupResponse` has been removed +- Field `RawResponse` of struct `BackupVaultsClientGetInResourceGroupResponse` has been removed +- Field `ResourceGuardsClientGetResourcesInSubscriptionResult` of struct `ResourceGuardsClientGetResourcesInSubscriptionResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetResourcesInSubscriptionResponse` has been removed +- Field `BackupInstancesClientValidateForBackupResult` of struct `BackupInstancesClientValidateForBackupResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientValidateForBackupResponse` has been removed +- Field `ResourceGuardsClientPatchResult` of struct `ResourceGuardsClientPatchResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientPatchResponse` has been removed +- Field `ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResult` of struct `ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse` has been removed +- Field `ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResult` of struct `ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse` has been removed +- Field `ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResult` of struct `ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse` has been removed +- Field `JobsClientGetResult` of struct `JobsClientGetResponse` has been removed +- Field `RawResponse` of struct `JobsClientGetResponse` has been removed +- Field `ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResult` of struct `ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse` has been removed +- Field `RestorableTimeRangesClientFindResult` of struct `RestorableTimeRangesClientFindResponse` has been removed +- Field `RawResponse` of struct `RestorableTimeRangesClientFindResponse` has been removed +- Field `RecoveryPointsClientListResult` of struct `RecoveryPointsClientListResponse` has been removed +- Field `RawResponse` of struct `RecoveryPointsClientListResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientTriggerRehydrateResponse` has been removed +- Field `BackupInstancesClientListResult` of struct `BackupInstancesClientListResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientListResponse` has been removed +- Field `OperationResultClientGetResult` of struct `OperationResultClientGetResponse` has been removed +- Field `RawResponse` of struct `OperationResultClientGetResponse` has been removed +- Field `ResourceGuardsClientGetResourcesInResourceGroupResult` of struct `ResourceGuardsClientGetResourcesInResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetResourcesInResourceGroupResponse` has been removed +- Field `BackupVaultsClientUpdateResult` of struct `BackupVaultsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `BackupVaultsClientUpdateResponse` has been removed +- Field `BackupVaultsClientCreateOrUpdateResult` of struct `BackupVaultsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `BackupVaultsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientDeleteResponse` has been removed +- Field `BackupVaultOperationResultsClientGetResult` of struct `BackupVaultOperationResultsClientGetResponse` has been removed +- Field `RawResponse` of struct `BackupVaultOperationResultsClientGetResponse` has been removed +- Field `BackupPoliciesClientListResult` of struct `BackupPoliciesClientListResponse` has been removed +- Field `RawResponse` of struct `BackupPoliciesClientListResponse` has been removed +- Field `ResourceGuardsClientGetResult` of struct `ResourceGuardsClientGetResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetResponse` has been removed +- Field `OperationStatusClientGetResult` of struct `OperationStatusClientGetResponse` has been removed +- Field `RawResponse` of struct `OperationStatusClientGetResponse` has been removed +- Field `BackupPoliciesClientGetResult` of struct `BackupPoliciesClientGetResponse` has been removed +- Field `RawResponse` of struct `BackupPoliciesClientGetResponse` has been removed +- Field `BackupPoliciesClientCreateOrUpdateResult` of struct `BackupPoliciesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `BackupPoliciesClientCreateOrUpdateResponse` has been removed +- Field `BackupVaultsClientGetInSubscriptionResult` of struct `BackupVaultsClientGetInSubscriptionResponse` has been removed +- Field `RawResponse` of struct `BackupVaultsClientGetInSubscriptionResponse` has been removed +- Field `ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResult` of struct `ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse` has been removed +- Field `BackupVaultsClientGetResult` of struct `BackupVaultsClientGetResponse` has been removed +- Field `RawResponse` of struct `BackupVaultsClientGetResponse` has been removed +- Field `ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResult` of struct `ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `BackupPoliciesClientDeleteResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResult` of struct `ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse` has been removed +- Field `ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResult` of struct `ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse` has been removed +- Field `BackupInstancesClientCreateOrUpdateResult` of struct `BackupInstancesClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientCreateOrUpdateResponse` has been removed +- Field `ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResult` of struct `ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse` has been removed +- Field `ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResult` of struct `ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse` has been removed +- Field `RawResponse` of struct `BackupInstancesClientDeleteResponse` has been removed +- Field `ExportJobsOperationResultClientGetResult` of struct `ExportJobsOperationResultClientGetResponse` has been removed +- Field `RawResponse` of struct `ExportJobsOperationResultClientGetResponse` has been removed +- Field `RawResponse` of struct `BackupVaultsClientDeleteResponse` has been removed +- Field `RecoveryPointsClientGetResult` of struct `RecoveryPointsClientGetResponse` has been removed +- Field `RawResponse` of struct `RecoveryPointsClientGetResponse` has been removed + +### Features Added + +- New const `SyncTypeForceResync` +- New const `AlertsStateEnabled` +- New const `AutoHealStatusOn` +- New const `AutoHealStatusOff` +- New const `ValidationTypeDeepValidation` +- New const `ValidationTypeShallowValidation` +- New const `SyncTypeDefault` +- New const `AlertsStateDisabled` +- New function `PossibleAlertsStateValues() []AlertsState` +- New function `NewBackupInstancesExtensionRoutingClient(azcore.TokenCredential, *arm.ClientOptions) (*BackupInstancesExtensionRoutingClient, error)` +- New function `*OperationStatusBackupVaultContextClient.Get(context.Context, string, string, string, *OperationStatusBackupVaultContextClientGetOptions) (OperationStatusBackupVaultContextClientGetResponse, error)` +- New function `KubernetesPVRestoreCriteria.MarshalJSON() ([]byte, error)` +- New function `*KubernetesPVRestoreCriteria.UnmarshalJSON([]byte) error` +- New function `PossibleValidationTypeValues() []ValidationType` +- New function `PossibleSyncTypeValues() []SyncType` +- New function `*BackupInstancesClient.BeginResumeBackups(context.Context, string, string, string, *BackupInstancesClientBeginResumeBackupsOptions) (*armruntime.Poller[BackupInstancesClientResumeBackupsResponse], error)` +- New function `*KubernetesStorageClassRestoreCriteria.UnmarshalJSON([]byte) error` +- New function `*BackupInstancesClient.BeginSuspendBackups(context.Context, string, string, string, *BackupInstancesClientBeginSuspendBackupsOptions) (*armruntime.Poller[BackupInstancesClientSuspendBackupsResponse], error)` +- New function `*KubernetesStorageClassRestoreCriteria.GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria` +- New function `PossibleAutoHealStatusValues() []AutoHealStatus` +- New function `*BackupInstancesClient.BeginSyncBackupInstance(context.Context, string, string, string, SyncBackupInstanceRequest, *BackupInstancesClientBeginSyncBackupInstanceOptions) (*armruntime.Poller[BackupInstancesClientSyncBackupInstanceResponse], error)` +- New function `*BackupInstancesExtensionRoutingClient.List(string, *BackupInstancesExtensionRoutingClientListOptions) *runtime.Pager[BackupInstancesExtensionRoutingClientListResponse]` +- New function `*BackupInstancesClient.BeginStopProtection(context.Context, string, string, string, *BackupInstancesClientBeginStopProtectionOptions) (*armruntime.Poller[BackupInstancesClientStopProtectionResponse], error)` +- New function `*OperationStatusResourceGroupContextClient.Get(context.Context, string, string, *OperationStatusResourceGroupContextClientGetOptions) (OperationStatusResourceGroupContextClientGetResponse, error)` +- New function `KubernetesStorageClassRestoreCriteria.MarshalJSON() ([]byte, error)` +- New function `*KubernetesPVRestoreCriteria.GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria` +- New function `*ClientCheckFeatureSupportResponse.UnmarshalJSON([]byte) error` +- New function `NewOperationStatusResourceGroupContextClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationStatusResourceGroupContextClient, error)` +- New function `*BackupInstancesClient.BeginResumeProtection(context.Context, string, string, string, *BackupInstancesClientBeginResumeProtectionOptions) (*armruntime.Poller[BackupInstancesClientResumeProtectionResponse], error)` +- New function `*BackupInstancesClient.GetBackupInstanceOperationResult(context.Context, string, string, string, string, *BackupInstancesClientGetBackupInstanceOperationResultOptions) (BackupInstancesClientGetBackupInstanceOperationResultResponse, error)` +- New function `NewOperationStatusBackupVaultContextClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationStatusBackupVaultContextClient, error)` +- New struct `AutoHealSettings` +- New struct `AzureMonitorAlertSettings` +- New struct `BackupInstancesClientBeginResumeBackupsOptions` +- New struct `BackupInstancesClientBeginResumeProtectionOptions` +- New struct `BackupInstancesClientBeginStopProtectionOptions` +- New struct `BackupInstancesClientBeginSuspendBackupsOptions` +- New struct `BackupInstancesClientBeginSyncBackupInstanceOptions` +- New struct `BackupInstancesClientGetBackupInstanceOperationResultOptions` +- New struct `BackupInstancesClientGetBackupInstanceOperationResultResponse` +- New struct `BackupInstancesClientResumeBackupsResponse` +- New struct `BackupInstancesClientResumeProtectionResponse` +- New struct `BackupInstancesClientStopProtectionResponse` +- New struct `BackupInstancesClientSuspendBackupsResponse` +- New struct `BackupInstancesClientSyncBackupInstanceResponse` +- New struct `BackupInstancesExtensionRoutingClient` +- New struct `BackupInstancesExtensionRoutingClientListOptions` +- New struct `BackupInstancesExtensionRoutingClientListResponse` +- New struct `KubernetesPVRestoreCriteria` +- New struct `KubernetesStorageClassRestoreCriteria` +- New struct `MonitoringSettings` +- New struct `OperationStatusBackupVaultContextClient` +- New struct `OperationStatusBackupVaultContextClientGetOptions` +- New struct `OperationStatusBackupVaultContextClientGetResponse` +- New struct `OperationStatusResourceGroupContextClient` +- New struct `OperationStatusResourceGroupContextClientGetOptions` +- New struct `OperationStatusResourceGroupContextClientGetResponse` +- New struct `PatchBackupVaultInput` +- New struct `SyncBackupInstanceRequest` +- New anonymous field `OperationJobExtendedInfo` in struct `BackupInstancesClientValidateForRestoreResponse` +- New field `ResumeToken` in struct `BackupVaultsClientBeginCreateOrUpdateOptions` +- New field `ResumeToken` in struct `BackupInstancesClientBeginValidateForRestoreOptions` +- New anonymous field `OperationJobExtendedInfo` in struct `BackupInstancesClientAdhocBackupResponse` +- New anonymous field `DppBaseResource` in struct `ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse` +- New field `Value` in struct `SecretStoreResource` +- New field `SourceResourceID` in struct `AzureBackupRecoveryTimeBasedRestoreRequest` +- New anonymous field `DppBaseResourceList` in struct `ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse` +- New field `ResumeToken` in struct `BackupVaultsClientBeginUpdateOptions` +- New anonymous field `AzureBackupJobResourceList` in struct `JobsClientListResponse` +- New anonymous field `FeatureValidationResponseBaseClassification` in struct `ClientCheckFeatureSupportResponse` +- New anonymous field `ResourceGuardResource` in struct `ResourceGuardsClientGetResponse` +- New field `SourceResourceID` in struct `AzureBackupRestoreRequest` +- New anonymous field `DppBaseResource` in struct `ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse` +- New field `ValidationType` in struct `BackupInstance` +- New field `ResumeToken` in struct `BackupInstancesClientBeginDeleteOptions` +- New anonymous field `AzureBackupRecoveryPointResource` in struct `RecoveryPointsClientGetResponse` +- New anonymous field `DppBaseResource` in struct `ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse` +- New anonymous field `DppBaseResourceList` in struct `ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse` +- New anonymous field `DppBaseResourceList` in struct `ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse` +- New anonymous field `BackupVaultResourceList` in struct `BackupVaultsClientGetInSubscriptionResponse` +- New field `ResumeToken` in struct `BackupInstancesClientBeginCreateOrUpdateOptions` +- New anonymous field `BackupVaultResource` in struct `BackupVaultsClientUpdateResponse` +- New anonymous field `BackupVaultResource` in struct `BackupVaultsClientGetResponse` +- New field `ResumeToken` in struct `BackupInstancesClientBeginTriggerRehydrateOptions` +- New anonymous field `ExportJobsResult` in struct `ExportJobsOperationResultClientGetResponse` +- New anonymous field `AzureBackupJobResource` in struct `JobsClientGetResponse` +- New anonymous field `OperationResource` in struct `OperationStatusClientGetResponse` +- New anonymous field `BackupInstanceResourceList` in struct `BackupInstancesClientListResponse` +- New field `MonitoringSettings` in struct `BackupVault` +- New field `SourceResourceID` in struct `AzureBackupRestoreWithRehydrationRequest` +- New field `ResumeToken` in struct `BackupInstancesClientBeginValidateForBackupOptions` +- New anonymous field `DppBaseResourceList` in struct `ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse` +- New anonymous field `BackupInstanceResource` in struct `BackupInstancesClientGetResponse` +- New anonymous field `DppBaseResourceList` in struct `ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse` +- New anonymous field `ResourceGuardResourceList` in struct `ResourceGuardsClientGetResourcesInResourceGroupResponse` +- New anonymous field `BaseBackupPolicyResource` in struct `BackupPoliciesClientGetResponse` +- New anonymous field `DppBaseResource` in struct `ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse` +- New anonymous field `BackupVaultResourceList` in struct `BackupVaultsClientGetInResourceGroupResponse` +- New field `ResumeToken` in struct `ExportJobsClientBeginTriggerOptions` +- New anonymous field `ClientDiscoveryResponse` in struct `OperationsClientListResponse` +- New field `Properties` in struct `PatchResourceRequestInput` +- New field `ResumeToken` in struct `BackupInstancesClientBeginTriggerRestoreOptions` +- New anonymous field `ResourceGuardResourceList` in struct `ResourceGuardsClientGetResourcesInSubscriptionResponse` +- New field `SourceResourceID` in struct `AzureBackupRecoveryPointBasedRestoreRequest` +- New anonymous field `AzureBackupRecoveryPointResourceList` in struct `RecoveryPointsClientListResponse` +- New anonymous field `OperationJobExtendedInfo` in struct `BackupInstancesClientTriggerRestoreResponse` +- New anonymous field `DppBaseResource` in struct `ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse` +- New anonymous field `DppBaseResourceList` in struct `ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse` +- New anonymous field `BaseBackupPolicyResourceList` in struct `BackupPoliciesClientListResponse` +- New anonymous field `ResourceGuardResource` in struct `ResourceGuardsClientPatchResponse` +- New anonymous field `CheckNameAvailabilityResult` in struct `BackupVaultsClientCheckNameAvailabilityResponse` +- New anonymous field `DppBaseResource` in struct `ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse` +- New anonymous field `BackupVaultResource` in struct `BackupVaultOperationResultsClientGetResponse` +- New field `AzureAsyncOperation` in struct `BackupVaultOperationResultsClientGetResponse` +- New field `Location` in struct `BackupVaultOperationResultsClientGetResponse` +- New field `RetryAfter` in struct `BackupVaultOperationResultsClientGetResponse` +- New anonymous field `BaseBackupPolicyResource` in struct `BackupPoliciesClientCreateOrUpdateResponse` +- New anonymous field `OperationJobExtendedInfo` in struct `OperationResultClientGetResponse` +- New field `AzureAsyncOperation` in struct `OperationResultClientGetResponse` +- New field `Location` in struct `OperationResultClientGetResponse` +- New field `RetryAfter` in struct `OperationResultClientGetResponse` +- New anonymous field `BackupVaultResource` in struct `BackupVaultsClientCreateOrUpdateResponse` +- New anonymous field `OperationJobExtendedInfo` in struct `BackupInstancesClientValidateForBackupResponse` +- New anonymous field `AzureBackupFindRestorableTimeRangesResponseResource` in struct `RestorableTimeRangesClientFindResponse` +- New field `ResumeToken` in struct `BackupInstancesClientBeginAdhocBackupOptions` +- New anonymous field `BackupInstanceResource` in struct `BackupInstancesClientCreateOrUpdateResponse` +- New anonymous field `ResourceGuardResource` in struct `ResourceGuardsClientPutResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md index aa7bfe8453bb..1530fe5d098f 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/dataprotection/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/dataprotection/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dataprotection/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dataprotection/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.mod b/sdk/resourcemanager/dataprotection/armdataprotection/go.mod index 6a27638e46e9..7bd099a71998 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/go.mod +++ b/sdk/resourcemanager/dataprotection/armdataprotection/go.mod @@ -1,8 +1,11 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection -go 1.16 +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect + golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect + golang.org/x/text v0.3.6 // indirect ) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum index 2ce51d3b8174..a7eaa30576c1 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum +++ b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum @@ -1,26 +1,11 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -28,32 +13,20 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupinstances_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupinstances_client_test.go deleted file mode 100644 index 24e130fdbb8c..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupinstances_client_test.go +++ /dev/null @@ -1,383 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/ListBackupInstances.json -func ExampleBackupInstancesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - pager := client.List("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/GetBackupInstance.json -func ExampleBackupInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupInstancesClientGetResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/PutBackupInstance.json -func ExampleBackupInstancesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - "", - armdataprotection.BackupInstanceResource{ - Properties: &armdataprotection.BackupInstance{ - DataSourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - DataSourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.StringPtr(""), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: armdataprotection.SecretStoreType("AzureKeyVault").ToPtr(), - URI: to.StringPtr(""), - }, - }, - FriendlyName: to.StringPtr(""), - ObjectType: to.StringPtr(""), - PolicyInfo: &armdataprotection.PolicyInfo{ - PolicyID: to.StringPtr(""), - PolicyParameters: &armdataprotection.PolicyParameters{ - DataStoreParametersList: []armdataprotection.DataStoreParametersClassification{ - &armdataprotection.AzureOperationalStoreParameters{ - DataStoreType: armdataprotection.DataStoreTypes("OperationalStore").ToPtr(), - ObjectType: to.StringPtr(""), - ResourceGroupID: to.StringPtr(""), - }}, - }, - }, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupInstancesClientCreateOrUpdateResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/DeleteBackupInstance.json -func ExampleBackupInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - poller, err := client.BeginDelete(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/TriggerBackup.json -func ExampleBackupInstancesClient_BeginAdhocBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - poller, err := client.BeginAdhocBackup(ctx, - "", - "", - "", - armdataprotection.TriggerBackupRequest{ - BackupRuleOptions: &armdataprotection.AdHocBackupRuleOptions{ - RuleName: to.StringPtr(""), - TriggerOption: &armdataprotection.AdhocBackupTriggerOption{ - RetentionTagOverride: to.StringPtr(""), - }, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupInstancesClientAdhocBackupResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/ValidateForBackup.json -func ExampleBackupInstancesClient_BeginValidateForBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - poller, err := client.BeginValidateForBackup(ctx, - "", - "", - armdataprotection.ValidateForBackupRequest{ - BackupInstance: &armdataprotection.BackupInstance{ - DataSourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - DataSourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.StringPtr(""), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: armdataprotection.SecretStoreType("AzureKeyVault").ToPtr(), - URI: to.StringPtr(""), - }, - }, - FriendlyName: to.StringPtr(""), - ObjectType: to.StringPtr(""), - PolicyInfo: &armdataprotection.PolicyInfo{ - PolicyID: to.StringPtr(""), - }, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupInstancesClientValidateForBackupResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/TriggerRehydrate.json -func ExampleBackupInstancesClient_BeginTriggerRehydrate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - poller, err := client.BeginTriggerRehydrate(ctx, - "", - "", - "", - armdataprotection.AzureBackupRehydrationRequest{ - RecoveryPointID: to.StringPtr(""), - RehydrationPriority: armdataprotection.RehydrationPriority("High").ToPtr(), - RehydrationRetentionDuration: to.StringPtr(""), - }, - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/TriggerRestore.json -func ExampleBackupInstancesClient_BeginTriggerRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - poller, err := client.BeginTriggerRestore(ctx, - "", - "", - "", - &armdataprotection.AzureBackupRecoveryPointBasedRestoreRequest{ - ObjectType: to.StringPtr(""), - RestoreTargetInfo: &armdataprotection.RestoreTargetInfo{ - ObjectType: to.StringPtr(""), - RecoveryOption: armdataprotection.RecoveryOption("FailIfExists").ToPtr(), - RestoreLocation: to.StringPtr(""), - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.StringPtr(""), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: armdataprotection.SecretStoreType("AzureKeyVault").ToPtr(), - URI: to.StringPtr(""), - }, - }, - DatasourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - DatasourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - }, - SourceDataStoreType: armdataprotection.SourceDataStoreType("VaultStore").ToPtr(), - RecoveryPointID: to.StringPtr(""), - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupInstancesClientTriggerRestoreResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/ValidateRestore.json -func ExampleBackupInstancesClient_BeginValidateForRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupInstancesClient("", cred, nil) - poller, err := client.BeginValidateForRestore(ctx, - "", - "", - "", - armdataprotection.ValidateRestoreRequestObject{ - RestoreRequestObject: &armdataprotection.AzureBackupRecoveryPointBasedRestoreRequest{ - ObjectType: to.StringPtr(""), - RestoreTargetInfo: &armdataprotection.RestoreTargetInfo{ - ObjectType: to.StringPtr(""), - RecoveryOption: armdataprotection.RecoveryOption("FailIfExists").ToPtr(), - RestoreLocation: to.StringPtr(""), - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.StringPtr(""), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: armdataprotection.SecretStoreType("AzureKeyVault").ToPtr(), - URI: to.StringPtr(""), - }, - }, - DatasourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - DatasourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.StringPtr(""), - ObjectType: to.StringPtr(""), - ResourceID: to.StringPtr(""), - ResourceLocation: to.StringPtr(""), - ResourceName: to.StringPtr(""), - ResourceType: to.StringPtr(""), - ResourceURI: to.StringPtr(""), - }, - }, - SourceDataStoreType: armdataprotection.SourceDataStoreType("VaultStore").ToPtr(), - RecoveryPointID: to.StringPtr(""), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupInstancesClientValidateForRestoreResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backuppolicies_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backuppolicies_client_test.go deleted file mode 100644 index 8788dd74cf58..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backuppolicies_client_test.go +++ /dev/null @@ -1,183 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/PolicyCRUD/ListBackupPolicy.json -func ExampleBackupPoliciesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupPoliciesClient("", cred, nil) - pager := client.List("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/PolicyCRUD/GetBackupPolicy.json -func ExampleBackupPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupPoliciesClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupPoliciesClientGetResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json -func ExampleBackupPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupPoliciesClient("", cred, nil) - res, err := client.CreateOrUpdate(ctx, - "", - "", - "", - armdataprotection.BaseBackupPolicyResource{ - Properties: &armdataprotection.BackupPolicy{ - DatasourceTypes: []*string{ - to.StringPtr("OssDB")}, - ObjectType: to.StringPtr(""), - PolicyRules: []armdataprotection.BasePolicyRuleClassification{ - &armdataprotection.AzureBackupRule{ - Name: to.StringPtr(""), - ObjectType: to.StringPtr(""), - BackupParameters: &armdataprotection.AzureBackupParams{ - ObjectType: to.StringPtr(""), - BackupType: to.StringPtr(""), - }, - DataStore: &armdataprotection.DataStoreInfoBase{ - DataStoreType: armdataprotection.DataStoreTypes("VaultStore").ToPtr(), - ObjectType: to.StringPtr(""), - }, - Trigger: &armdataprotection.ScheduleBasedTriggerContext{ - ObjectType: to.StringPtr(""), - Schedule: &armdataprotection.BackupSchedule{ - RepeatingTimeIntervals: []*string{ - to.StringPtr("R/2019-11-20T08:00:00-08:00/P1W")}, - }, - TaggingCriteria: []*armdataprotection.TaggingCriteria{ - { - IsDefault: to.BoolPtr(true), - TagInfo: &armdataprotection.RetentionTag{ - TagName: to.StringPtr(""), - }, - TaggingPriority: to.Int64Ptr(99), - }, - { - Criteria: []armdataprotection.BackupCriteriaClassification{ - &armdataprotection.ScheduleBasedBackupCriteria{ - ObjectType: to.StringPtr(""), - DaysOfTheWeek: []*armdataprotection.DayOfWeek{ - armdataprotection.DayOfWeek("Sunday").ToPtr()}, - ScheduleTimes: []*time.Time{ - to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t }())}, - }}, - IsDefault: to.BoolPtr(false), - TagInfo: &armdataprotection.RetentionTag{ - TagName: to.StringPtr(""), - }, - TaggingPriority: to.Int64Ptr(20), - }}, - }, - }, - &armdataprotection.AzureRetentionRule{ - Name: to.StringPtr(""), - ObjectType: to.StringPtr(""), - IsDefault: to.BoolPtr(true), - Lifecycles: []*armdataprotection.SourceLifeCycle{ - { - DeleteAfter: &armdataprotection.AbsoluteDeleteOption{ - Duration: to.StringPtr(""), - ObjectType: to.StringPtr(""), - }, - SourceDataStore: &armdataprotection.DataStoreInfoBase{ - DataStoreType: armdataprotection.DataStoreTypes("VaultStore").ToPtr(), - ObjectType: to.StringPtr(""), - }, - }}, - }, - &armdataprotection.AzureRetentionRule{ - Name: to.StringPtr(""), - ObjectType: to.StringPtr(""), - IsDefault: to.BoolPtr(false), - Lifecycles: []*armdataprotection.SourceLifeCycle{ - { - DeleteAfter: &armdataprotection.AbsoluteDeleteOption{ - Duration: to.StringPtr(""), - ObjectType: to.StringPtr(""), - }, - SourceDataStore: &armdataprotection.DataStoreInfoBase{ - DataStoreType: armdataprotection.DataStoreTypes("VaultStore").ToPtr(), - ObjectType: to.StringPtr(""), - }, - }}, - }}, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupPoliciesClientCreateOrUpdateResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/PolicyCRUD/DeleteBackupPolicy.json -func ExampleBackupPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupPoliciesClient("", cred, nil) - _, err = client.Delete(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaultoperationresults_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaultoperationresults_client_test.go deleted file mode 100644 index 329300d158a8..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaultoperationresults_client_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/GetOperationResultPatch.json -func ExampleBackupVaultOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultOperationResultsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupVaultOperationResultsClientGetResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaults_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaults_client_test.go deleted file mode 100644 index 576f8a903d9d..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaults_client_test.go +++ /dev/null @@ -1,189 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json -func ExampleBackupVaultsClient_GetInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultsClient("", cred, nil) - pager := client.GetInSubscription(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json -func ExampleBackupVaultsClient_GetInResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultsClient("", cred, nil) - pager := client.GetInResourceGroup("", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/GetBackupVault.json -func ExampleBackupVaultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupVaultsClientGetResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/PutBackupVault.json -func ExampleBackupVaultsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultsClient("", cred, nil) - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - armdataprotection.BackupVaultResource{ - Identity: &armdataprotection.DppIdentityDetails{ - Type: to.StringPtr(""), - }, - Location: to.StringPtr(""), - Tags: map[string]*string{ - "key1": to.StringPtr("val1"), - }, - Properties: &armdataprotection.BackupVault{ - StorageSettings: []*armdataprotection.StorageSetting{ - { - Type: armdataprotection.StorageSettingTypes("LocallyRedundant").ToPtr(), - DatastoreType: armdataprotection.StorageSettingStoreTypes("VaultStore").ToPtr(), - }}, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupVaultsClientCreateOrUpdateResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/DeleteBackupVault.json -func ExampleBackupVaultsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultsClient("", cred, nil) - _, err = client.Delete(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/PatchBackupVault.json -func ExampleBackupVaultsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultsClient("", cred, nil) - poller, err := client.BeginUpdate(ctx, - "", - "", - armdataprotection.PatchResourceRequestInput{ - Tags: map[string]*string{ - "newKey": to.StringPtr("newVal"), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupVaultsClientUpdateResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json -func ExampleBackupVaultsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewBackupVaultsClient("", cred, nil) - res, err := client.CheckNameAvailability(ctx, - "", - "", - armdataprotection.CheckNameAvailabilityRequest{ - Name: to.StringPtr(""), - Type: to.StringPtr(""), - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BackupVaultsClientCheckNameAvailabilityResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotection_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotection_client_test.go deleted file mode 100644 index 6210881ef8d2..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotection_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/CheckfeatureSupport.json -func ExampleClient_CheckFeatureSupport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewClient("", cred, nil) - res, err := client.CheckFeatureSupport(ctx, - "", - &armdataprotection.FeatureValidationRequest{ - ObjectType: to.StringPtr(""), - FeatureType: armdataprotection.FeatureType("DataSourceType").ToPtr(), - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientCheckFeatureSupportResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotectionoperations_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotectionoperations_client_test.go deleted file mode 100644 index 5dcf772f5753..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotectionoperations_client_test.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/Operations/List.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewOperationsClient(cred, nil) - pager := client.List(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobs_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobs_client_test.go deleted file mode 100644 index 4c12efb729a6..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobs_client_test.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/JobCRUD/TriggerExportJobs.json -func ExampleExportJobsClient_BeginTrigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewExportJobsClient("", cred, nil) - poller, err := client.BeginTrigger(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobsoperationresult_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobsoperationresult_client_test.go deleted file mode 100644 index a52e05595f3f..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobsoperationresult_client_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/JobCRUD/GetExportJobsOperationResult.json -func ExampleExportJobsOperationResultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewExportJobsOperationResultClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ExportJobsOperationResultClientGetResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_jobs_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_jobs_client_test.go deleted file mode 100644 index 5be106e80896..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_jobs_client_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/JobCRUD/ListJobs.json -func ExampleJobsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewJobsClient("", cred, nil) - pager := client.List("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/JobCRUD/GetJob.json -func ExampleJobsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewJobsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.JobsClientGetResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationresult_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationresult_client_test.go deleted file mode 100644 index 7a1f94f15f64..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationresult_client_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/GetOperationResult.json -func ExampleOperationResultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewOperationResultClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.OperationResultClientGetResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatus_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatus_client_test.go deleted file mode 100644 index 452ef01c9c09..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatus_client_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/GetOperationStatus.json -func ExampleOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewOperationStatusClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.OperationStatusClientGetResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_recoverypoints_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_recoverypoints_client_test.go deleted file mode 100644 index 2b6189433343..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_recoverypoints_client_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/ListRecoveryPoints.json -func ExampleRecoveryPointsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewRecoveryPointsClient("", cred, nil) - pager := client.List("", - "", - "", - &armdataprotection.RecoveryPointsClientListOptions{Filter: nil, - SkipToken: nil, - }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/GetRecoveryPoint.json -func ExampleRecoveryPointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewRecoveryPointsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.RecoveryPointsClientGetResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_resourceguards_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_resourceguards_client_test.go deleted file mode 100644 index 5061b1882a01..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_resourceguards_client_test.go +++ /dev/null @@ -1,411 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json -func ExampleResourceGuardsClient_GetResourcesInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetResourcesInSubscription(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json -func ExampleResourceGuardsClient_GetResourcesInResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetResourcesInResourceGroup("", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/PutResourceGuard.json -func ExampleResourceGuardsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.Put(ctx, - "", - "", - armdataprotection.ResourceGuardResource{ - Location: to.StringPtr(""), - Tags: map[string]*string{ - "key1": to.StringPtr("val1"), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientPutResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetResourceGuard.json -func ExampleResourceGuardsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientGetResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json -func ExampleResourceGuardsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - _, err = client.Delete(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/PatchResourceGuard.json -func ExampleResourceGuardsClient_Patch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.Patch(ctx, - "", - "", - armdataprotection.PatchResourceRequestInput{ - Tags: map[string]*string{ - "newKey": to.StringPtr("newVal"), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientPatchResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json -func ExampleResourceGuardsClient_GetDisableSoftDeleteRequestsObjects() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetDisableSoftDeleteRequestsObjects("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json -func ExampleResourceGuardsClient_GetDeleteResourceGuardProxyRequestsObjects() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetDeleteResourceGuardProxyRequestsObjects("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json -func ExampleResourceGuardsClient_GetBackupSecurityPINRequestsObjects() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetBackupSecurityPINRequestsObjects("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json -func ExampleResourceGuardsClient_GetDeleteProtectedItemRequestsObjects() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetDeleteProtectedItemRequestsObjects("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json -func ExampleResourceGuardsClient_GetUpdateProtectionPolicyRequestsObjects() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetUpdateProtectionPolicyRequestsObjects("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json -func ExampleResourceGuardsClient_GetUpdateProtectedItemRequestsObjects() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - pager := client.GetUpdateProtectedItemRequestsObjects("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json -func ExampleResourceGuardsClient_GetDefaultDisableSoftDeleteRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.GetDefaultDisableSoftDeleteRequestsObject(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json -func ExampleResourceGuardsClient_GetDefaultDeleteResourceGuardProxyRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.GetDefaultDeleteResourceGuardProxyRequestsObject(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json -func ExampleResourceGuardsClient_GetDefaultBackupSecurityPINRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.GetDefaultBackupSecurityPINRequestsObject(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json -func ExampleResourceGuardsClient_GetDefaultDeleteProtectedItemRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.GetDefaultDeleteProtectedItemRequestsObject(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json -func ExampleResourceGuardsClient_GetDefaultUpdateProtectionPolicyRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.GetDefaultUpdateProtectionPolicyRequestsObject(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResult) -} - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json -func ExampleResourceGuardsClient_GetDefaultUpdateProtectedItemRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewResourceGuardsClient("", cred, nil) - res, err := client.GetDefaultUpdateProtectedItemRequestsObject(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_restorabletimeranges_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_restorabletimeranges_client_test.go deleted file mode 100644 index 80549f1c8dd8..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_restorabletimeranges_client_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json -func ExampleRestorableTimeRangesClient_Find() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdataprotection.NewRestorableTimeRangesClient("", cred, nil) - res, err := client.Find(ctx, - "", - "", - "", - armdataprotection.AzureBackupFindRestorableTimeRangesRequest{ - EndTime: to.StringPtr(""), - SourceDataStoreType: armdataprotection.RestoreSourceDataStoreType("OperationalStore").ToPtr(), - StartTime: to.StringPtr(""), - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.RestorableTimeRangesClientFindResult) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstances_client.go index 45aeccb6ed9f..ea6f063b3cc3 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstances_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstances_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,52 +34,50 @@ type BackupInstancesClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewBackupInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupInstancesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewBackupInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupInstancesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &BackupInstancesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginAdhocBackup - Trigger adhoc backup // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // parameters - Request body for operation // options - BackupInstancesClientBeginAdhocBackupOptions contains the optional parameters for the BackupInstancesClient.BeginAdhocBackup // method. -func (client *BackupInstancesClient) BeginAdhocBackup(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (BackupInstancesClientAdhocBackupPollerResponse, error) { - resp, err := client.adhocBackup(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) - if err != nil { - return BackupInstancesClientAdhocBackupPollerResponse{}, err - } - result := BackupInstancesClientAdhocBackupPollerResponse{ - RawResponse: resp, +func (client *BackupInstancesClient) BeginAdhocBackup(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*armruntime.Poller[BackupInstancesClientAdhocBackupResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.adhocBackup(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientAdhocBackupResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientAdhocBackupResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("BackupInstancesClient.AdhocBackup", "", resp, client.pl) - if err != nil { - return BackupInstancesClientAdhocBackupPollerResponse{}, err - } - result.Poller = &BackupInstancesClientAdhocBackupPoller{ - pt: pt, - } - return result, nil } // AdhocBackup - Trigger adhoc backup // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupInstancesClient) adhocBackup(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*http.Response, error) { - req, err := client.adhocBackupCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) +func (client *BackupInstancesClient) adhocBackup(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*http.Response, error) { + req, err := client.adhocBackupCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } @@ -93,20 +92,20 @@ func (client *BackupInstancesClient) adhocBackup(ctx context.Context, vaultName } // adhocBackupCreateRequest creates the AdhocBackup request. -func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -116,7 +115,7 @@ func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -124,34 +123,28 @@ func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Contex // BeginCreateOrUpdate - Create or update a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // parameters - Request body for operation // options - BackupInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupInstancesClient.BeginCreateOrUpdate // method. -func (client *BackupInstancesClient) BeginCreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (BackupInstancesClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) - if err != nil { - return BackupInstancesClientCreateOrUpdatePollerResponse{}, err - } - result := BackupInstancesClientCreateOrUpdatePollerResponse{ - RawResponse: resp, +func (client *BackupInstancesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*armruntime.Poller[BackupInstancesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("BackupInstancesClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return BackupInstancesClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &BackupInstancesClientCreateOrUpdatePoller{ - pt: pt, - } - return result, nil } // CreateOrUpdate - Create or update a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupInstancesClient) createOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) +func (client *BackupInstancesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } @@ -159,27 +152,27 @@ func (client *BackupInstancesClient) createOrUpdate(ctx context.Context, vaultNa if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -189,7 +182,7 @@ func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -197,33 +190,27 @@ func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Delete a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // options - BackupInstancesClientBeginDeleteOptions contains the optional parameters for the BackupInstancesClient.BeginDelete // method. -func (client *BackupInstancesClient) BeginDelete(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (BackupInstancesClientDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, vaultName, resourceGroupName, backupInstanceName, options) - if err != nil { - return BackupInstancesClientDeletePollerResponse{}, err - } - result := BackupInstancesClientDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("BackupInstancesClient.Delete", "", resp, client.pl) - if err != nil { - return BackupInstancesClientDeletePollerResponse{}, err +func (client *BackupInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*armruntime.Poller[BackupInstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientDeleteResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientDeleteResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &BackupInstancesClientDeletePoller{ - pt: pt, - } - return result, nil } // Delete - Delete a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupInstancesClient) deleteOperation(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, options) +func (client *BackupInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return nil, err } @@ -238,20 +225,20 @@ func (client *BackupInstancesClient) deleteOperation(ctx context.Context, vaultN } // deleteCreateRequest creates the Delete request. -func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -261,7 +248,7 @@ func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, va return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -269,12 +256,12 @@ func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, va // Get - Gets a backup instance with name in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // options - BackupInstancesClientGetOptions contains the optional parameters for the BackupInstancesClient.Get method. -func (client *BackupInstancesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, options *BackupInstancesClientGetOptions) (BackupInstancesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, options) +func (client *BackupInstancesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientGetOptions) (BackupInstancesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return BackupInstancesClientGetResponse{}, err } @@ -289,20 +276,20 @@ func (client *BackupInstancesClient) Get(ctx context.Context, vaultName string, } // getCreateRequest creates the Get request. -func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, options *BackupInstancesClientGetOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -312,7 +299,7 @@ func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, vault return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -320,51 +307,131 @@ func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, vault // getHandleResponse handles the Get response. func (client *BackupInstancesClient) getHandleResponse(resp *http.Response) (BackupInstancesClientGetResponse, error) { - result := BackupInstancesClientGetResponse{RawResponse: resp} + result := BackupInstancesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupInstanceResource); err != nil { return BackupInstancesClientGetResponse{}, err } return result, nil } -// List - Gets a backup instances belonging to a backup vault +// GetBackupInstanceOperationResult - Get result of backup instance creation operation // If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. // vaultName - The name of the backup vault. +// options - BackupInstancesClientGetBackupInstanceOperationResultOptions contains the optional parameters for the BackupInstancesClient.GetBackupInstanceOperationResult +// method. +func (client *BackupInstancesClient) GetBackupInstanceOperationResult(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, operationID string, options *BackupInstancesClientGetBackupInstanceOperationResultOptions) (BackupInstancesClientGetBackupInstanceOperationResultResponse, error) { + req, err := client.getBackupInstanceOperationResultCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, operationID, options) + if err != nil { + return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, runtime.NewResponseError(resp) + } + return client.getBackupInstanceOperationResultHandleResponse(resp) +} + +// getBackupInstanceOperationResultCreateRequest creates the GetBackupInstanceOperationResult request. +func (client *BackupInstancesClient) getBackupInstanceOperationResultCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, operationID string, options *BackupInstancesClientGetBackupInstanceOperationResultOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getBackupInstanceOperationResultHandleResponse handles the GetBackupInstanceOperationResult response. +func (client *BackupInstancesClient) getBackupInstanceOperationResultHandleResponse(resp *http.Response) (BackupInstancesClientGetBackupInstanceOperationResultResponse, error) { + result := BackupInstancesClientGetBackupInstanceOperationResultResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupInstanceResource); err != nil { + return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, err + } + return result, nil +} + +// List - Gets a backup instances belonging to a backup vault +// If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // options - BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.List method. -func (client *BackupInstancesClient) List(vaultName string, resourceGroupName string, options *BackupInstancesClientListOptions) *BackupInstancesClientListPager { - return &BackupInstancesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) +func (client *BackupInstancesClient) List(resourceGroupName string, vaultName string, options *BackupInstancesClientListOptions) *runtime.Pager[BackupInstancesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[BackupInstancesClientListResponse]{ + More: func(page BackupInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp BackupInstancesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.BackupInstanceResourceList.NextLink) + Fetcher: func(ctx context.Context, page *BackupInstancesClientListResponse) (BackupInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupInstancesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. -func (client *BackupInstancesClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupInstancesClientListOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -372,36 +439,358 @@ func (client *BackupInstancesClient) listCreateRequest(ctx context.Context, vaul // listHandleResponse handles the List response. func (client *BackupInstancesClient) listHandleResponse(resp *http.Response) (BackupInstancesClientListResponse, error) { - result := BackupInstancesClientListResponse{RawResponse: resp} + result := BackupInstancesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupInstanceResourceList); err != nil { return BackupInstancesClientListResponse{}, err } return result, nil } -// BeginTriggerRehydrate - rehydrate recovery point for restore for a BackupInstance +// BeginResumeBackups - This operation will resume backups for backup instance +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. +// options - BackupInstancesClientBeginResumeBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginResumeBackups +// method. +func (client *BackupInstancesClient) BeginResumeBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeBackupsOptions) (*armruntime.Poller[BackupInstancesClientResumeBackupsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resumeBackups(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientResumeBackupsResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientResumeBackupsResponse](options.ResumeToken, client.pl, nil) + } +} + +// ResumeBackups - This operation will resume backups for backup instance +// If the operation fails it returns an *azcore.ResponseError type. +func (client *BackupInstancesClient) resumeBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeBackupsOptions) (*http.Response, error) { + req, err := client.resumeBackupsCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resumeBackupsCreateRequest creates the ResumeBackups request. +func (client *BackupInstancesClient) resumeBackupsCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeBackupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// BeginResumeProtection - This operation will resume protection for a stopped backup instance +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. +// options - BackupInstancesClientBeginResumeProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginResumeProtection +// method. +func (client *BackupInstancesClient) BeginResumeProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeProtectionOptions) (*armruntime.Poller[BackupInstancesClientResumeProtectionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resumeProtection(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientResumeProtectionResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientResumeProtectionResponse](options.ResumeToken, client.pl, nil) + } +} + +// ResumeProtection - This operation will resume protection for a stopped backup instance +// If the operation fails it returns an *azcore.ResponseError type. +func (client *BackupInstancesClient) resumeProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeProtectionOptions) (*http.Response, error) { + req, err := client.resumeProtectionCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resumeProtectionCreateRequest creates the ResumeProtection request. +func (client *BackupInstancesClient) resumeProtectionCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeProtectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// BeginStopProtection - This operation will stop protection of a backup instance and data will be held forever +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. +// options - BackupInstancesClientBeginStopProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginStopProtection +// method. +func (client *BackupInstancesClient) BeginStopProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginStopProtectionOptions) (*armruntime.Poller[BackupInstancesClientStopProtectionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stopProtection(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientStopProtectionResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientStopProtectionResponse](options.ResumeToken, client.pl, nil) + } +} + +// StopProtection - This operation will stop protection of a backup instance and data will be held forever +// If the operation fails it returns an *azcore.ResponseError type. +func (client *BackupInstancesClient) stopProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginStopProtectionOptions) (*http.Response, error) { + req, err := client.stopProtectionCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopProtectionCreateRequest creates the StopProtection request. +func (client *BackupInstancesClient) stopProtectionCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginStopProtectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// BeginSuspendBackups - This operation will stop backups for backup instance +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. +// options - BackupInstancesClientBeginSuspendBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginSuspendBackups +// method. +func (client *BackupInstancesClient) BeginSuspendBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginSuspendBackupsOptions) (*armruntime.Poller[BackupInstancesClientSuspendBackupsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.suspendBackups(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientSuspendBackupsResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientSuspendBackupsResponse](options.ResumeToken, client.pl, nil) + } +} + +// SuspendBackups - This operation will stop backups for backup instance +// If the operation fails it returns an *azcore.ResponseError type. +func (client *BackupInstancesClient) suspendBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginSuspendBackupsOptions) (*http.Response, error) { + req, err := client.suspendBackupsCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// suspendBackupsCreateRequest creates the SuspendBackups request. +func (client *BackupInstancesClient) suspendBackupsCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginSuspendBackupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// BeginSyncBackupInstance - Sync backup instance again in case of failure This action will retry last failed operation and +// will bring backup instance to valid state // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group where the backup vault is present. // vaultName - The name of the backup vault. // parameters - Request body for operation -// options - BackupInstancesClientBeginTriggerRehydrateOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRehydrate +// options - BackupInstancesClientBeginSyncBackupInstanceOptions contains the optional parameters for the BackupInstancesClient.BeginSyncBackupInstance // method. -func (client *BackupInstancesClient) BeginTriggerRehydrate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRehydrationRequest, options *BackupInstancesClientBeginTriggerRehydrateOptions) (BackupInstancesClientTriggerRehydratePollerResponse, error) { - resp, err := client.triggerRehydrate(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) +func (client *BackupInstancesClient) BeginSyncBackupInstance(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters SyncBackupInstanceRequest, options *BackupInstancesClientBeginSyncBackupInstanceOptions) (*armruntime.Poller[BackupInstancesClientSyncBackupInstanceResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.syncBackupInstance(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientSyncBackupInstanceResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientSyncBackupInstanceResponse](options.ResumeToken, client.pl, nil) + } +} + +// SyncBackupInstance - Sync backup instance again in case of failure This action will retry last failed operation and will +// bring backup instance to valid state +// If the operation fails it returns an *azcore.ResponseError type. +func (client *BackupInstancesClient) syncBackupInstance(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters SyncBackupInstanceRequest, options *BackupInstancesClientBeginSyncBackupInstanceOptions) (*http.Response, error) { + req, err := client.syncBackupInstanceCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) if err != nil { - return BackupInstancesClientTriggerRehydratePollerResponse{}, err + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// syncBackupInstanceCreateRequest creates the SyncBackupInstance request. +func (client *BackupInstancesClient) syncBackupInstanceCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters SyncBackupInstanceRequest, options *BackupInstancesClientBeginSyncBackupInstanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - result := BackupInstancesClientTriggerRehydratePollerResponse{ - RawResponse: resp, + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") } - pt, err := armruntime.NewPoller("BackupInstancesClient.TriggerRehydrate", "", resp, client.pl) + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) if err != nil { - return BackupInstancesClientTriggerRehydratePollerResponse{}, err + return nil, err } - result.Poller = &BackupInstancesClientTriggerRehydratePoller{ - pt: pt, + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginTriggerRehydrate - rehydrate recovery point for restore for a BackupInstance +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. +// parameters - Request body for operation +// options - BackupInstancesClientBeginTriggerRehydrateOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRehydrate +// method. +func (client *BackupInstancesClient) BeginTriggerRehydrate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRehydrationRequest, options *BackupInstancesClientBeginTriggerRehydrateOptions) (*armruntime.Poller[BackupInstancesClientTriggerRehydrateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.triggerRehydrate(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientTriggerRehydrateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientTriggerRehydrateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // TriggerRehydrate - rehydrate recovery point for restore for a BackupInstance @@ -445,7 +834,7 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -453,34 +842,28 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C // BeginTriggerRestore - Triggers restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // parameters - Request body for operation // options - BackupInstancesClientBeginTriggerRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRestore // method. -func (client *BackupInstancesClient) BeginTriggerRestore(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (BackupInstancesClientTriggerRestorePollerResponse, error) { - resp, err := client.triggerRestore(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) - if err != nil { - return BackupInstancesClientTriggerRestorePollerResponse{}, err - } - result := BackupInstancesClientTriggerRestorePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("BackupInstancesClient.TriggerRestore", "", resp, client.pl) - if err != nil { - return BackupInstancesClientTriggerRestorePollerResponse{}, err +func (client *BackupInstancesClient) BeginTriggerRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*armruntime.Poller[BackupInstancesClientTriggerRestoreResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.triggerRestore(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientTriggerRestoreResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientTriggerRestoreResponse](options.ResumeToken, client.pl, nil) } - result.Poller = &BackupInstancesClientTriggerRestorePoller{ - pt: pt, - } - return result, nil } // TriggerRestore - Triggers restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupInstancesClient) triggerRestore(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*http.Response, error) { - req, err := client.triggerRestoreCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) +func (client *BackupInstancesClient) triggerRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*http.Response, error) { + req, err := client.triggerRestoreCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } @@ -495,20 +878,20 @@ func (client *BackupInstancesClient) triggerRestore(ctx context.Context, vaultNa } // triggerRestoreCreateRequest creates the TriggerRestore request. -func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -518,7 +901,7 @@ func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -526,33 +909,27 @@ func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Con // BeginValidateForBackup - Validate whether adhoc backup will be successful or not // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // parameters - Request body for operation // options - BackupInstancesClientBeginValidateForBackupOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForBackup // method. -func (client *BackupInstancesClient) BeginValidateForBackup(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (BackupInstancesClientValidateForBackupPollerResponse, error) { - resp, err := client.validateForBackup(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return BackupInstancesClientValidateForBackupPollerResponse{}, err - } - result := BackupInstancesClientValidateForBackupPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("BackupInstancesClient.ValidateForBackup", "", resp, client.pl) - if err != nil { - return BackupInstancesClientValidateForBackupPollerResponse{}, err - } - result.Poller = &BackupInstancesClientValidateForBackupPoller{ - pt: pt, +func (client *BackupInstancesClient) BeginValidateForBackup(ctx context.Context, resourceGroupName string, vaultName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*armruntime.Poller[BackupInstancesClientValidateForBackupResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateForBackup(ctx, resourceGroupName, vaultName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientValidateForBackupResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientValidateForBackupResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // ValidateForBackup - Validate whether adhoc backup will be successful or not // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupInstancesClient) validateForBackup(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*http.Response, error) { - req, err := client.validateForBackupCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) +func (client *BackupInstancesClient) validateForBackup(ctx context.Context, resourceGroupName string, vaultName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*http.Response, error) { + req, err := client.validateForBackupCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } @@ -567,26 +944,26 @@ func (client *BackupInstancesClient) validateForBackup(ctx context.Context, vaul } // validateForBackupCreateRequest creates the ValidateForBackup request. -func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -594,34 +971,28 @@ func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context. // BeginValidateForRestore - Validates if Restore can be triggered for a DataSource // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // parameters - Request body for operation // options - BackupInstancesClientBeginValidateForRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForRestore // method. -func (client *BackupInstancesClient) BeginValidateForRestore(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (BackupInstancesClientValidateForRestorePollerResponse, error) { - resp, err := client.validateForRestore(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) - if err != nil { - return BackupInstancesClientValidateForRestorePollerResponse{}, err - } - result := BackupInstancesClientValidateForRestorePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("BackupInstancesClient.ValidateForRestore", "", resp, client.pl) - if err != nil { - return BackupInstancesClientValidateForRestorePollerResponse{}, err - } - result.Poller = &BackupInstancesClientValidateForRestorePoller{ - pt: pt, +func (client *BackupInstancesClient) BeginValidateForRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*armruntime.Poller[BackupInstancesClientValidateForRestoreResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateForRestore(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupInstancesClientValidateForRestoreResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupInstancesClientValidateForRestoreResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // ValidateForRestore - Validates if Restore can be triggered for a DataSource // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupInstancesClient) validateForRestore(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*http.Response, error) { - req, err := client.validateForRestoreCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) +func (client *BackupInstancesClient) validateForRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*http.Response, error) { + req, err := client.validateForRestoreCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } @@ -636,20 +1007,20 @@ func (client *BackupInstancesClient) validateForRestore(ctx context.Context, vau } // validateForRestoreCreateRequest creates the ValidateForRestore request. -func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*policy.Request, error) { +func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -659,7 +1030,7 @@ func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstancesextensionrouting_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstancesextensionrouting_client.go new file mode 100644 index 000000000000..1f39538a29e0 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstancesextensionrouting_client.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// 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. + +package armdataprotection + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BackupInstancesExtensionRoutingClient contains the methods for the BackupInstancesExtensionRouting group. +// Don't use this type directly, use NewBackupInstancesExtensionRoutingClient() instead. +type BackupInstancesExtensionRoutingClient struct { + host string + pl runtime.Pipeline +} + +// NewBackupInstancesExtensionRoutingClient creates a new instance of BackupInstancesExtensionRoutingClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewBackupInstancesExtensionRoutingClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupInstancesExtensionRoutingClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &BackupInstancesExtensionRoutingClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// List - Gets a list backup instances associated with a tracked resource +// If the operation fails it returns an *azcore.ResponseError type. +// resourceID - ARM path of the resource to be protected using Microsoft.DataProtection +// options - BackupInstancesExtensionRoutingClientListOptions contains the optional parameters for the BackupInstancesExtensionRoutingClient.List +// method. +func (client *BackupInstancesExtensionRoutingClient) List(resourceID string, options *BackupInstancesExtensionRoutingClientListOptions) *runtime.Pager[BackupInstancesExtensionRoutingClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[BackupInstancesExtensionRoutingClientListResponse]{ + More: func(page BackupInstancesExtensionRoutingClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BackupInstancesExtensionRoutingClientListResponse) (BackupInstancesExtensionRoutingClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupInstancesExtensionRoutingClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupInstancesExtensionRoutingClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupInstancesExtensionRoutingClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *BackupInstancesExtensionRoutingClient) listCreateRequest(ctx context.Context, resourceID string, options *BackupInstancesExtensionRoutingClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.DataProtection/backupInstances" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", url.PathEscape(resourceID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BackupInstancesExtensionRoutingClient) listHandleResponse(resp *http.Response) (BackupInstancesExtensionRoutingClientListResponse, error) { + result := BackupInstancesExtensionRoutingClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupInstanceResourceList); err != nil { + return BackupInstancesExtensionRoutingClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backuppolicies_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backuppolicies_client.go index dfad1b81eed0..761bd3492324 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backuppolicies_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backuppolicies_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,32 +34,36 @@ type BackupPoliciesClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupPoliciesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupPoliciesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &BackupPoliciesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Creates or Updates a backup policy belonging to a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupPolicyName - Name of the policy // parameters - Request body for operation // options - BackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BackupPoliciesClient.CreateOrUpdate // method. -func (client *BackupPoliciesClient) CreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, parameters BaseBackupPolicyResource, options *BackupPoliciesClientCreateOrUpdateOptions) (BackupPoliciesClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, vaultName, resourceGroupName, backupPolicyName, parameters, options) +func (client *BackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, parameters BaseBackupPolicyResource, options *BackupPoliciesClientCreateOrUpdateOptions) (BackupPoliciesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, parameters, options) if err != nil { return BackupPoliciesClientCreateOrUpdateResponse{}, err } @@ -73,20 +78,20 @@ func (client *BackupPoliciesClient) CreateOrUpdate(ctx context.Context, vaultNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, parameters BaseBackupPolicyResource, options *BackupPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, parameters BaseBackupPolicyResource, options *BackupPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupPolicyName == "" { return nil, errors.New("parameter backupPolicyName cannot be empty") } @@ -96,7 +101,7 @@ func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -104,7 +109,7 @@ func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Cont // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *BackupPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (BackupPoliciesClientCreateOrUpdateResponse, error) { - result := BackupPoliciesClientCreateOrUpdateResponse{RawResponse: resp} + result := BackupPoliciesClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BaseBackupPolicyResource); err != nil { return BackupPoliciesClientCreateOrUpdateResponse{}, err } @@ -113,11 +118,11 @@ func (client *BackupPoliciesClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Deletes a backup policy belonging to a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // options - BackupPoliciesClientDeleteOptions contains the optional parameters for the BackupPoliciesClient.Delete method. -func (client *BackupPoliciesClient) Delete(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, options *BackupPoliciesClientDeleteOptions) (BackupPoliciesClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, backupPolicyName, options) +func (client *BackupPoliciesClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientDeleteOptions) (BackupPoliciesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, options) if err != nil { return BackupPoliciesClientDeleteResponse{}, err } @@ -128,24 +133,24 @@ func (client *BackupPoliciesClient) Delete(ctx context.Context, vaultName string if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return BackupPoliciesClientDeleteResponse{}, runtime.NewResponseError(resp) } - return BackupPoliciesClientDeleteResponse{RawResponse: resp}, nil + return BackupPoliciesClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. -func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, options *BackupPoliciesClientDeleteOptions) (*policy.Request, error) { +func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupPolicyName == "" { return nil, errors.New("parameter backupPolicyName cannot be empty") } @@ -155,7 +160,7 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, vau return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -163,11 +168,11 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, vau // Get - Gets a backup policy belonging to a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // options - BackupPoliciesClientGetOptions contains the optional parameters for the BackupPoliciesClient.Get method. -func (client *BackupPoliciesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, options *BackupPoliciesClientGetOptions) (BackupPoliciesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, backupPolicyName, options) +func (client *BackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientGetOptions) (BackupPoliciesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, options) if err != nil { return BackupPoliciesClientGetResponse{}, err } @@ -182,20 +187,20 @@ func (client *BackupPoliciesClient) Get(ctx context.Context, vaultName string, r } // getCreateRequest creates the Get request. -func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, options *BackupPoliciesClientGetOptions) (*policy.Request, error) { +func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupPolicyName == "" { return nil, errors.New("parameter backupPolicyName cannot be empty") } @@ -205,7 +210,7 @@ func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, vaultN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -213,7 +218,7 @@ func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, vaultN // getHandleResponse handles the Get response. func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (BackupPoliciesClientGetResponse, error) { - result := BackupPoliciesClientGetResponse{RawResponse: resp} + result := BackupPoliciesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BaseBackupPolicyResource); err != nil { return BackupPoliciesClientGetResponse{}, err } @@ -222,42 +227,58 @@ func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (Back // List - Returns list of backup policies belonging to a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // options - BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.List method. -func (client *BackupPoliciesClient) List(vaultName string, resourceGroupName string, options *BackupPoliciesClientListOptions) *BackupPoliciesClientListPager { - return &BackupPoliciesClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) +func (client *BackupPoliciesClient) List(resourceGroupName string, vaultName string, options *BackupPoliciesClientListOptions) *runtime.Pager[BackupPoliciesClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[BackupPoliciesClientListResponse]{ + More: func(page BackupPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp BackupPoliciesClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.BaseBackupPolicyResourceList.NextLink) + Fetcher: func(ctx context.Context, page *BackupPoliciesClientListResponse) (BackupPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. -func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupPoliciesClientListOptions) (*policy.Request, error) { +func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupPoliciesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -265,7 +286,7 @@ func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, vault // listHandleResponse handles the List response. func (client *BackupPoliciesClient) listHandleResponse(resp *http.Response) (BackupPoliciesClientListResponse, error) { - result := BackupPoliciesClientListResponse{RawResponse: resp} + result := BackupPoliciesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BaseBackupPolicyResourceList); err != nil { return BackupPoliciesClientListResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaultoperationresults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaultoperationresults_client.go index 485427a77811..6db56f5a8145 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaultoperationresults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaultoperationresults_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,30 +35,34 @@ type BackupVaultOperationResultsClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewBackupVaultOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupVaultOperationResultsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewBackupVaultOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupVaultOperationResultsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &BackupVaultOperationResultsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // options - BackupVaultOperationResultsClientGetOptions contains the optional parameters for the BackupVaultOperationResultsClient.Get // method. -func (client *BackupVaultOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BackupVaultOperationResultsClientGetOptions) (BackupVaultOperationResultsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) +func (client *BackupVaultOperationResultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *BackupVaultOperationResultsClientGetOptions) (BackupVaultOperationResultsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) if err != nil { return BackupVaultOperationResultsClientGetResponse{}, err } @@ -72,20 +77,20 @@ func (client *BackupVaultOperationResultsClient) Get(ctx context.Context, vaultN } // getCreateRequest creates the Get request. -func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BackupVaultOperationResultsClientGetOptions) (*policy.Request, error) { +func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *BackupVaultOperationResultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") } @@ -95,7 +100,7 @@ func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -103,7 +108,7 @@ func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Co // getHandleResponse handles the Get response. func (client *BackupVaultOperationResultsClient) getHandleResponse(resp *http.Response) (BackupVaultOperationResultsClientGetResponse, error) { - result := BackupVaultOperationResultsClientGetResponse{RawResponse: resp} + result := BackupVaultOperationResultsClientGetResponse{} if val := resp.Header.Get("Location"); val != "" { result.Location = &val } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaults_client.go index 31f2109dc274..0948a333f2d7 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaults_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type BackupVaultsClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewBackupVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupVaultsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewBackupVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupVaultsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &BackupVaultsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CheckNameAvailability - API to check for resource name availability @@ -91,7 +96,7 @@ func (client *BackupVaultsClient) checkNameAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -99,7 +104,7 @@ func (client *BackupVaultsClient) checkNameAvailabilityCreateRequest(ctx context // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. func (client *BackupVaultsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (BackupVaultsClientCheckNameAvailabilityResponse, error) { - result := BackupVaultsClientCheckNameAvailabilityResponse{RawResponse: resp} + result := BackupVaultsClientCheckNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { return BackupVaultsClientCheckNameAvailabilityResponse{}, err } @@ -108,33 +113,27 @@ func (client *BackupVaultsClient) checkNameAvailabilityHandleResponse(resp *http // BeginCreateOrUpdate - Creates or updates a BackupVault resource belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // parameters - Request body for operation // options - BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate // method. -func (client *BackupVaultsClient) BeginCreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (BackupVaultsClientCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return BackupVaultsClientCreateOrUpdatePollerResponse{}, err - } - result := BackupVaultsClientCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("BackupVaultsClient.CreateOrUpdate", "", resp, client.pl) - if err != nil { - return BackupVaultsClientCreateOrUpdatePollerResponse{}, err - } - result.Poller = &BackupVaultsClientCreateOrUpdatePoller{ - pt: pt, +func (client *BackupVaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[BackupVaultsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vaultName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupVaultsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupVaultsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // CreateOrUpdate - Creates or updates a BackupVault resource belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupVaultsClient) createOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) +func (client *BackupVaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } @@ -149,26 +148,26 @@ func (client *BackupVaultsClient) createOrUpdate(ctx context.Context, vaultName } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,11 +175,11 @@ func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Contex // Delete - Deletes a BackupVault resource from the resource group. // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // options - BackupVaultsClientDeleteOptions contains the optional parameters for the BackupVaultsClient.Delete method. -func (client *BackupVaultsClient) Delete(ctx context.Context, vaultName string, resourceGroupName string, options *BackupVaultsClientDeleteOptions) (BackupVaultsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, options) +func (client *BackupVaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientDeleteOptions) (BackupVaultsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return BackupVaultsClientDeleteResponse{}, err } @@ -191,30 +190,30 @@ func (client *BackupVaultsClient) Delete(ctx context.Context, vaultName string, if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return BackupVaultsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return BackupVaultsClientDeleteResponse{RawResponse: resp}, nil + return BackupVaultsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. -func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupVaultsClientDeleteOptions) (*policy.Request, error) { +func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -222,11 +221,11 @@ func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, vault // Get - Returns a resource belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // options - BackupVaultsClientGetOptions contains the optional parameters for the BackupVaultsClient.Get method. -func (client *BackupVaultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, options *BackupVaultsClientGetOptions) (BackupVaultsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, options) +func (client *BackupVaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientGetOptions) (BackupVaultsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return BackupVaultsClientGetResponse{}, err } @@ -241,26 +240,26 @@ func (client *BackupVaultsClient) Get(ctx context.Context, vaultName string, res } // getCreateRequest creates the Get request. -func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupVaultsClientGetOptions) (*policy.Request, error) { +func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -268,7 +267,7 @@ func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, vaultNam // getHandleResponse handles the Get response. func (client *BackupVaultsClient) getHandleResponse(resp *http.Response) (BackupVaultsClientGetResponse, error) { - result := BackupVaultsClientGetResponse{RawResponse: resp} + result := BackupVaultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupVaultResource); err != nil { return BackupVaultsClientGetResponse{}, err } @@ -280,16 +279,32 @@ func (client *BackupVaultsClient) getHandleResponse(resp *http.Response) (Backup // resourceGroupName - The name of the resource group where the backup vault is present. // options - BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.GetInResourceGroup // method. -func (client *BackupVaultsClient) GetInResourceGroup(resourceGroupName string, options *BackupVaultsClientGetInResourceGroupOptions) *BackupVaultsClientGetInResourceGroupPager { - return &BackupVaultsClientGetInResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getInResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *BackupVaultsClient) GetInResourceGroup(resourceGroupName string, options *BackupVaultsClientGetInResourceGroupOptions) *runtime.Pager[BackupVaultsClientGetInResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[BackupVaultsClientGetInResourceGroupResponse]{ + More: func(page BackupVaultsClientGetInResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp BackupVaultsClientGetInResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.BackupVaultResourceList.NextLink) + Fetcher: func(ctx context.Context, page *BackupVaultsClientGetInResourceGroupResponse) (BackupVaultsClientGetInResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getInResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupVaultsClientGetInResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupVaultsClientGetInResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupVaultsClientGetInResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.getInResourceGroupHandleResponse(resp) }, - } + }) } // getInResourceGroupCreateRequest creates the GetInResourceGroup request. @@ -308,7 +323,7 @@ func (client *BackupVaultsClient) getInResourceGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -316,7 +331,7 @@ func (client *BackupVaultsClient) getInResourceGroupCreateRequest(ctx context.Co // getInResourceGroupHandleResponse handles the GetInResourceGroup response. func (client *BackupVaultsClient) getInResourceGroupHandleResponse(resp *http.Response) (BackupVaultsClientGetInResourceGroupResponse, error) { - result := BackupVaultsClientGetInResourceGroupResponse{RawResponse: resp} + result := BackupVaultsClientGetInResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupVaultResourceList); err != nil { return BackupVaultsClientGetInResourceGroupResponse{}, err } @@ -327,16 +342,32 @@ func (client *BackupVaultsClient) getInResourceGroupHandleResponse(resp *http.Re // If the operation fails it returns an *azcore.ResponseError type. // options - BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.GetInSubscription // method. -func (client *BackupVaultsClient) GetInSubscription(options *BackupVaultsClientGetInSubscriptionOptions) *BackupVaultsClientGetInSubscriptionPager { - return &BackupVaultsClientGetInSubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getInSubscriptionCreateRequest(ctx, options) +func (client *BackupVaultsClient) GetInSubscription(options *BackupVaultsClientGetInSubscriptionOptions) *runtime.Pager[BackupVaultsClientGetInSubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[BackupVaultsClientGetInSubscriptionResponse]{ + More: func(page BackupVaultsClientGetInSubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp BackupVaultsClientGetInSubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.BackupVaultResourceList.NextLink) + Fetcher: func(ctx context.Context, page *BackupVaultsClientGetInSubscriptionResponse) (BackupVaultsClientGetInSubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getInSubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupVaultsClientGetInSubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupVaultsClientGetInSubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupVaultsClientGetInSubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.getInSubscriptionHandleResponse(resp) }, - } + }) } // getInSubscriptionCreateRequest creates the GetInSubscription request. @@ -351,7 +382,7 @@ func (client *BackupVaultsClient) getInSubscriptionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -359,7 +390,7 @@ func (client *BackupVaultsClient) getInSubscriptionCreateRequest(ctx context.Con // getInSubscriptionHandleResponse handles the GetInSubscription response. func (client *BackupVaultsClient) getInSubscriptionHandleResponse(resp *http.Response) (BackupVaultsClientGetInSubscriptionResponse, error) { - result := BackupVaultsClientGetInSubscriptionResponse{RawResponse: resp} + result := BackupVaultsClientGetInSubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupVaultResourceList); err != nil { return BackupVaultsClientGetInSubscriptionResponse{}, err } @@ -368,33 +399,27 @@ func (client *BackupVaultsClient) getInSubscriptionHandleResponse(resp *http.Res // BeginUpdate - Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // parameters - Request body for operation // options - BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate // method. -func (client *BackupVaultsClient) BeginUpdate(ctx context.Context, vaultName string, resourceGroupName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (BackupVaultsClientUpdatePollerResponse, error) { - resp, err := client.update(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return BackupVaultsClientUpdatePollerResponse{}, err - } - result := BackupVaultsClientUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("BackupVaultsClient.Update", "", resp, client.pl) - if err != nil { - return BackupVaultsClientUpdatePollerResponse{}, err - } - result.Poller = &BackupVaultsClientUpdatePoller{ - pt: pt, +func (client *BackupVaultsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*armruntime.Poller[BackupVaultsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vaultName, parameters, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[BackupVaultsClientUpdateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[BackupVaultsClientUpdateResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Update - Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. // If the operation fails it returns an *azcore.ResponseError type. -func (client *BackupVaultsClient) update(ctx context.Context, vaultName string, resourceGroupName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) +func (client *BackupVaultsClient) update(ctx context.Context, resourceGroupName string, vaultName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } @@ -409,26 +434,26 @@ func (client *BackupVaultsClient) update(ctx context.Context, vaultName string, } // updateCreateRequest creates the Update request. -func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_client.go index 93f58d8f0bb9..0b29d073b2a6 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type Client struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *Client { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &Client{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CheckFeatureSupport - Validates if a feature is supported @@ -84,7 +89,7 @@ func (client *Client) checkFeatureSupportCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -92,7 +97,7 @@ func (client *Client) checkFeatureSupportCreateRequest(ctx context.Context, loca // checkFeatureSupportHandleResponse handles the CheckFeatureSupport response. func (client *Client) checkFeatureSupportHandleResponse(resp *http.Response) (ClientCheckFeatureSupportResponse, error) { - result := ClientCheckFeatureSupportResponse{RawResponse: resp} + result := ClientCheckFeatureSupportResponse{} if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { return ClientCheckFeatureSupportResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_constants.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_constants.go index eebd93fefdee..49e94ba6a894 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_constants.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,7 +10,7 @@ package armdataprotection const ( moduleName = "armdataprotection" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) type AbsoluteMarker string @@ -34,9 +34,34 @@ func PossibleAbsoluteMarkerValues() []AbsoluteMarker { } } -// ToPtr returns a *AbsoluteMarker pointing to the current value. -func (c AbsoluteMarker) ToPtr() *AbsoluteMarker { - return &c +type AlertsState string + +const ( + AlertsStateDisabled AlertsState = "Disabled" + AlertsStateEnabled AlertsState = "Enabled" +) + +// PossibleAlertsStateValues returns the possible values for the AlertsState const type. +func PossibleAlertsStateValues() []AlertsState { + return []AlertsState{ + AlertsStateDisabled, + AlertsStateEnabled, + } +} + +type AutoHealStatus string + +const ( + AutoHealStatusOff AutoHealStatus = "Off" + AutoHealStatusOn AutoHealStatus = "On" +) + +// PossibleAutoHealStatusValues returns the possible values for the AutoHealStatus const type. +func PossibleAutoHealStatusValues() []AutoHealStatus { + return []AutoHealStatus{ + AutoHealStatusOff, + AutoHealStatusOn, + } } // CreatedByType - The type of identity that created the resource. @@ -59,11 +84,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // CurrentProtectionState - Specifies the current protection state of the resource type CurrentProtectionState string @@ -100,11 +120,6 @@ func PossibleCurrentProtectionStateValues() []CurrentProtectionState { } } -// ToPtr returns a *CurrentProtectionState pointing to the current value. -func (c CurrentProtectionState) ToPtr() *CurrentProtectionState { - return &c -} - // DataStoreTypes - type of datastore; Operational/Vault/Archive type DataStoreTypes string @@ -123,11 +138,6 @@ func PossibleDataStoreTypesValues() []DataStoreTypes { } } -// ToPtr returns a *DataStoreTypes pointing to the current value. -func (c DataStoreTypes) ToPtr() *DataStoreTypes { - return &c -} - type DayOfWeek string const ( @@ -153,11 +163,6 @@ func PossibleDayOfWeekValues() []DayOfWeek { } } -// ToPtr returns a *DayOfWeek pointing to the current value. -func (c DayOfWeek) ToPtr() *DayOfWeek { - return &c -} - // FeatureSupportStatus - feature support status type FeatureSupportStatus string @@ -182,11 +187,6 @@ func PossibleFeatureSupportStatusValues() []FeatureSupportStatus { } } -// ToPtr returns a *FeatureSupportStatus pointing to the current value. -func (c FeatureSupportStatus) ToPtr() *FeatureSupportStatus { - return &c -} - // FeatureType - backup support feature type. type FeatureType string @@ -203,11 +203,6 @@ func PossibleFeatureTypeValues() []FeatureType { } } -// ToPtr returns a *FeatureType pointing to the current value. -func (c FeatureType) ToPtr() *FeatureType { - return &c -} - type Month string const ( @@ -243,11 +238,6 @@ func PossibleMonthValues() []Month { } } -// ToPtr returns a *Month pointing to the current value. -func (c Month) ToPtr() *Month { - return &c -} - // ProvisioningState - Provisioning state of the BackupVault resource type ProvisioningState string @@ -270,11 +260,6 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ToPtr returns a *ProvisioningState pointing to the current value. -func (c ProvisioningState) ToPtr() *ProvisioningState { - return &c -} - // RecoveryOption - Recovery Option type RecoveryOption string @@ -289,11 +274,6 @@ func PossibleRecoveryOptionValues() []RecoveryOption { } } -// ToPtr returns a *RecoveryOption pointing to the current value. -func (c RecoveryOption) ToPtr() *RecoveryOption { - return &c -} - // RehydrationPriority - Priority to be used for rehydration. Values High or Standard type RehydrationPriority string @@ -312,11 +292,6 @@ func PossibleRehydrationPriorityValues() []RehydrationPriority { } } -// ToPtr returns a *RehydrationPriority pointing to the current value. -func (c RehydrationPriority) ToPtr() *RehydrationPriority { - return &c -} - type RehydrationStatus string const ( @@ -338,11 +313,6 @@ func PossibleRehydrationStatusValues() []RehydrationStatus { } } -// ToPtr returns a *RehydrationStatus pointing to the current value. -func (c RehydrationStatus) ToPtr() *RehydrationStatus { - return &c -} - // ResourceMoveState - Resource move state for backup vault type ResourceMoveState string @@ -375,11 +345,6 @@ func PossibleResourceMoveStateValues() []ResourceMoveState { } } -// ToPtr returns a *ResourceMoveState pointing to the current value. -func (c ResourceMoveState) ToPtr() *ResourceMoveState { - return &c -} - // RestoreSourceDataStoreType - Gets or sets the type of the source data store. type RestoreSourceDataStoreType string @@ -398,11 +363,6 @@ func PossibleRestoreSourceDataStoreTypeValues() []RestoreSourceDataStoreType { } } -// ToPtr returns a *RestoreSourceDataStoreType pointing to the current value. -func (c RestoreSourceDataStoreType) ToPtr() *RestoreSourceDataStoreType { - return &c -} - // RestoreTargetLocationType - Denotes the target location where the data will be restored, string value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType} type RestoreTargetLocationType string @@ -421,11 +381,6 @@ func PossibleRestoreTargetLocationTypeValues() []RestoreTargetLocationType { } } -// ToPtr returns a *RestoreTargetLocationType pointing to the current value. -func (c RestoreTargetLocationType) ToPtr() *RestoreTargetLocationType { - return &c -} - // SecretStoreType - Gets or sets the type of secret store type SecretStoreType string @@ -442,11 +397,6 @@ func PossibleSecretStoreTypeValues() []SecretStoreType { } } -// ToPtr returns a *SecretStoreType pointing to the current value. -func (c SecretStoreType) ToPtr() *SecretStoreType { - return &c -} - // SourceDataStoreType - Gets or sets the type of the source data store. type SourceDataStoreType string @@ -465,11 +415,6 @@ func PossibleSourceDataStoreTypeValues() []SourceDataStoreType { } } -// ToPtr returns a *SourceDataStoreType pointing to the current value. -func (c SourceDataStoreType) ToPtr() *SourceDataStoreType { - return &c -} - // Status - Specifies the protection status of the resource type Status string @@ -494,11 +439,6 @@ func PossibleStatusValues() []Status { } } -// ToPtr returns a *Status pointing to the current value. -func (c Status) ToPtr() *Status { - return &c -} - // StorageSettingStoreTypes - Gets or sets the type of the datastore. type StorageSettingStoreTypes string @@ -517,11 +457,6 @@ func PossibleStorageSettingStoreTypesValues() []StorageSettingStoreTypes { } } -// ToPtr returns a *StorageSettingStoreTypes pointing to the current value. -func (c StorageSettingStoreTypes) ToPtr() *StorageSettingStoreTypes { - return &c -} - // StorageSettingTypes - Gets or sets the type. type StorageSettingTypes string @@ -538,9 +473,37 @@ func PossibleStorageSettingTypesValues() []StorageSettingTypes { } } -// ToPtr returns a *StorageSettingTypes pointing to the current value. -func (c StorageSettingTypes) ToPtr() *StorageSettingTypes { - return &c +// SyncType - Field indicating sync type e.g. to sync only in case of failure or in all cases +type SyncType string + +const ( + SyncTypeDefault SyncType = "Default" + SyncTypeForceResync SyncType = "ForceResync" +) + +// PossibleSyncTypeValues returns the possible values for the SyncType const type. +func PossibleSyncTypeValues() []SyncType { + return []SyncType{ + SyncTypeDefault, + SyncTypeForceResync, + } +} + +// ValidationType - Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API +// will run again. +type ValidationType string + +const ( + ValidationTypeDeepValidation ValidationType = "DeepValidation" + ValidationTypeShallowValidation ValidationType = "ShallowValidation" +) + +// PossibleValidationTypeValues returns the possible values for the ValidationType const type. +func PossibleValidationTypeValues() []ValidationType { + return []ValidationType{ + ValidationTypeDeepValidation, + ValidationTypeShallowValidation, + } } type WeekNumber string @@ -563,8 +526,3 @@ func PossibleWeekNumberValues() []WeekNumber { WeekNumberThird, } } - -// ToPtr returns a *WeekNumber pointing to the current value. -func (c WeekNumber) ToPtr() *WeekNumber { - return &c -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobs_client.go index 2defd82495b9..d48aec139b5a 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobs_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ExportJobsClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewExportJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExportJobsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewExportJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportJobsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ExportJobsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // BeginTrigger - Triggers export of jobs and returns an OperationID to track. @@ -54,22 +59,18 @@ func NewExportJobsClient(subscriptionID string, credential azcore.TokenCredentia // resourceGroupName - The name of the resource group where the backup vault is present. // vaultName - The name of the backup vault. // options - ExportJobsClientBeginTriggerOptions contains the optional parameters for the ExportJobsClient.BeginTrigger method. -func (client *ExportJobsClient) BeginTrigger(ctx context.Context, resourceGroupName string, vaultName string, options *ExportJobsClientBeginTriggerOptions) (ExportJobsClientTriggerPollerResponse, error) { - resp, err := client.trigger(ctx, resourceGroupName, vaultName, options) - if err != nil { - return ExportJobsClientTriggerPollerResponse{}, err - } - result := ExportJobsClientTriggerPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("ExportJobsClient.Trigger", "location", resp, client.pl) - if err != nil { - return ExportJobsClientTriggerPollerResponse{}, err - } - result.Poller = &ExportJobsClientTriggerPoller{ - pt: pt, +func (client *ExportJobsClient) BeginTrigger(ctx context.Context, resourceGroupName string, vaultName string, options *ExportJobsClientBeginTriggerOptions) (*armruntime.Poller[ExportJobsClientTriggerResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.trigger(ctx, resourceGroupName, vaultName, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[ExportJobsClientTriggerResponse]{ + FinalStateVia: armruntime.FinalStateViaLocation, + }) + } else { + return armruntime.NewPollerFromResumeToken[ExportJobsClientTriggerResponse](options.ResumeToken, client.pl, nil) } - return result, nil } // Trigger - Triggers export of jobs and returns an OperationID to track. @@ -109,7 +110,7 @@ func (client *ExportJobsClient) triggerCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobsoperationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobsoperationresult_client.go index 3b2c9b67f215..0e27fe1e4bac 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobsoperationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobsoperationresult_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ExportJobsOperationResultClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewExportJobsOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExportJobsOperationResultClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewExportJobsOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportJobsOperationResultClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ExportJobsOperationResultClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also @@ -97,7 +102,7 @@ func (client *ExportJobsOperationResultClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -105,7 +110,7 @@ func (client *ExportJobsOperationResultClient) getCreateRequest(ctx context.Cont // getHandleResponse handles the Get response. func (client *ExportJobsOperationResultClient) getHandleResponse(resp *http.Response) (ExportJobsOperationResultClientGetResponse, error) { - result := ExportJobsOperationResultClientGetResponse{RawResponse: resp} + result := ExportJobsOperationResultClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ExportJobsResult); err != nil { return ExportJobsOperationResultClientGetResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_jobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_jobs_client.go index b29abea8f845..87e3ed2793d2 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_jobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_jobs_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type JobsClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &JobsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets a job with id in a backup vault @@ -94,7 +99,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -102,7 +107,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam // getHandleResponse handles the Get response. func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetResponse, error) { - result := JobsClientGetResponse{RawResponse: resp} + result := JobsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupJobResource); err != nil { return JobsClientGetResponse{}, err } @@ -114,16 +119,32 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR // resourceGroupName - The name of the resource group where the backup vault is present. // vaultName - The name of the backup vault. // options - JobsClientListOptions contains the optional parameters for the JobsClient.List method. -func (client *JobsClient) List(resourceGroupName string, vaultName string, options *JobsClientListOptions) *JobsClientListPager { - return &JobsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) +func (client *JobsClient) List(resourceGroupName string, vaultName string, options *JobsClientListOptions) *runtime.Pager[JobsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[JobsClientListResponse]{ + More: func(page JobsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp JobsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AzureBackupJobResourceList.NextLink) + Fetcher: func(ctx context.Context, page *JobsClientListResponse) (JobsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return JobsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -146,7 +167,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -154,7 +175,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa // listHandleResponse handles the List response. func (client *JobsClient) listHandleResponse(resp *http.Response) (JobsClientListResponse, error) { - result := JobsClientListResponse{RawResponse: resp} + result := JobsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupJobResourceList); err != nil { return JobsClientListResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models.go index 1f0be107f77f..a07774384b5c 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,7 @@ package armdataprotection -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AbsoluteDeleteOption - Delete option with duration type AbsoluteDeleteOption struct { @@ -24,45 +19,6 @@ type AbsoluteDeleteOption struct { ObjectType *string `json:"objectType,omitempty"` } -// GetDeleteOption implements the DeleteOptionClassification interface for type AbsoluteDeleteOption. -func (a *AbsoluteDeleteOption) GetDeleteOption() *DeleteOption { - return &DeleteOption{ - Duration: a.Duration, - ObjectType: a.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AbsoluteDeleteOption. -func (a AbsoluteDeleteOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "duration", a.Duration) - objectMap["objectType"] = "AbsoluteDeleteOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteDeleteOption. -func (a *AbsoluteDeleteOption) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, &a.Duration) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AdHocBackupRuleOptions - Adhoc backup rules type AdHocBackupRuleOptions struct { // REQUIRED @@ -92,44 +48,6 @@ type AdhocBasedTriggerContext struct { TaggingCriteria *AdhocBasedTaggingCriteria `json:"taggingCriteria,omitempty"` } -// GetTriggerContext implements the TriggerContextClassification interface for type AdhocBasedTriggerContext. -func (a *AdhocBasedTriggerContext) GetTriggerContext() *TriggerContext { - return &TriggerContext{ - ObjectType: a.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AdhocBasedTriggerContext. -func (a AdhocBasedTriggerContext) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AdhocBasedTriggerContext" - populate(objectMap, "taggingCriteria", a.TaggingCriteria) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdhocBasedTriggerContext. -func (a *AdhocBasedTriggerContext) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "taggingCriteria": - err = unpopulate(val, &a.TaggingCriteria) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AuthCredentialsClassification provides polymorphic access to related types. // Call the interface's GetAuthCredentials() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -145,8 +63,9 @@ type AuthCredentials struct { ObjectType *string `json:"objectType,omitempty"` } -// GetAuthCredentials implements the AuthCredentialsClassification interface for type AuthCredentials. -func (a *AuthCredentials) GetAuthCredentials() *AuthCredentials { return a } +type AutoHealSettings struct { + AutoHealStatus *AutoHealStatus `json:"autoHealStatus,omitempty"` +} // AzureBackupDiscreteRecoveryPoint - Azure backup discrete RecoveryPoint type AzureBackupDiscreteRecoveryPoint struct { @@ -165,76 +84,6 @@ type AzureBackupDiscreteRecoveryPoint struct { RetentionTagVersion *string `json:"retentionTagVersion,omitempty"` } -// GetAzureBackupRecoveryPoint implements the AzureBackupRecoveryPointClassification interface for type AzureBackupDiscreteRecoveryPoint. -func (a *AzureBackupDiscreteRecoveryPoint) GetAzureBackupRecoveryPoint() *AzureBackupRecoveryPoint { - return &AzureBackupRecoveryPoint{ - ObjectType: a.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupDiscreteRecoveryPoint. -func (a AzureBackupDiscreteRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "friendlyName", a.FriendlyName) - objectMap["objectType"] = "AzureBackupDiscreteRecoveryPoint" - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "policyVersion", a.PolicyVersion) - populate(objectMap, "recoveryPointDataStoresDetails", a.RecoveryPointDataStoresDetails) - populate(objectMap, "recoveryPointId", a.RecoveryPointID) - populateTimeRFC3339(objectMap, "recoveryPointTime", a.RecoveryPointTime) - populate(objectMap, "recoveryPointType", a.RecoveryPointType) - populate(objectMap, "retentionTagName", a.RetentionTagName) - populate(objectMap, "retentionTagVersion", a.RetentionTagVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupDiscreteRecoveryPoint. -func (a *AzureBackupDiscreteRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "friendlyName": - err = unpopulate(val, &a.FriendlyName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, &a.PolicyName) - delete(rawMsg, key) - case "policyVersion": - err = unpopulate(val, &a.PolicyVersion) - delete(rawMsg, key) - case "recoveryPointDataStoresDetails": - err = unpopulate(val, &a.RecoveryPointDataStoresDetails) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, &a.RecoveryPointID) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulateTimeRFC3339(val, &a.RecoveryPointTime) - delete(rawMsg, key) - case "recoveryPointType": - err = unpopulate(val, &a.RecoveryPointType) - delete(rawMsg, key) - case "retentionTagName": - err = unpopulate(val, &a.RetentionTagName) - delete(rawMsg, key) - case "retentionTagVersion": - err = unpopulate(val, &a.RetentionTagVersion) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AzureBackupFindRestorableTimeRangesRequest - List Restore Ranges Request type AzureBackupFindRestorableTimeRangesRequest struct { // REQUIRED; Gets or sets the type of the source data store. @@ -264,20 +113,6 @@ type AzureBackupFindRestorableTimeRangesRequestResource struct { URI *string `json:"uri,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesRequestResource. -func (a AzureBackupFindRestorableTimeRangesRequestResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "content", a.Content) - populate(objectMap, "cultureInfo", a.CultureInfo) - populate(objectMap, "httpMethod", a.HTTPMethod) - populate(objectMap, "headers", a.Headers) - populate(objectMap, "parameters", a.Parameters) - populate(objectMap, "subscriptionId", a.SubscriptionID) - populate(objectMap, "supportedGroupVersions", a.SupportedGroupVersions) - populate(objectMap, "uri", a.URI) - return json.Marshal(objectMap) -} - // AzureBackupFindRestorableTimeRangesResponse - List Restore Ranges Response type AzureBackupFindRestorableTimeRangesResponse struct { ObjectType *string `json:"objectType,omitempty"` @@ -286,14 +121,6 @@ type AzureBackupFindRestorableTimeRangesResponse struct { RestorableTimeRanges []*RestorableTimeRange `json:"restorableTimeRanges,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesResponse. -func (a AzureBackupFindRestorableTimeRangesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "objectType", a.ObjectType) - populate(objectMap, "restorableTimeRanges", a.RestorableTimeRanges) - return json.Marshal(objectMap) -} - // AzureBackupFindRestorableTimeRangesResponseResource - List Restore Ranges Response type AzureBackupFindRestorableTimeRangesResponseResource struct { // AzureBackupFindRestorableTimeRangesResponseResource properties @@ -399,149 +226,6 @@ type AzureBackupJob struct { RestoreType *string `json:"restoreType,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AzureBackupJob. -func (a AzureBackupJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "activityID", a.ActivityID) - populate(objectMap, "backupInstanceFriendlyName", a.BackupInstanceFriendlyName) - populate(objectMap, "backupInstanceId", a.BackupInstanceID) - populate(objectMap, "dataSourceId", a.DataSourceID) - populate(objectMap, "dataSourceLocation", a.DataSourceLocation) - populate(objectMap, "dataSourceName", a.DataSourceName) - populate(objectMap, "dataSourceSetName", a.DataSourceSetName) - populate(objectMap, "dataSourceType", a.DataSourceType) - populate(objectMap, "destinationDataStoreName", a.DestinationDataStoreName) - populate(objectMap, "duration", a.Duration) - populateTimeRFC3339(objectMap, "endTime", a.EndTime) - populate(objectMap, "errorDetails", a.ErrorDetails) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "isUserTriggered", a.IsUserTriggered) - populate(objectMap, "operation", a.Operation) - populate(objectMap, "operationCategory", a.OperationCategory) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "progressEnabled", a.ProgressEnabled) - populate(objectMap, "progressUrl", a.ProgressURL) - populate(objectMap, "restoreType", a.RestoreType) - populate(objectMap, "sourceDataStoreName", a.SourceDataStoreName) - populate(objectMap, "sourceResourceGroup", a.SourceResourceGroup) - populate(objectMap, "sourceSubscriptionID", a.SourceSubscriptionID) - populateTimeRFC3339(objectMap, "startTime", a.StartTime) - populate(objectMap, "status", a.Status) - populate(objectMap, "subscriptionId", a.SubscriptionID) - populate(objectMap, "supportedActions", a.SupportedActions) - populate(objectMap, "vaultName", a.VaultName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupJob. -func (a *AzureBackupJob) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "activityID": - err = unpopulate(val, &a.ActivityID) - delete(rawMsg, key) - case "backupInstanceFriendlyName": - err = unpopulate(val, &a.BackupInstanceFriendlyName) - delete(rawMsg, key) - case "backupInstanceId": - err = unpopulate(val, &a.BackupInstanceID) - delete(rawMsg, key) - case "dataSourceId": - err = unpopulate(val, &a.DataSourceID) - delete(rawMsg, key) - case "dataSourceLocation": - err = unpopulate(val, &a.DataSourceLocation) - delete(rawMsg, key) - case "dataSourceName": - err = unpopulate(val, &a.DataSourceName) - delete(rawMsg, key) - case "dataSourceSetName": - err = unpopulate(val, &a.DataSourceSetName) - delete(rawMsg, key) - case "dataSourceType": - err = unpopulate(val, &a.DataSourceType) - delete(rawMsg, key) - case "destinationDataStoreName": - err = unpopulate(val, &a.DestinationDataStoreName) - delete(rawMsg, key) - case "duration": - err = unpopulate(val, &a.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &a.EndTime) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, &a.ErrorDetails) - delete(rawMsg, key) - case "etag": - err = unpopulate(val, &a.Etag) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, &a.ExtendedInfo) - delete(rawMsg, key) - case "isUserTriggered": - err = unpopulate(val, &a.IsUserTriggered) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, &a.Operation) - delete(rawMsg, key) - case "operationCategory": - err = unpopulate(val, &a.OperationCategory) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, &a.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, &a.PolicyName) - delete(rawMsg, key) - case "progressEnabled": - err = unpopulate(val, &a.ProgressEnabled) - delete(rawMsg, key) - case "progressUrl": - err = unpopulate(val, &a.ProgressURL) - delete(rawMsg, key) - case "restoreType": - err = unpopulate(val, &a.RestoreType) - delete(rawMsg, key) - case "sourceDataStoreName": - err = unpopulate(val, &a.SourceDataStoreName) - delete(rawMsg, key) - case "sourceResourceGroup": - err = unpopulate(val, &a.SourceResourceGroup) - delete(rawMsg, key) - case "sourceSubscriptionID": - err = unpopulate(val, &a.SourceSubscriptionID) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &a.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &a.Status) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, &a.SubscriptionID) - delete(rawMsg, key) - case "supportedActions": - err = unpopulate(val, &a.SupportedActions) - delete(rawMsg, key) - case "vaultName": - err = unpopulate(val, &a.VaultName) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AzureBackupJobResource - AzureBackup Job Resource Class type AzureBackupJobResource struct { // AzureBackupJobResource properties @@ -569,14 +253,6 @@ type AzureBackupJobResourceList struct { Value []*AzureBackupJobResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AzureBackupJobResourceList. -func (a AzureBackupJobResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AzureBackupParams - Azure backup parameters type AzureBackupParams struct { // REQUIRED; BackupType ; Full/Incremental etc @@ -586,44 +262,6 @@ type AzureBackupParams struct { ObjectType *string `json:"objectType,omitempty"` } -// GetBackupParameters implements the BackupParametersClassification interface for type AzureBackupParams. -func (a *AzureBackupParams) GetBackupParameters() *BackupParameters { - return &BackupParameters{ - ObjectType: a.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupParams. -func (a AzureBackupParams) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backupType", a.BackupType) - objectMap["objectType"] = "AzureBackupParams" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupParams. -func (a *AzureBackupParams) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "backupType": - err = unpopulate(val, &a.BackupType) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AzureBackupRecoveryPointClassification provides polymorphic access to related types. // Call the interface's GetAzureBackupRecoveryPoint() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -639,9 +277,6 @@ type AzureBackupRecoveryPoint struct { ObjectType *string `json:"objectType,omitempty"` } -// GetAzureBackupRecoveryPoint implements the AzureBackupRecoveryPointClassification interface for type AzureBackupRecoveryPoint. -func (a *AzureBackupRecoveryPoint) GetAzureBackupRecoveryPoint() *AzureBackupRecoveryPoint { return a } - // AzureBackupRecoveryPointBasedRestoreRequestClassification provides polymorphic access to related types. // Call the interface's GetAzureBackupRecoveryPointBasedRestoreRequest() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -665,60 +300,9 @@ type AzureBackupRecoveryPointBasedRestoreRequest struct { // REQUIRED; Gets or sets the type of the source data store. SourceDataStoreType *SourceDataStoreType `json:"sourceDataStoreType,omitempty"` -} -// GetAzureBackupRecoveryPointBasedRestoreRequest implements the AzureBackupRecoveryPointBasedRestoreRequestClassification -// interface for type AzureBackupRecoveryPointBasedRestoreRequest. -func (a *AzureBackupRecoveryPointBasedRestoreRequest) GetAzureBackupRecoveryPointBasedRestoreRequest() *AzureBackupRecoveryPointBasedRestoreRequest { - return a -} - -// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRecoveryPointBasedRestoreRequest. -func (a *AzureBackupRecoveryPointBasedRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { - return &AzureBackupRestoreRequest{ - ObjectType: a.ObjectType, - RestoreTargetInfo: a.RestoreTargetInfo, - SourceDataStoreType: a.SourceDataStoreType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. -func (a AzureBackupRecoveryPointBasedRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AzureBackupRecoveryPointBasedRestoreRequest" - populate(objectMap, "recoveryPointId", a.RecoveryPointID) - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. -func (a *AzureBackupRecoveryPointBasedRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, &a.RecoveryPointID) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, &a.SourceDataStoreType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil + // Fully qualified Azure Resource Manager ID of the datasource which is being recovered. + SourceResourceID *string `json:"sourceResourceId,omitempty"` } // AzureBackupRecoveryPointResource - Azure backup recoveryPoint resource @@ -739,49 +323,6 @@ type AzureBackupRecoveryPointResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResource. -func (a AzureBackupRecoveryPointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointResource. -func (a *AzureBackupRecoveryPointResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "properties": - a.Properties, err = unmarshalAzureBackupRecoveryPointClassification(val) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &a.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AzureBackupRecoveryPointResourceList - Azure backup recoveryPoint resource list type AzureBackupRecoveryPointResourceList struct { // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. @@ -791,14 +332,6 @@ type AzureBackupRecoveryPointResourceList struct { Value []*AzureBackupRecoveryPointResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResourceList. -func (a AzureBackupRecoveryPointResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - // AzureBackupRecoveryTimeBasedRestoreRequest - AzureBackup RecoveryPointTime Based Restore Request type AzureBackupRecoveryTimeBasedRestoreRequest struct { // REQUIRED @@ -812,54 +345,9 @@ type AzureBackupRecoveryTimeBasedRestoreRequest struct { // REQUIRED; Gets or sets the type of the source data store. SourceDataStoreType *SourceDataStoreType `json:"sourceDataStoreType,omitempty"` -} -// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRecoveryTimeBasedRestoreRequest. -func (a *AzureBackupRecoveryTimeBasedRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { - return &AzureBackupRestoreRequest{ - ObjectType: a.ObjectType, - RestoreTargetInfo: a.RestoreTargetInfo, - SourceDataStoreType: a.SourceDataStoreType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. -func (a AzureBackupRecoveryTimeBasedRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AzureBackupRecoveryTimeBasedRestoreRequest" - populate(objectMap, "recoveryPointTime", a.RecoveryPointTime) - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. -func (a *AzureBackupRecoveryTimeBasedRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulate(val, &a.RecoveryPointTime) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, &a.SourceDataStoreType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil + // Fully qualified Azure Resource Manager ID of the datasource which is being recovered. + SourceResourceID *string `json:"sourceResourceId,omitempty"` } // AzureBackupRehydrationRequest - Azure Backup Rehydrate Request @@ -894,46 +382,9 @@ type AzureBackupRestoreRequest struct { // REQUIRED; Gets or sets the type of the source data store. SourceDataStoreType *SourceDataStoreType `json:"sourceDataStoreType,omitempty"` -} -// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRestoreRequest. -func (a *AzureBackupRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { - return a -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreRequest. -func (a AzureBackupRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = a.ObjectType - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreRequest. -func (a *AzureBackupRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, &a.SourceDataStoreType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil + // Fully qualified Azure Resource Manager ID of the datasource which is being recovered. + SourceResourceID *string `json:"sourceResourceId,omitempty"` } // AzureBackupRestoreWithRehydrationRequest - AzureBackup Restore with Rehydration Request @@ -955,73 +406,9 @@ type AzureBackupRestoreWithRehydrationRequest struct { // REQUIRED; Gets or sets the type of the source data store. SourceDataStoreType *SourceDataStoreType `json:"sourceDataStoreType,omitempty"` -} -// GetAzureBackupRecoveryPointBasedRestoreRequest implements the AzureBackupRecoveryPointBasedRestoreRequestClassification -// interface for type AzureBackupRestoreWithRehydrationRequest. -func (a *AzureBackupRestoreWithRehydrationRequest) GetAzureBackupRecoveryPointBasedRestoreRequest() *AzureBackupRecoveryPointBasedRestoreRequest { - return &AzureBackupRecoveryPointBasedRestoreRequest{ - RecoveryPointID: a.RecoveryPointID, - ObjectType: a.ObjectType, - RestoreTargetInfo: a.RestoreTargetInfo, - SourceDataStoreType: a.SourceDataStoreType, - } -} - -// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRestoreWithRehydrationRequest. -func (a *AzureBackupRestoreWithRehydrationRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { - return &AzureBackupRestoreRequest{ - ObjectType: a.ObjectType, - RestoreTargetInfo: a.RestoreTargetInfo, - SourceDataStoreType: a.SourceDataStoreType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreWithRehydrationRequest. -func (a AzureBackupRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AzureBackupRestoreWithRehydrationRequest" - populate(objectMap, "recoveryPointId", a.RecoveryPointID) - populate(objectMap, "rehydrationPriority", a.RehydrationPriority) - populate(objectMap, "rehydrationRetentionDuration", a.RehydrationRetentionDuration) - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreWithRehydrationRequest. -func (a *AzureBackupRestoreWithRehydrationRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, &a.RecoveryPointID) - delete(rawMsg, key) - case "rehydrationPriority": - err = unpopulate(val, &a.RehydrationPriority) - delete(rawMsg, key) - case "rehydrationRetentionDuration": - err = unpopulate(val, &a.RehydrationRetentionDuration) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, &a.SourceDataStoreType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil + // Fully qualified Azure Resource Manager ID of the datasource which is being recovered. + SourceResourceID *string `json:"sourceResourceId,omitempty"` } // AzureBackupRule - Azure backup rule @@ -1042,55 +429,9 @@ type AzureBackupRule struct { BackupParameters BackupParametersClassification `json:"backupParameters,omitempty"` } -// GetBasePolicyRule implements the BasePolicyRuleClassification interface for type AzureBackupRule. -func (a *AzureBackupRule) GetBasePolicyRule() *BasePolicyRule { - return &BasePolicyRule{ - Name: a.Name, - ObjectType: a.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRule. -func (a AzureBackupRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backupParameters", a.BackupParameters) - populate(objectMap, "dataStore", a.DataStore) - populate(objectMap, "name", a.Name) - objectMap["objectType"] = "AzureBackupRule" - populate(objectMap, "trigger", a.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRule. -func (a *AzureBackupRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "backupParameters": - a.BackupParameters, err = unmarshalBackupParametersClassification(val) - delete(rawMsg, key) - case "dataStore": - err = unpopulate(val, &a.DataStore) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "trigger": - a.Trigger, err = unmarshalTriggerContextClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil +// AzureMonitorAlertSettings - Settings for Azure Monitor based alerts +type AzureMonitorAlertSettings struct { + AlertsForAllJobFailures *AlertsState `json:"alertsForAllJobFailures,omitempty"` } // AzureOperationalStoreParameters - Parameters for Operational-Tier DataStore @@ -1105,49 +446,6 @@ type AzureOperationalStoreParameters struct { ResourceGroupID *string `json:"resourceGroupId,omitempty"` } -// GetDataStoreParameters implements the DataStoreParametersClassification interface for type AzureOperationalStoreParameters. -func (a *AzureOperationalStoreParameters) GetDataStoreParameters() *DataStoreParameters { - return &DataStoreParameters{ - ObjectType: a.ObjectType, - DataStoreType: a.DataStoreType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureOperationalStoreParameters. -func (a AzureOperationalStoreParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataStoreType", a.DataStoreType) - objectMap["objectType"] = "AzureOperationalStoreParameters" - populate(objectMap, "resourceGroupId", a.ResourceGroupID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureOperationalStoreParameters. -func (a *AzureOperationalStoreParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "dataStoreType": - err = unpopulate(val, &a.DataStoreType) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - case "resourceGroupId": - err = unpopulate(val, &a.ResourceGroupID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AzureRetentionRule - Azure retention rule type AzureRetentionRule struct { // REQUIRED @@ -1161,53 +459,6 @@ type AzureRetentionRule struct { IsDefault *bool `json:"isDefault,omitempty"` } -// GetBasePolicyRule implements the BasePolicyRuleClassification interface for type AzureRetentionRule. -func (a *AzureRetentionRule) GetBasePolicyRule() *BasePolicyRule { - return &BasePolicyRule{ - Name: a.Name, - ObjectType: a.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureRetentionRule. -func (a AzureRetentionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "isDefault", a.IsDefault) - populate(objectMap, "lifecycles", a.Lifecycles) - populate(objectMap, "name", a.Name) - objectMap["objectType"] = "AzureRetentionRule" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureRetentionRule. -func (a *AzureRetentionRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "isDefault": - err = unpopulate(val, &a.IsDefault) - delete(rawMsg, key) - case "lifecycles": - err = unpopulate(val, &a.Lifecycles) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &a.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // BackupCriteriaClassification provides polymorphic access to related types. // Call the interface's GetBackupCriteria() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1223,9 +474,6 @@ type BackupCriteria struct { ObjectType *string `json:"objectType,omitempty"` } -// GetBackupCriteria implements the BackupCriteriaClassification interface for type BackupCriteria. -func (b *BackupCriteria) GetBackupCriteria() *BackupCriteria { return b } - // BackupInstance - Backup Instance type BackupInstance struct { // REQUIRED; Gets or sets the data source information. @@ -1246,6 +494,9 @@ type BackupInstance struct { // Gets or sets the Backup Instance friendly name. FriendlyName *string `json:"friendlyName,omitempty"` + // Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again. + ValidationType *ValidationType `json:"validationType,omitempty"` + // READ-ONLY; Specifies the current protection state of the resource CurrentProtectionState *CurrentProtectionState `json:"currentProtectionState,omitempty" azure:"ro"` @@ -1259,69 +510,6 @@ type BackupInstance struct { ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type BackupInstance. -func (b BackupInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "currentProtectionState", b.CurrentProtectionState) - populate(objectMap, "dataSourceInfo", b.DataSourceInfo) - populate(objectMap, "dataSourceSetInfo", b.DataSourceSetInfo) - populate(objectMap, "datasourceAuthCredentials", b.DatasourceAuthCredentials) - populate(objectMap, "friendlyName", b.FriendlyName) - populate(objectMap, "objectType", b.ObjectType) - populate(objectMap, "policyInfo", b.PolicyInfo) - populate(objectMap, "protectionErrorDetails", b.ProtectionErrorDetails) - populate(objectMap, "protectionStatus", b.ProtectionStatus) - populate(objectMap, "provisioningState", b.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupInstance. -func (b *BackupInstance) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "currentProtectionState": - err = unpopulate(val, &b.CurrentProtectionState) - delete(rawMsg, key) - case "dataSourceInfo": - err = unpopulate(val, &b.DataSourceInfo) - delete(rawMsg, key) - case "dataSourceSetInfo": - err = unpopulate(val, &b.DataSourceSetInfo) - delete(rawMsg, key) - case "datasourceAuthCredentials": - b.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, &b.FriendlyName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &b.ObjectType) - delete(rawMsg, key) - case "policyInfo": - err = unpopulate(val, &b.PolicyInfo) - delete(rawMsg, key) - case "protectionErrorDetails": - err = unpopulate(val, &b.ProtectionErrorDetails) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, &b.ProtectionStatus) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &b.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // BackupInstanceResource - BackupInstance Resource type BackupInstanceResource struct { // BackupInstanceResource properties @@ -1349,52 +537,92 @@ type BackupInstanceResourceList struct { Value []*BackupInstanceResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BackupInstanceResourceList. -func (b BackupInstanceResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", b.NextLink) - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - // BackupInstancesClientBeginAdhocBackupOptions contains the optional parameters for the BackupInstancesClient.BeginAdhocBackup // method. type BackupInstancesClientBeginAdhocBackupOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // BackupInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupInstancesClient.BeginCreateOrUpdate // method. type BackupInstancesClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // BackupInstancesClientBeginDeleteOptions contains the optional parameters for the BackupInstancesClient.BeginDelete method. type BackupInstancesClientBeginDeleteOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginResumeBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginResumeBackups +// method. +type BackupInstancesClientBeginResumeBackupsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginResumeProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginResumeProtection +// method. +type BackupInstancesClientBeginResumeProtectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginStopProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginStopProtection +// method. +type BackupInstancesClientBeginStopProtectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginSuspendBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginSuspendBackups +// method. +type BackupInstancesClientBeginSuspendBackupsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginSyncBackupInstanceOptions contains the optional parameters for the BackupInstancesClient.BeginSyncBackupInstance +// method. +type BackupInstancesClientBeginSyncBackupInstanceOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } // BackupInstancesClientBeginTriggerRehydrateOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRehydrate // method. type BackupInstancesClientBeginTriggerRehydrateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // BackupInstancesClientBeginTriggerRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRestore // method. type BackupInstancesClientBeginTriggerRestoreOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // BackupInstancesClientBeginValidateForBackupOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForBackup // method. type BackupInstancesClientBeginValidateForBackupOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // BackupInstancesClientBeginValidateForRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForRestore // method. type BackupInstancesClientBeginValidateForRestoreOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientGetBackupInstanceOperationResultOptions contains the optional parameters for the BackupInstancesClient.GetBackupInstanceOperationResult +// method. +type BackupInstancesClientGetBackupInstanceOperationResultOptions struct { // placeholder for future optional parameters } @@ -1408,6 +636,12 @@ type BackupInstancesClientListOptions struct { // placeholder for future optional parameters } +// BackupInstancesExtensionRoutingClientListOptions contains the optional parameters for the BackupInstancesExtensionRoutingClient.List +// method. +type BackupInstancesExtensionRoutingClientListOptions struct { + // placeholder for future optional parameters +} + // BackupParametersClassification provides polymorphic access to related types. // Call the interface's GetBackupParameters() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1423,9 +657,6 @@ type BackupParameters struct { ObjectType *string `json:"objectType,omitempty"` } -// GetBackupParameters implements the BackupParametersClassification interface for type BackupParameters. -func (b *BackupParameters) GetBackupParameters() *BackupParameters { return b } - // BackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BackupPoliciesClient.CreateOrUpdate // method. type BackupPoliciesClientCreateOrUpdateOptions struct { @@ -1459,49 +690,6 @@ type BackupPolicy struct { PolicyRules []BasePolicyRuleClassification `json:"policyRules,omitempty"` } -// GetBaseBackupPolicy implements the BaseBackupPolicyClassification interface for type BackupPolicy. -func (b *BackupPolicy) GetBaseBackupPolicy() *BaseBackupPolicy { - return &BaseBackupPolicy{ - DatasourceTypes: b.DatasourceTypes, - ObjectType: b.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type BackupPolicy. -func (b BackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceTypes", b.DatasourceTypes) - objectMap["objectType"] = "BackupPolicy" - populate(objectMap, "policyRules", b.PolicyRules) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupPolicy. -func (b *BackupPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "datasourceTypes": - err = unpopulate(val, &b.DatasourceTypes) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &b.ObjectType) - delete(rawMsg, key) - case "policyRules": - b.PolicyRules, err = unmarshalBasePolicyRuleClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // BackupSchedule - Schedule for backup type BackupSchedule struct { // REQUIRED; ISO 8601 repeating time interval format @@ -1511,19 +699,14 @@ type BackupSchedule struct { TimeZone *string `json:"timeZone,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BackupSchedule. -func (b BackupSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "repeatingTimeIntervals", b.RepeatingTimeIntervals) - populate(objectMap, "timeZone", b.TimeZone) - return json.Marshal(objectMap) -} - // BackupVault - Backup Vault type BackupVault struct { // REQUIRED; Storage Settings StorageSettings []*StorageSetting `json:"storageSettings,omitempty"` + // Monitoring Settings + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` + // READ-ONLY; Provisioning state of the BackupVault resource ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` @@ -1534,16 +717,6 @@ type BackupVault struct { ResourceMoveState *ResourceMoveState `json:"resourceMoveState,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type BackupVault. -func (b BackupVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "provisioningState", b.ProvisioningState) - populate(objectMap, "resourceMoveDetails", b.ResourceMoveDetails) - populate(objectMap, "resourceMoveState", b.ResourceMoveState) - populate(objectMap, "storageSettings", b.StorageSettings) - return json.Marshal(objectMap) -} - // BackupVaultOperationResultsClientGetOptions contains the optional parameters for the BackupVaultOperationResultsClient.Get // method. type BackupVaultOperationResultsClientGetOptions struct { @@ -1580,21 +753,6 @@ type BackupVaultResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type BackupVaultResource. -func (b BackupVaultResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "identity", b.Identity) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "systemData", b.SystemData) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - // BackupVaultResourceList - List of BackupVault resources type BackupVaultResourceList struct { // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. @@ -1604,23 +762,17 @@ type BackupVaultResourceList struct { Value []*BackupVaultResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BackupVaultResourceList. -func (b BackupVaultResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", b.NextLink) - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - // BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate // method. type BackupVaultsClientBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate method. type BackupVaultsClientBeginUpdateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // BackupVaultsClientCheckNameAvailabilityOptions contains the optional parameters for the BackupVaultsClient.CheckNameAvailability @@ -1669,17 +821,6 @@ type BaseBackupPolicy struct { ObjectType *string `json:"objectType,omitempty"` } -// GetBaseBackupPolicy implements the BaseBackupPolicyClassification interface for type BaseBackupPolicy. -func (b *BaseBackupPolicy) GetBaseBackupPolicy() *BaseBackupPolicy { return b } - -// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicy. -func (b BaseBackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceTypes", b.DatasourceTypes) - objectMap["objectType"] = b.ObjectType - return json.Marshal(objectMap) -} - // BaseBackupPolicyResource - BaseBackupPolicy resource type BaseBackupPolicyResource struct { // BaseBackupPolicyResource properties @@ -1698,49 +839,6 @@ type BaseBackupPolicyResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResource. -func (b BaseBackupPolicyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", b.ID) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "systemData", b.SystemData) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BaseBackupPolicyResource. -func (b *BaseBackupPolicyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, &b.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &b.Name) - delete(rawMsg, key) - case "properties": - b.Properties, err = unmarshalBaseBackupPolicyClassification(val) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, &b.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &b.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // BaseBackupPolicyResourceList - List of BaseBackupPolicy resources type BaseBackupPolicyResourceList struct { // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. @@ -1750,14 +848,6 @@ type BaseBackupPolicyResourceList struct { Value []*BaseBackupPolicyResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResourceList. -func (b BaseBackupPolicyResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", b.NextLink) - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - // BasePolicyRuleClassification provides polymorphic access to related types. // Call the interface's GetBasePolicyRule() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1776,9 +866,6 @@ type BasePolicyRule struct { ObjectType *string `json:"objectType,omitempty"` } -// GetBasePolicyRule implements the BasePolicyRuleClassification interface for type BasePolicyRule. -func (b *BasePolicyRule) GetBasePolicyRule() *BasePolicyRule { return b } - // CheckNameAvailabilityRequest - CheckNameAvailability Request type CheckNameAvailabilityRequest struct { // Resource name for which availability needs to be checked @@ -1844,13 +931,6 @@ type ClientDiscoveryForServiceSpecification struct { LogSpecifications []*ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForServiceSpecification. -func (c ClientDiscoveryForServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "logSpecifications", c.LogSpecifications) - return json.Marshal(objectMap) -} - // ClientDiscoveryResponse - Operations List response which contains list of available APIs. type ClientDiscoveryResponse struct { // Link to the next chunk of Response. @@ -1860,14 +940,6 @@ type ClientDiscoveryResponse struct { Value []*ClientDiscoveryValueForSingleAPI `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryResponse. -func (c ClientDiscoveryResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - // ClientDiscoveryValueForSingleAPI - Available operation details. type ClientDiscoveryValueForSingleAPI struct { // Contains the localized display information for this particular operation @@ -1898,40 +970,6 @@ type CopyOnExpiryOption struct { ObjectType *string `json:"objectType,omitempty"` } -// GetCopyOption implements the CopyOptionClassification interface for type CopyOnExpiryOption. -func (c *CopyOnExpiryOption) GetCopyOption() *CopyOption { - return &CopyOption{ - ObjectType: c.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type CopyOnExpiryOption. -func (c CopyOnExpiryOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "CopyOnExpiryOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CopyOnExpiryOption. -func (c *CopyOnExpiryOption) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &c.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // CopyOptionClassification provides polymorphic access to related types. // Call the interface's GetCopyOption() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -1947,9 +985,6 @@ type CopyOption struct { ObjectType *string `json:"objectType,omitempty"` } -// GetCopyOption implements the CopyOptionClassification interface for type CopyOption. -func (c *CopyOption) GetCopyOption() *CopyOption { return c } - // CustomCopyOption - Duration based custom options to copy type CustomCopyOption struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1959,44 +994,6 @@ type CustomCopyOption struct { Duration *string `json:"duration,omitempty"` } -// GetCopyOption implements the CopyOptionClassification interface for type CustomCopyOption. -func (c *CustomCopyOption) GetCopyOption() *CopyOption { - return &CopyOption{ - ObjectType: c.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type CustomCopyOption. -func (c CustomCopyOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "duration", c.Duration) - objectMap["objectType"] = "CustomCopyOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomCopyOption. -func (c *CustomCopyOption) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, &c.Duration) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &c.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // DataStoreInfoBase - DataStoreInfo base type DataStoreInfoBase struct { // REQUIRED; type of datastore; Operational/Vault/Archive @@ -2024,9 +1021,6 @@ type DataStoreParameters struct { ObjectType *string `json:"objectType,omitempty"` } -// GetDataStoreParameters implements the DataStoreParametersClassification interface for type DataStoreParameters. -func (d *DataStoreParameters) GetDataStoreParameters() *DataStoreParameters { return d } - // Datasource to be backed up type Datasource struct { // REQUIRED; Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID @@ -2104,9 +1098,6 @@ type DeleteOption struct { ObjectType *string `json:"objectType,omitempty"` } -// GetDeleteOption implements the DeleteOptionClassification interface for type DeleteOption. -func (d *DeleteOption) GetDeleteOption() *DeleteOption { return d } - // DppBaseResource - Base resource under Microsoft.DataProtection provider namespace type DppBaseResource struct { // READ-ONLY; Resource Id represents the complete path to the resource. @@ -2128,14 +1119,6 @@ type DppBaseResourceList struct { Value []*DppBaseResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type DppBaseResourceList. -func (d DppBaseResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - // DppIdentityDetails - Identity details type DppIdentityDetails struct { // The identityType which can be either SystemAssigned or None @@ -2196,20 +1179,6 @@ type DppTrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DppTrackedResource. -func (d DppTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eTag", d.ETag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - type DppTrackedResourceList struct { // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. NextLink *string `json:"nextLink,omitempty"` @@ -2229,19 +1198,6 @@ type DppWorkerRequest struct { URI *string `json:"uri,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type DppWorkerRequest. -func (d DppWorkerRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "cultureInfo", d.CultureInfo) - populate(objectMap, "httpMethod", d.HTTPMethod) - populate(objectMap, "headers", d.Headers) - populate(objectMap, "parameters", d.Parameters) - populate(objectMap, "subscriptionId", d.SubscriptionID) - populate(objectMap, "supportedGroupVersions", d.SupportedGroupVersions) - populate(objectMap, "uri", d.URI) - return json.Marshal(objectMap) -} - // Error - The resource management error response. type Error struct { // READ-ONLY; The error additional info. @@ -2260,21 +1216,10 @@ type Error struct { Target *string `json:"target,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + Info interface{} `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -2282,7 +1227,8 @@ type ErrorAdditionalInfo struct { // ExportJobsClientBeginTriggerOptions contains the optional parameters for the ExportJobsClient.BeginTrigger method. type ExportJobsClientBeginTriggerOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ExportJobsOperationResultClientGetOptions contains the optional parameters for the ExportJobsOperationResultClient.Get @@ -2318,48 +1264,6 @@ type FeatureValidationRequest struct { FeatureType *FeatureType `json:"featureType,omitempty"` } -// GetFeatureValidationRequestBase implements the FeatureValidationRequestBaseClassification interface for type FeatureValidationRequest. -func (f *FeatureValidationRequest) GetFeatureValidationRequestBase() *FeatureValidationRequestBase { - return &FeatureValidationRequestBase{ - ObjectType: f.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type FeatureValidationRequest. -func (f FeatureValidationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "featureName", f.FeatureName) - populate(objectMap, "featureType", f.FeatureType) - objectMap["objectType"] = "FeatureValidationRequest" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationRequest. -func (f *FeatureValidationRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "featureName": - err = unpopulate(val, &f.FeatureName) - delete(rawMsg, key) - case "featureType": - err = unpopulate(val, &f.FeatureType) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &f.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // FeatureValidationRequestBaseClassification provides polymorphic access to related types. // Call the interface's GetFeatureValidationRequestBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2375,11 +1279,6 @@ type FeatureValidationRequestBase struct { ObjectType *string `json:"objectType,omitempty"` } -// GetFeatureValidationRequestBase implements the FeatureValidationRequestBaseClassification interface for type FeatureValidationRequestBase. -func (f *FeatureValidationRequestBase) GetFeatureValidationRequestBase() *FeatureValidationRequestBase { - return f -} - // FeatureValidationResponse - Feature Validation Response type FeatureValidationResponse struct { // REQUIRED; Type of the specific object - used for deserializing @@ -2392,48 +1291,6 @@ type FeatureValidationResponse struct { Features []*SupportedFeature `json:"features,omitempty"` } -// GetFeatureValidationResponseBase implements the FeatureValidationResponseBaseClassification interface for type FeatureValidationResponse. -func (f *FeatureValidationResponse) GetFeatureValidationResponseBase() *FeatureValidationResponseBase { - return &FeatureValidationResponseBase{ - ObjectType: f.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type FeatureValidationResponse. -func (f FeatureValidationResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "featureType", f.FeatureType) - populate(objectMap, "features", f.Features) - objectMap["objectType"] = "FeatureValidationResponse" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationResponse. -func (f *FeatureValidationResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "featureType": - err = unpopulate(val, &f.FeatureType) - delete(rawMsg, key) - case "features": - err = unpopulate(val, &f.Features) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &f.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // FeatureValidationResponseBaseClassification provides polymorphic access to related types. // Call the interface's GetFeatureValidationResponseBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2449,51 +1306,12 @@ type FeatureValidationResponseBase struct { ObjectType *string `json:"objectType,omitempty"` } -// GetFeatureValidationResponseBase implements the FeatureValidationResponseBaseClassification interface for type FeatureValidationResponseBase. -func (f *FeatureValidationResponseBase) GetFeatureValidationResponseBase() *FeatureValidationResponseBase { - return f -} - // ImmediateCopyOption - Immediate copy Option type ImmediateCopyOption struct { // REQUIRED; Type of the specific object - used for deserializing ObjectType *string `json:"objectType,omitempty"` } -// GetCopyOption implements the CopyOptionClassification interface for type ImmediateCopyOption. -func (i *ImmediateCopyOption) GetCopyOption() *CopyOption { - return &CopyOption{ - ObjectType: i.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ImmediateCopyOption. -func (i ImmediateCopyOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "ImmediateCopyOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImmediateCopyOption. -func (i *ImmediateCopyOption) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &i.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // InnerError - Inner Error type InnerError struct { // Any Key value pairs that can be provided to the client for additional verbose information. @@ -2506,19 +1324,10 @@ type InnerError struct { EmbeddedInnerError *InnerError `json:"embeddedInnerError,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type InnerError. -func (i InnerError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", i.AdditionalInfo) - populate(objectMap, "code", i.Code) - populate(objectMap, "embeddedInnerError", i.EmbeddedInnerError) - return json.Marshal(objectMap) -} - // ItemLevelRestoreCriteriaClassification provides polymorphic access to related types. // Call the interface's GetItemLevelRestoreCriteria() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *ItemLevelRestoreCriteria, *RangeBasedItemLevelRestoreCriteria +// - *ItemLevelRestoreCriteria, *KubernetesPVRestoreCriteria, *KubernetesStorageClassRestoreCriteria, *RangeBasedItemLevelRestoreCriteria type ItemLevelRestoreCriteriaClassification interface { // GetItemLevelRestoreCriteria returns the ItemLevelRestoreCriteria content of the underlying type. GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria @@ -2530,9 +1339,6 @@ type ItemLevelRestoreCriteria struct { ObjectType *string `json:"objectType,omitempty"` } -// GetItemLevelRestoreCriteria implements the ItemLevelRestoreCriteriaClassification interface for type ItemLevelRestoreCriteria. -func (i *ItemLevelRestoreCriteria) GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria { return i } - // ItemLevelRestoreTargetInfo - Restore target info for Item level restore operation type ItemLevelRestoreTargetInfo struct { // REQUIRED; Information of target DS @@ -2557,66 +1363,6 @@ type ItemLevelRestoreTargetInfo struct { RestoreLocation *string `json:"restoreLocation,omitempty"` } -// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type ItemLevelRestoreTargetInfo. -func (i *ItemLevelRestoreTargetInfo) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { - return &RestoreTargetInfoBase{ - ObjectType: i.ObjectType, - RecoveryOption: i.RecoveryOption, - RestoreLocation: i.RestoreLocation, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ItemLevelRestoreTargetInfo. -func (i ItemLevelRestoreTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceAuthCredentials", i.DatasourceAuthCredentials) - populate(objectMap, "datasourceInfo", i.DatasourceInfo) - populate(objectMap, "datasourceSetInfo", i.DatasourceSetInfo) - objectMap["objectType"] = "ItemLevelRestoreTargetInfo" - populate(objectMap, "recoveryOption", i.RecoveryOption) - populate(objectMap, "restoreCriteria", i.RestoreCriteria) - populate(objectMap, "restoreLocation", i.RestoreLocation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ItemLevelRestoreTargetInfo. -func (i *ItemLevelRestoreTargetInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "datasourceAuthCredentials": - i.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) - delete(rawMsg, key) - case "datasourceInfo": - err = unpopulate(val, &i.DatasourceInfo) - delete(rawMsg, key) - case "datasourceSetInfo": - err = unpopulate(val, &i.DatasourceSetInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &i.ObjectType) - delete(rawMsg, key) - case "recoveryOption": - err = unpopulate(val, &i.RecoveryOption) - delete(rawMsg, key) - case "restoreCriteria": - i.RestoreCriteria, err = unmarshalItemLevelRestoreCriteriaClassificationArray(val) - delete(rawMsg, key) - case "restoreLocation": - err = unpopulate(val, &i.RestoreLocation) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // JobExtendedInfo - Extended Information about the job type JobExtendedInfo struct { // Job's Additional Details @@ -2641,19 +1387,6 @@ type JobExtendedInfo struct { TargetRecoverPoint *RestoreJobRecoveryPointDetails `json:"targetRecoverPoint,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type JobExtendedInfo. -func (j JobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalDetails", j.AdditionalDetails) - populate(objectMap, "backupInstanceState", j.BackupInstanceState) - populate(objectMap, "dataTransferredInBytes", j.DataTransferredInBytes) - populate(objectMap, "recoveryDestination", j.RecoveryDestination) - populate(objectMap, "sourceRecoverPoint", j.SourceRecoverPoint) - populate(objectMap, "subTasks", j.SubTasks) - populate(objectMap, "targetRecoverPoint", j.TargetRecoverPoint) - return json.Marshal(objectMap) -} - // JobSubTask - Details of Job's Sub Task type JobSubTask struct { // REQUIRED; Task Id of the Sub Task @@ -2672,17 +1405,6 @@ type JobSubTask struct { TaskProgress *string `json:"taskProgress,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type JobSubTask. -func (j JobSubTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalDetails", j.AdditionalDetails) - populate(objectMap, "taskId", j.TaskID) - populate(objectMap, "taskName", j.TaskName) - populate(objectMap, "taskProgress", j.TaskProgress) - populate(objectMap, "taskStatus", j.TaskStatus) - return json.Marshal(objectMap) -} - // JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. type JobsClientGetOptions struct { // placeholder for future optional parameters @@ -2693,6 +1415,36 @@ type JobsClientListOptions struct { // placeholder for future optional parameters } +// KubernetesPVRestoreCriteria - Item Level kubernetes persistent volume target info for restore operation +type KubernetesPVRestoreCriteria struct { + // REQUIRED; Type of the specific object - used for deserializing + ObjectType *string `json:"objectType,omitempty"` + + // Selected persistent volume claim name + Name *string `json:"name,omitempty"` + + // Selected storage class name for restore operation + StorageClassName *string `json:"storageClassName,omitempty"` +} + +// KubernetesStorageClassRestoreCriteria - Item Level kubernetes storage class target info for restore operation +type KubernetesStorageClassRestoreCriteria struct { + // REQUIRED; Type of the specific object - used for deserializing + ObjectType *string `json:"objectType,omitempty"` + + // Provisioner of the storage class + Provisioner *string `json:"provisioner,omitempty"` + + // Selected storage class name + SelectedStorageClassName *string `json:"selectedStorageClassName,omitempty"` +} + +// MonitoringSettings - Monitoring Settings +type MonitoringSettings struct { + // Settings for Azure Monitor based alerts + AzureMonitorAlertSettings *AzureMonitorAlertSettings `json:"azureMonitorAlertSettings,omitempty"` +} + // OperationExtendedInfoClassification provides polymorphic access to related types. // Call the interface's GetOperationExtendedInfo() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2708,9 +1460,6 @@ type OperationExtendedInfo struct { ObjectType *string `json:"objectType,omitempty"` } -// GetOperationExtendedInfo implements the OperationExtendedInfoClassification interface for type OperationExtendedInfo. -func (o *OperationExtendedInfo) GetOperationExtendedInfo() *OperationExtendedInfo { return o } - // OperationJobExtendedInfo - Operation Job Extended Info type OperationJobExtendedInfo struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. @@ -2720,44 +1469,6 @@ type OperationJobExtendedInfo struct { JobID *string `json:"jobId,omitempty"` } -// GetOperationExtendedInfo implements the OperationExtendedInfoClassification interface for type OperationJobExtendedInfo. -func (o *OperationJobExtendedInfo) GetOperationExtendedInfo() *OperationExtendedInfo { - return &OperationExtendedInfo{ - ObjectType: o.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type OperationJobExtendedInfo. -func (o OperationJobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "jobId", o.JobID) - objectMap["objectType"] = "OperationJobExtendedInfo" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationJobExtendedInfo. -func (o *OperationJobExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "jobId": - err = unpopulate(val, &o.JobID) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &o.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // OperationResource - Operation Resource type OperationResource struct { // End time of the operation @@ -2782,89 +1493,51 @@ type OperationResource struct { Status *string `json:"status,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationResource. -func (o OperationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResource. -func (o *OperationResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &o.Name) - delete(rawMsg, key) - case "properties": - o.Properties, err = unmarshalOperationExtendedInfoClassification(val) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &o.Status) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // OperationResultClientGetOptions contains the optional parameters for the OperationResultClient.Get method. type OperationResultClientGetOptions struct { // placeholder for future optional parameters } +// OperationStatusBackupVaultContextClientGetOptions contains the optional parameters for the OperationStatusBackupVaultContextClient.Get +// method. +type OperationStatusBackupVaultContextClientGetOptions struct { + // placeholder for future optional parameters +} + // OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. type OperationStatusClientGetOptions struct { // placeholder for future optional parameters } +// OperationStatusResourceGroupContextClientGetOptions contains the optional parameters for the OperationStatusResourceGroupContextClient.Get +// method. +type OperationStatusResourceGroupContextClientGetOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters } +// PatchBackupVaultInput - Backup Vault Contract for Patch Backup Vault API. +type PatchBackupVaultInput struct { + // Monitoring Settings + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` +} + // PatchResourceRequestInput - Patch Request content for Microsoft.DataProtection resources type PatchResourceRequestInput struct { // Input Managed Identity Details Identity *DppIdentityDetails `json:"identity,omitempty"` + // Resource properties. + Properties *PatchBackupVaultInput `json:"properties,omitempty"` + // Resource tags. Tags map[string]*string `json:"tags,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PatchResourceRequestInput. -func (p PatchResourceRequestInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - // PolicyInfo - Policy Info in backupInstance type PolicyInfo struct { // REQUIRED @@ -2883,33 +1556,6 @@ type PolicyParameters struct { DataStoreParametersList []DataStoreParametersClassification `json:"dataStoreParametersList,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PolicyParameters. -func (p PolicyParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataStoreParametersList", p.DataStoreParametersList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyParameters. -func (p *PolicyParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "dataStoreParametersList": - p.DataStoreParametersList, err = unmarshalDataStoreParametersClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ProtectionStatusDetails - Protection status details type ProtectionStatusDetails struct { // Specifies the protection status error of the resource @@ -2931,48 +1577,6 @@ type RangeBasedItemLevelRestoreCriteria struct { MinMatchingValue *string `json:"minMatchingValue,omitempty"` } -// GetItemLevelRestoreCriteria implements the ItemLevelRestoreCriteriaClassification interface for type RangeBasedItemLevelRestoreCriteria. -func (r *RangeBasedItemLevelRestoreCriteria) GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria { - return &ItemLevelRestoreCriteria{ - ObjectType: r.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type RangeBasedItemLevelRestoreCriteria. -func (r RangeBasedItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "maxMatchingValue", r.MaxMatchingValue) - populate(objectMap, "minMatchingValue", r.MinMatchingValue) - objectMap["objectType"] = "RangeBasedItemLevelRestoreCriteria" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RangeBasedItemLevelRestoreCriteria. -func (r *RangeBasedItemLevelRestoreCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "maxMatchingValue": - err = unpopulate(val, &r.MaxMatchingValue) - delete(rawMsg, key) - case "minMatchingValue": - err = unpopulate(val, &r.MinMatchingValue) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &r.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // RecoveryPointDataStoreDetails - RecoveryPoint datastore details type RecoveryPointDataStoreDetails struct { CreationTime *time.Time `json:"creationTime,omitempty"` @@ -2990,65 +1594,6 @@ type RecoveryPointDataStoreDetails struct { RehydrationStatus *RehydrationStatus `json:"rehydrationStatus,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointDataStoreDetails. -func (r RecoveryPointDataStoreDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) - populateTimeRFC3339(objectMap, "expiryTime", r.ExpiryTime) - populate(objectMap, "id", r.ID) - populate(objectMap, "metaData", r.MetaData) - populateTimeRFC3339(objectMap, "rehydrationExpiryTime", r.RehydrationExpiryTime) - populate(objectMap, "rehydrationStatus", r.RehydrationStatus) - populate(objectMap, "state", r.State) - populate(objectMap, "type", r.Type) - populate(objectMap, "visible", r.Visible) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointDataStoreDetails. -func (r *RecoveryPointDataStoreDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "creationTime": - err = unpopulateTimeRFC3339(val, &r.CreationTime) - delete(rawMsg, key) - case "expiryTime": - err = unpopulateTimeRFC3339(val, &r.ExpiryTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, &r.ID) - delete(rawMsg, key) - case "metaData": - err = unpopulate(val, &r.MetaData) - delete(rawMsg, key) - case "rehydrationExpiryTime": - err = unpopulateTimeRFC3339(val, &r.RehydrationExpiryTime) - delete(rawMsg, key) - case "rehydrationStatus": - err = unpopulate(val, &r.RehydrationStatus) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &r.State) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &r.Type) - delete(rawMsg, key) - case "visible": - err = unpopulate(val, &r.Visible) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. type RecoveryPointsClientGetOptions struct { // placeholder for future optional parameters @@ -3088,17 +1633,6 @@ type ResourceGuard struct { VaultCriticalOperationExclusionList []*string `json:"vaultCriticalOperationExclusionList,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuard. -func (r ResourceGuard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowAutoApprovals", r.AllowAutoApprovals) - populate(objectMap, "description", r.Description) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "resourceGuardOperations", r.ResourceGuardOperations) - populate(objectMap, "vaultCriticalOperationExclusionList", r.VaultCriticalOperationExclusionList) - return json.Marshal(objectMap) -} - // ResourceGuardOperation - This class contains all the details about a critical operation. type ResourceGuardOperation struct { // READ-ONLY; Type of resource request. @@ -3137,21 +1671,6 @@ type ResourceGuardResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardResource. -func (r ResourceGuardResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eTag", r.ETag) - populate(objectMap, "id", r.ID) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - // ResourceGuardResourceList - List of ResourceGuard resources type ResourceGuardResourceList struct { // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. @@ -3161,14 +1680,6 @@ type ResourceGuardResourceList struct { Value []*ResourceGuardResource `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardResourceList. -func (r ResourceGuardResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - // ResourceGuardsClientDeleteOptions contains the optional parameters for the ResourceGuardsClient.Delete method. type ResourceGuardsClientDeleteOptions struct { // placeholder for future optional parameters @@ -3320,90 +1831,11 @@ type RestoreFilesTargetInfo struct { RestoreLocation *string `json:"restoreLocation,omitempty"` } -// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type RestoreFilesTargetInfo. -func (r *RestoreFilesTargetInfo) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { - return &RestoreTargetInfoBase{ - ObjectType: r.ObjectType, - RecoveryOption: r.RecoveryOption, - RestoreLocation: r.RestoreLocation, - } -} - -// MarshalJSON implements the json.Marshaller interface for type RestoreFilesTargetInfo. -func (r RestoreFilesTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "RestoreFilesTargetInfo" - populate(objectMap, "recoveryOption", r.RecoveryOption) - populate(objectMap, "restoreLocation", r.RestoreLocation) - populate(objectMap, "targetDetails", r.TargetDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreFilesTargetInfo. -func (r *RestoreFilesTargetInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &r.ObjectType) - delete(rawMsg, key) - case "recoveryOption": - err = unpopulate(val, &r.RecoveryOption) - delete(rawMsg, key) - case "restoreLocation": - err = unpopulate(val, &r.RestoreLocation) - delete(rawMsg, key) - case "targetDetails": - err = unpopulate(val, &r.TargetDetails) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type RestoreJobRecoveryPointDetails struct { RecoveryPointID *string `json:"recoveryPointID,omitempty"` RecoveryPointTime *time.Time `json:"recoveryPointTime,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type RestoreJobRecoveryPointDetails. -func (r RestoreJobRecoveryPointDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "recoveryPointID", r.RecoveryPointID) - populateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreJobRecoveryPointDetails. -func (r *RestoreJobRecoveryPointDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "recoveryPointID": - err = unpopulate(val, &r.RecoveryPointID) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulateTimeRFC3339(val, &r.RecoveryPointTime) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // RestoreTargetInfo - Class encapsulating restore target parameters type RestoreTargetInfo struct { // REQUIRED; Information of target DS @@ -3425,62 +1857,6 @@ type RestoreTargetInfo struct { RestoreLocation *string `json:"restoreLocation,omitempty"` } -// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type RestoreTargetInfo. -func (r *RestoreTargetInfo) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { - return &RestoreTargetInfoBase{ - ObjectType: r.ObjectType, - RecoveryOption: r.RecoveryOption, - RestoreLocation: r.RestoreLocation, - } -} - -// MarshalJSON implements the json.Marshaller interface for type RestoreTargetInfo. -func (r RestoreTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceAuthCredentials", r.DatasourceAuthCredentials) - populate(objectMap, "datasourceInfo", r.DatasourceInfo) - populate(objectMap, "datasourceSetInfo", r.DatasourceSetInfo) - objectMap["objectType"] = "RestoreTargetInfo" - populate(objectMap, "recoveryOption", r.RecoveryOption) - populate(objectMap, "restoreLocation", r.RestoreLocation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreTargetInfo. -func (r *RestoreTargetInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "datasourceAuthCredentials": - r.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) - delete(rawMsg, key) - case "datasourceInfo": - err = unpopulate(val, &r.DatasourceInfo) - delete(rawMsg, key) - case "datasourceSetInfo": - err = unpopulate(val, &r.DatasourceSetInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &r.ObjectType) - delete(rawMsg, key) - case "recoveryOption": - err = unpopulate(val, &r.RecoveryOption) - delete(rawMsg, key) - case "restoreLocation": - err = unpopulate(val, &r.RestoreLocation) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // RestoreTargetInfoBaseClassification provides polymorphic access to related types. // Call the interface's GetRestoreTargetInfoBase() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -3502,9 +1878,6 @@ type RestoreTargetInfoBase struct { RestoreLocation *string `json:"restoreLocation,omitempty"` } -// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type RestoreTargetInfoBase. -func (r *RestoreTargetInfoBase) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { return r } - // RetentionTag - Retention tag type RetentionTag struct { // REQUIRED; Retention Tag Name to relate it to retention rule. @@ -3542,72 +1915,6 @@ type ScheduleBasedBackupCriteria struct { WeeksOfTheMonth []*WeekNumber `json:"weeksOfTheMonth,omitempty"` } -// GetBackupCriteria implements the BackupCriteriaClassification interface for type ScheduleBasedBackupCriteria. -func (s *ScheduleBasedBackupCriteria) GetBackupCriteria() *BackupCriteria { - return &BackupCriteria{ - ObjectType: s.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduleBasedBackupCriteria. -func (s ScheduleBasedBackupCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "absoluteCriteria", s.AbsoluteCriteria) - populate(objectMap, "daysOfMonth", s.DaysOfMonth) - populate(objectMap, "daysOfTheWeek", s.DaysOfTheWeek) - populate(objectMap, "monthsOfYear", s.MonthsOfYear) - objectMap["objectType"] = "ScheduleBasedBackupCriteria" - aux := make([]*timeRFC3339, len(s.ScheduleTimes), len(s.ScheduleTimes)) - for i := 0; i < len(s.ScheduleTimes); i++ { - aux[i] = (*timeRFC3339)(s.ScheduleTimes[i]) - } - populate(objectMap, "scheduleTimes", aux) - populate(objectMap, "weeksOfTheMonth", s.WeeksOfTheMonth) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedBackupCriteria. -func (s *ScheduleBasedBackupCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "absoluteCriteria": - err = unpopulate(val, &s.AbsoluteCriteria) - delete(rawMsg, key) - case "daysOfMonth": - err = unpopulate(val, &s.DaysOfMonth) - delete(rawMsg, key) - case "daysOfTheWeek": - err = unpopulate(val, &s.DaysOfTheWeek) - delete(rawMsg, key) - case "monthsOfYear": - err = unpopulate(val, &s.MonthsOfYear) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, &s.ObjectType) - delete(rawMsg, key) - case "scheduleTimes": - var aux []*timeRFC3339 - err = unpopulate(val, &aux) - for _, au := range aux { - s.ScheduleTimes = append(s.ScheduleTimes, (*time.Time)(au)) - } - delete(rawMsg, key) - case "weeksOfTheMonth": - err = unpopulate(val, &s.WeeksOfTheMonth) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ScheduleBasedTriggerContext - Schedule based trigger context type ScheduleBasedTriggerContext struct { // REQUIRED; Type of the specific object - used for deserializing @@ -3620,48 +1927,6 @@ type ScheduleBasedTriggerContext struct { TaggingCriteria []*TaggingCriteria `json:"taggingCriteria,omitempty"` } -// GetTriggerContext implements the TriggerContextClassification interface for type ScheduleBasedTriggerContext. -func (s *ScheduleBasedTriggerContext) GetTriggerContext() *TriggerContext { - return &TriggerContext{ - ObjectType: s.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduleBasedTriggerContext. -func (s ScheduleBasedTriggerContext) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "ScheduleBasedTriggerContext" - populate(objectMap, "schedule", s.Schedule) - populate(objectMap, "taggingCriteria", s.TaggingCriteria) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedTriggerContext. -func (s *ScheduleBasedTriggerContext) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &s.ObjectType) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, &s.Schedule) - delete(rawMsg, key) - case "taggingCriteria": - err = unpopulate(val, &s.TaggingCriteria) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SecretStoreBasedAuthCredentials - Secret store based authentication credentials. type SecretStoreBasedAuthCredentials struct { // REQUIRED; Type of the specific object - used for deserializing @@ -3671,44 +1936,6 @@ type SecretStoreBasedAuthCredentials struct { SecretStoreResource *SecretStoreResource `json:"secretStoreResource,omitempty"` } -// GetAuthCredentials implements the AuthCredentialsClassification interface for type SecretStoreBasedAuthCredentials. -func (s *SecretStoreBasedAuthCredentials) GetAuthCredentials() *AuthCredentials { - return &AuthCredentials{ - ObjectType: s.ObjectType, - } -} - -// MarshalJSON implements the json.Marshaller interface for type SecretStoreBasedAuthCredentials. -func (s SecretStoreBasedAuthCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "SecretStoreBasedAuthCredentials" - populate(objectMap, "secretStoreResource", s.SecretStoreResource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretStoreBasedAuthCredentials. -func (s *SecretStoreBasedAuthCredentials) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, &s.ObjectType) - delete(rawMsg, key) - case "secretStoreResource": - err = unpopulate(val, &s.SecretStoreResource) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SecretStoreResource - Class representing a secret store resource. type SecretStoreResource struct { // REQUIRED; Gets or sets the type of secret store @@ -3716,6 +1943,9 @@ type SecretStoreResource struct { // Uri to get to the resource URI *string `json:"uri,omitempty"` + + // Gets or sets value stored in secret store resource + Value *string `json:"value,omitempty"` } // SourceLifeCycle - Source LifeCycle @@ -3728,41 +1958,6 @@ type SourceLifeCycle struct { TargetDataStoreCopySettings []*TargetCopySetting `json:"targetDataStoreCopySettings,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SourceLifeCycle. -func (s SourceLifeCycle) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deleteAfter", s.DeleteAfter) - populate(objectMap, "sourceDataStore", s.SourceDataStore) - populate(objectMap, "targetDataStoreCopySettings", s.TargetDataStoreCopySettings) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceLifeCycle. -func (s *SourceLifeCycle) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "deleteAfter": - s.DeleteAfter, err = unmarshalDeleteOptionClassification(val) - delete(rawMsg, key) - case "sourceDataStore": - err = unpopulate(val, &s.SourceDataStore) - delete(rawMsg, key) - case "targetDataStoreCopySettings": - err = unpopulate(val, &s.TargetDataStoreCopySettings) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // StorageSetting - Storage setting type StorageSetting struct { // Gets or sets the type of the datastore. @@ -3784,13 +1979,10 @@ type SupportedFeature struct { SupportStatus *FeatureSupportStatus `json:"supportStatus,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SupportedFeature. -func (s SupportedFeature) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "exposureControlledFeatures", s.ExposureControlledFeatures) - populate(objectMap, "featureName", s.FeatureName) - populate(objectMap, "supportStatus", s.SupportStatus) - return json.Marshal(objectMap) +// SyncBackupInstanceRequest - Sync BackupInstance Request +type SyncBackupInstanceRequest struct { + // Field indicating sync type e.g. to sync only in case of failure or in all cases + SyncType *SyncType `json:"syncType,omitempty"` } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -3814,53 +2006,6 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TaggingCriteria - Tagging criteria type TaggingCriteria struct { // REQUIRED; Specifies if tag is default. @@ -3876,45 +2021,6 @@ type TaggingCriteria struct { Criteria []BackupCriteriaClassification `json:"criteria,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TaggingCriteria. -func (t TaggingCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "criteria", t.Criteria) - populate(objectMap, "isDefault", t.IsDefault) - populate(objectMap, "tagInfo", t.TagInfo) - populate(objectMap, "taggingPriority", t.TaggingPriority) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaggingCriteria. -func (t *TaggingCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "criteria": - t.Criteria, err = unmarshalBackupCriteriaClassificationArray(val) - delete(rawMsg, key) - case "isDefault": - err = unpopulate(val, &t.IsDefault) - delete(rawMsg, key) - case "tagInfo": - err = unpopulate(val, &t.TagInfo) - delete(rawMsg, key) - case "taggingPriority": - err = unpopulate(val, &t.TaggingPriority) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TargetCopySetting - Target copy settings type TargetCopySetting struct { // REQUIRED; It can be CustomCopyOption or ImmediateCopyOption. @@ -3924,37 +2030,6 @@ type TargetCopySetting struct { DataStore *DataStoreInfoBase `json:"dataStore,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type TargetCopySetting. -func (t TargetCopySetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "copyAfter", t.CopyAfter) - populate(objectMap, "dataStore", t.DataStore) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetCopySetting. -func (t *TargetCopySetting) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "copyAfter": - t.CopyAfter, err = unmarshalCopyOptionClassification(val) - delete(rawMsg, key) - case "dataStore": - err = unpopulate(val, &t.DataStore) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // TargetDetails - Class encapsulating target details, used where the destination is not a datasource type TargetDetails struct { // REQUIRED; Restore operation may create multiple files inside location pointed by Url Below will be the common prefix for @@ -3989,9 +2064,6 @@ type TriggerContext struct { ObjectType *string `json:"objectType,omitempty"` } -// GetTriggerContext implements the TriggerContextClassification interface for type TriggerContext. -func (t *TriggerContext) GetTriggerContext() *TriggerContext { return t } - // UserFacingError - Error object used by layers that have access to localized content, and propagate that to user type UserFacingError struct { // Unique code for this error @@ -4020,21 +2092,6 @@ type UserFacingError struct { Target *string `json:"target,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type UserFacingError. -func (u UserFacingError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", u.Code) - populate(objectMap, "details", u.Details) - populate(objectMap, "innerError", u.InnerError) - populate(objectMap, "isRetryable", u.IsRetryable) - populate(objectMap, "isUserError", u.IsUserError) - populate(objectMap, "message", u.Message) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "recommendedAction", u.RecommendedAction) - populate(objectMap, "target", u.Target) - return json.Marshal(objectMap) -} - // ValidateForBackupRequest - Validate for backup request type ValidateForBackupRequest struct { // REQUIRED; Backup Instance @@ -4046,47 +2103,3 @@ type ValidateRestoreRequestObject struct { // REQUIRED; Gets or sets the restore request object. RestoreRequestObject AzureBackupRestoreRequestClassification `json:"restoreRequestObject,omitempty"` } - -// MarshalJSON implements the json.Marshaller interface for type ValidateRestoreRequestObject. -func (v ValidateRestoreRequestObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "restoreRequestObject", v.RestoreRequestObject) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateRestoreRequestObject. -func (v *ValidateRestoreRequestObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "restoreRequestObject": - v.RestoreRequestObject, err = unmarshalAzureBackupRestoreRequestClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models_serde.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models_serde.go new file mode 100644 index 000000000000..19855607daa5 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models_serde.go @@ -0,0 +1,2252 @@ +//go:build go1.18 +// +build go1.18 + +// 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. + +package armdataprotection + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// GetDeleteOption implements the DeleteOptionClassification interface for type AbsoluteDeleteOption. +func (a *AbsoluteDeleteOption) GetDeleteOption() *DeleteOption { + return &DeleteOption{ + Duration: a.Duration, + ObjectType: a.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AbsoluteDeleteOption. +func (a AbsoluteDeleteOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "duration", a.Duration) + objectMap["objectType"] = "AbsoluteDeleteOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteDeleteOption. +func (a *AbsoluteDeleteOption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "duration": + err = unpopulate(val, &a.Duration) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTriggerContext implements the TriggerContextClassification interface for type AdhocBasedTriggerContext. +func (a *AdhocBasedTriggerContext) GetTriggerContext() *TriggerContext { + return &TriggerContext{ + ObjectType: a.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AdhocBasedTriggerContext. +func (a AdhocBasedTriggerContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AdhocBasedTriggerContext" + populate(objectMap, "taggingCriteria", a.TaggingCriteria) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdhocBasedTriggerContext. +func (a *AdhocBasedTriggerContext) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "taggingCriteria": + err = unpopulate(val, &a.TaggingCriteria) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAuthCredentials implements the AuthCredentialsClassification interface for type AuthCredentials. +func (a *AuthCredentials) GetAuthCredentials() *AuthCredentials { return a } + +// GetAzureBackupRecoveryPoint implements the AzureBackupRecoveryPointClassification interface for type AzureBackupDiscreteRecoveryPoint. +func (a *AzureBackupDiscreteRecoveryPoint) GetAzureBackupRecoveryPoint() *AzureBackupRecoveryPoint { + return &AzureBackupRecoveryPoint{ + ObjectType: a.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupDiscreteRecoveryPoint. +func (a AzureBackupDiscreteRecoveryPoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "friendlyName", a.FriendlyName) + objectMap["objectType"] = "AzureBackupDiscreteRecoveryPoint" + populate(objectMap, "policyName", a.PolicyName) + populate(objectMap, "policyVersion", a.PolicyVersion) + populate(objectMap, "recoveryPointDataStoresDetails", a.RecoveryPointDataStoresDetails) + populate(objectMap, "recoveryPointId", a.RecoveryPointID) + populateTimeRFC3339(objectMap, "recoveryPointTime", a.RecoveryPointTime) + populate(objectMap, "recoveryPointType", a.RecoveryPointType) + populate(objectMap, "retentionTagName", a.RetentionTagName) + populate(objectMap, "retentionTagVersion", a.RetentionTagVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupDiscreteRecoveryPoint. +func (a *AzureBackupDiscreteRecoveryPoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "friendlyName": + err = unpopulate(val, &a.FriendlyName) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, &a.PolicyName) + delete(rawMsg, key) + case "policyVersion": + err = unpopulate(val, &a.PolicyVersion) + delete(rawMsg, key) + case "recoveryPointDataStoresDetails": + err = unpopulate(val, &a.RecoveryPointDataStoresDetails) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, &a.RecoveryPointID) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulateTimeRFC3339(val, &a.RecoveryPointTime) + delete(rawMsg, key) + case "recoveryPointType": + err = unpopulate(val, &a.RecoveryPointType) + delete(rawMsg, key) + case "retentionTagName": + err = unpopulate(val, &a.RetentionTagName) + delete(rawMsg, key) + case "retentionTagVersion": + err = unpopulate(val, &a.RetentionTagVersion) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesRequestResource. +func (a AzureBackupFindRestorableTimeRangesRequestResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", a.Content) + populate(objectMap, "cultureInfo", a.CultureInfo) + populate(objectMap, "httpMethod", a.HTTPMethod) + populate(objectMap, "headers", a.Headers) + populate(objectMap, "parameters", a.Parameters) + populate(objectMap, "subscriptionId", a.SubscriptionID) + populate(objectMap, "supportedGroupVersions", a.SupportedGroupVersions) + populate(objectMap, "uri", a.URI) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesResponse. +func (a AzureBackupFindRestorableTimeRangesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "objectType", a.ObjectType) + populate(objectMap, "restorableTimeRanges", a.RestorableTimeRanges) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupJob. +func (a AzureBackupJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activityID", a.ActivityID) + populate(objectMap, "backupInstanceFriendlyName", a.BackupInstanceFriendlyName) + populate(objectMap, "backupInstanceId", a.BackupInstanceID) + populate(objectMap, "dataSourceId", a.DataSourceID) + populate(objectMap, "dataSourceLocation", a.DataSourceLocation) + populate(objectMap, "dataSourceName", a.DataSourceName) + populate(objectMap, "dataSourceSetName", a.DataSourceSetName) + populate(objectMap, "dataSourceType", a.DataSourceType) + populate(objectMap, "destinationDataStoreName", a.DestinationDataStoreName) + populate(objectMap, "duration", a.Duration) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "errorDetails", a.ErrorDetails) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "extendedInfo", a.ExtendedInfo) + populate(objectMap, "isUserTriggered", a.IsUserTriggered) + populate(objectMap, "operation", a.Operation) + populate(objectMap, "operationCategory", a.OperationCategory) + populate(objectMap, "policyId", a.PolicyID) + populate(objectMap, "policyName", a.PolicyName) + populate(objectMap, "progressEnabled", a.ProgressEnabled) + populate(objectMap, "progressUrl", a.ProgressURL) + populate(objectMap, "restoreType", a.RestoreType) + populate(objectMap, "sourceDataStoreName", a.SourceDataStoreName) + populate(objectMap, "sourceResourceGroup", a.SourceResourceGroup) + populate(objectMap, "sourceSubscriptionID", a.SourceSubscriptionID) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + populate(objectMap, "status", a.Status) + populate(objectMap, "subscriptionId", a.SubscriptionID) + populate(objectMap, "supportedActions", a.SupportedActions) + populate(objectMap, "vaultName", a.VaultName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupJob. +func (a *AzureBackupJob) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "activityID": + err = unpopulate(val, &a.ActivityID) + delete(rawMsg, key) + case "backupInstanceFriendlyName": + err = unpopulate(val, &a.BackupInstanceFriendlyName) + delete(rawMsg, key) + case "backupInstanceId": + err = unpopulate(val, &a.BackupInstanceID) + delete(rawMsg, key) + case "dataSourceId": + err = unpopulate(val, &a.DataSourceID) + delete(rawMsg, key) + case "dataSourceLocation": + err = unpopulate(val, &a.DataSourceLocation) + delete(rawMsg, key) + case "dataSourceName": + err = unpopulate(val, &a.DataSourceName) + delete(rawMsg, key) + case "dataSourceSetName": + err = unpopulate(val, &a.DataSourceSetName) + delete(rawMsg, key) + case "dataSourceType": + err = unpopulate(val, &a.DataSourceType) + delete(rawMsg, key) + case "destinationDataStoreName": + err = unpopulate(val, &a.DestinationDataStoreName) + delete(rawMsg, key) + case "duration": + err = unpopulate(val, &a.Duration) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &a.EndTime) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, &a.ErrorDetails) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, &a.Etag) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, &a.ExtendedInfo) + delete(rawMsg, key) + case "isUserTriggered": + err = unpopulate(val, &a.IsUserTriggered) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, &a.Operation) + delete(rawMsg, key) + case "operationCategory": + err = unpopulate(val, &a.OperationCategory) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, &a.PolicyID) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, &a.PolicyName) + delete(rawMsg, key) + case "progressEnabled": + err = unpopulate(val, &a.ProgressEnabled) + delete(rawMsg, key) + case "progressUrl": + err = unpopulate(val, &a.ProgressURL) + delete(rawMsg, key) + case "restoreType": + err = unpopulate(val, &a.RestoreType) + delete(rawMsg, key) + case "sourceDataStoreName": + err = unpopulate(val, &a.SourceDataStoreName) + delete(rawMsg, key) + case "sourceResourceGroup": + err = unpopulate(val, &a.SourceResourceGroup) + delete(rawMsg, key) + case "sourceSubscriptionID": + err = unpopulate(val, &a.SourceSubscriptionID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &a.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &a.Status) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, &a.SubscriptionID) + delete(rawMsg, key) + case "supportedActions": + err = unpopulate(val, &a.SupportedActions) + delete(rawMsg, key) + case "vaultName": + err = unpopulate(val, &a.VaultName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupJobResourceList. +func (a AzureBackupJobResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// GetBackupParameters implements the BackupParametersClassification interface for type AzureBackupParams. +func (a *AzureBackupParams) GetBackupParameters() *BackupParameters { + return &BackupParameters{ + ObjectType: a.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupParams. +func (a AzureBackupParams) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupType", a.BackupType) + objectMap["objectType"] = "AzureBackupParams" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupParams. +func (a *AzureBackupParams) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "backupType": + err = unpopulate(val, &a.BackupType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAzureBackupRecoveryPoint implements the AzureBackupRecoveryPointClassification interface for type AzureBackupRecoveryPoint. +func (a *AzureBackupRecoveryPoint) GetAzureBackupRecoveryPoint() *AzureBackupRecoveryPoint { return a } + +// GetAzureBackupRecoveryPointBasedRestoreRequest implements the AzureBackupRecoveryPointBasedRestoreRequestClassification +// interface for type AzureBackupRecoveryPointBasedRestoreRequest. +func (a *AzureBackupRecoveryPointBasedRestoreRequest) GetAzureBackupRecoveryPointBasedRestoreRequest() *AzureBackupRecoveryPointBasedRestoreRequest { + return a +} + +// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRecoveryPointBasedRestoreRequest. +func (a *AzureBackupRecoveryPointBasedRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { + return &AzureBackupRestoreRequest{ + ObjectType: a.ObjectType, + RestoreTargetInfo: a.RestoreTargetInfo, + SourceDataStoreType: a.SourceDataStoreType, + SourceResourceID: a.SourceResourceID, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. +func (a AzureBackupRecoveryPointBasedRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AzureBackupRecoveryPointBasedRestoreRequest" + populate(objectMap, "recoveryPointId", a.RecoveryPointID) + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. +func (a *AzureBackupRecoveryPointBasedRestoreRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, &a.RecoveryPointID) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResource. +func (a AzureBackupRecoveryPointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointResource. +func (a *AzureBackupRecoveryPointResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "properties": + a.Properties, err = unmarshalAzureBackupRecoveryPointClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &a.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResourceList. +func (a AzureBackupRecoveryPointResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRecoveryTimeBasedRestoreRequest. +func (a *AzureBackupRecoveryTimeBasedRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { + return &AzureBackupRestoreRequest{ + ObjectType: a.ObjectType, + RestoreTargetInfo: a.RestoreTargetInfo, + SourceDataStoreType: a.SourceDataStoreType, + SourceResourceID: a.SourceResourceID, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. +func (a AzureBackupRecoveryTimeBasedRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AzureBackupRecoveryTimeBasedRestoreRequest" + populate(objectMap, "recoveryPointTime", a.RecoveryPointTime) + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. +func (a *AzureBackupRecoveryTimeBasedRestoreRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulate(val, &a.RecoveryPointTime) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRestoreRequest. +func (a *AzureBackupRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { + return a +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreRequest. +func (a AzureBackupRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = a.ObjectType + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreRequest. +func (a *AzureBackupRestoreRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAzureBackupRecoveryPointBasedRestoreRequest implements the AzureBackupRecoveryPointBasedRestoreRequestClassification +// interface for type AzureBackupRestoreWithRehydrationRequest. +func (a *AzureBackupRestoreWithRehydrationRequest) GetAzureBackupRecoveryPointBasedRestoreRequest() *AzureBackupRecoveryPointBasedRestoreRequest { + return &AzureBackupRecoveryPointBasedRestoreRequest{ + RecoveryPointID: a.RecoveryPointID, + ObjectType: a.ObjectType, + RestoreTargetInfo: a.RestoreTargetInfo, + SourceDataStoreType: a.SourceDataStoreType, + SourceResourceID: a.SourceResourceID, + } +} + +// GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRestoreWithRehydrationRequest. +func (a *AzureBackupRestoreWithRehydrationRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { + return &AzureBackupRestoreRequest{ + ObjectType: a.ObjectType, + RestoreTargetInfo: a.RestoreTargetInfo, + SourceDataStoreType: a.SourceDataStoreType, + SourceResourceID: a.SourceResourceID, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreWithRehydrationRequest. +func (a AzureBackupRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AzureBackupRestoreWithRehydrationRequest" + populate(objectMap, "recoveryPointId", a.RecoveryPointID) + populate(objectMap, "rehydrationPriority", a.RehydrationPriority) + populate(objectMap, "rehydrationRetentionDuration", a.RehydrationRetentionDuration) + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreWithRehydrationRequest. +func (a *AzureBackupRestoreWithRehydrationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, &a.RecoveryPointID) + delete(rawMsg, key) + case "rehydrationPriority": + err = unpopulate(val, &a.RehydrationPriority) + delete(rawMsg, key) + case "rehydrationRetentionDuration": + err = unpopulate(val, &a.RehydrationRetentionDuration) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetBasePolicyRule implements the BasePolicyRuleClassification interface for type AzureBackupRule. +func (a *AzureBackupRule) GetBasePolicyRule() *BasePolicyRule { + return &BasePolicyRule{ + Name: a.Name, + ObjectType: a.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRule. +func (a AzureBackupRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupParameters", a.BackupParameters) + populate(objectMap, "dataStore", a.DataStore) + populate(objectMap, "name", a.Name) + objectMap["objectType"] = "AzureBackupRule" + populate(objectMap, "trigger", a.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRule. +func (a *AzureBackupRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "backupParameters": + a.BackupParameters, err = unmarshalBackupParametersClassification(val) + delete(rawMsg, key) + case "dataStore": + err = unpopulate(val, &a.DataStore) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "trigger": + a.Trigger, err = unmarshalTriggerContextClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetDataStoreParameters implements the DataStoreParametersClassification interface for type AzureOperationalStoreParameters. +func (a *AzureOperationalStoreParameters) GetDataStoreParameters() *DataStoreParameters { + return &DataStoreParameters{ + ObjectType: a.ObjectType, + DataStoreType: a.DataStoreType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureOperationalStoreParameters. +func (a AzureOperationalStoreParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataStoreType", a.DataStoreType) + objectMap["objectType"] = "AzureOperationalStoreParameters" + populate(objectMap, "resourceGroupId", a.ResourceGroupID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureOperationalStoreParameters. +func (a *AzureOperationalStoreParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "dataStoreType": + err = unpopulate(val, &a.DataStoreType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + case "resourceGroupId": + err = unpopulate(val, &a.ResourceGroupID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetBasePolicyRule implements the BasePolicyRuleClassification interface for type AzureRetentionRule. +func (a *AzureRetentionRule) GetBasePolicyRule() *BasePolicyRule { + return &BasePolicyRule{ + Name: a.Name, + ObjectType: a.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureRetentionRule. +func (a AzureRetentionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isDefault", a.IsDefault) + populate(objectMap, "lifecycles", a.Lifecycles) + populate(objectMap, "name", a.Name) + objectMap["objectType"] = "AzureRetentionRule" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureRetentionRule. +func (a *AzureRetentionRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "isDefault": + err = unpopulate(val, &a.IsDefault) + delete(rawMsg, key) + case "lifecycles": + err = unpopulate(val, &a.Lifecycles) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetBackupCriteria implements the BackupCriteriaClassification interface for type BackupCriteria. +func (b *BackupCriteria) GetBackupCriteria() *BackupCriteria { return b } + +// MarshalJSON implements the json.Marshaller interface for type BackupInstance. +func (b BackupInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentProtectionState", b.CurrentProtectionState) + populate(objectMap, "dataSourceInfo", b.DataSourceInfo) + populate(objectMap, "dataSourceSetInfo", b.DataSourceSetInfo) + populate(objectMap, "datasourceAuthCredentials", b.DatasourceAuthCredentials) + populate(objectMap, "friendlyName", b.FriendlyName) + populate(objectMap, "objectType", b.ObjectType) + populate(objectMap, "policyInfo", b.PolicyInfo) + populate(objectMap, "protectionErrorDetails", b.ProtectionErrorDetails) + populate(objectMap, "protectionStatus", b.ProtectionStatus) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "validationType", b.ValidationType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupInstance. +func (b *BackupInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "currentProtectionState": + err = unpopulate(val, &b.CurrentProtectionState) + delete(rawMsg, key) + case "dataSourceInfo": + err = unpopulate(val, &b.DataSourceInfo) + delete(rawMsg, key) + case "dataSourceSetInfo": + err = unpopulate(val, &b.DataSourceSetInfo) + delete(rawMsg, key) + case "datasourceAuthCredentials": + b.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, &b.FriendlyName) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &b.ObjectType) + delete(rawMsg, key) + case "policyInfo": + err = unpopulate(val, &b.PolicyInfo) + delete(rawMsg, key) + case "protectionErrorDetails": + err = unpopulate(val, &b.ProtectionErrorDetails) + delete(rawMsg, key) + case "protectionStatus": + err = unpopulate(val, &b.ProtectionStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &b.ProvisioningState) + delete(rawMsg, key) + case "validationType": + err = unpopulate(val, &b.ValidationType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupInstanceResourceList. +func (b BackupInstanceResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// GetBackupParameters implements the BackupParametersClassification interface for type BackupParameters. +func (b *BackupParameters) GetBackupParameters() *BackupParameters { return b } + +// GetBaseBackupPolicy implements the BaseBackupPolicyClassification interface for type BackupPolicy. +func (b *BackupPolicy) GetBaseBackupPolicy() *BaseBackupPolicy { + return &BaseBackupPolicy{ + DatasourceTypes: b.DatasourceTypes, + ObjectType: b.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type BackupPolicy. +func (b BackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceTypes", b.DatasourceTypes) + objectMap["objectType"] = "BackupPolicy" + populate(objectMap, "policyRules", b.PolicyRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupPolicy. +func (b *BackupPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "datasourceTypes": + err = unpopulate(val, &b.DatasourceTypes) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &b.ObjectType) + delete(rawMsg, key) + case "policyRules": + b.PolicyRules, err = unmarshalBasePolicyRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupSchedule. +func (b BackupSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "repeatingTimeIntervals", b.RepeatingTimeIntervals) + populate(objectMap, "timeZone", b.TimeZone) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVault. +func (b BackupVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "monitoringSettings", b.MonitoringSettings) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "resourceMoveDetails", b.ResourceMoveDetails) + populate(objectMap, "resourceMoveState", b.ResourceMoveState) + populate(objectMap, "storageSettings", b.StorageSettings) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVaultResource. +func (b BackupVaultResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", b.ETag) + populate(objectMap, "id", b.ID) + populate(objectMap, "identity", b.Identity) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVaultResourceList. +func (b BackupVaultResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// GetBaseBackupPolicy implements the BaseBackupPolicyClassification interface for type BaseBackupPolicy. +func (b *BaseBackupPolicy) GetBaseBackupPolicy() *BaseBackupPolicy { return b } + +// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicy. +func (b BaseBackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceTypes", b.DatasourceTypes) + objectMap["objectType"] = b.ObjectType + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResource. +func (b BaseBackupPolicyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseBackupPolicyResource. +func (b *BaseBackupPolicyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &b.Name) + delete(rawMsg, key) + case "properties": + b.Properties, err = unmarshalBaseBackupPolicyClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &b.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResourceList. +func (b BaseBackupPolicyResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// GetBasePolicyRule implements the BasePolicyRuleClassification interface for type BasePolicyRule. +func (b *BasePolicyRule) GetBasePolicyRule() *BasePolicyRule { return b } + +// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForServiceSpecification. +func (c ClientDiscoveryForServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", c.LogSpecifications) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryResponse. +func (c ClientDiscoveryResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// GetCopyOption implements the CopyOptionClassification interface for type CopyOnExpiryOption. +func (c *CopyOnExpiryOption) GetCopyOption() *CopyOption { + return &CopyOption{ + ObjectType: c.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type CopyOnExpiryOption. +func (c CopyOnExpiryOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "CopyOnExpiryOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CopyOnExpiryOption. +func (c *CopyOnExpiryOption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &c.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetCopyOption implements the CopyOptionClassification interface for type CopyOption. +func (c *CopyOption) GetCopyOption() *CopyOption { return c } + +// GetCopyOption implements the CopyOptionClassification interface for type CustomCopyOption. +func (c *CustomCopyOption) GetCopyOption() *CopyOption { + return &CopyOption{ + ObjectType: c.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type CustomCopyOption. +func (c CustomCopyOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "duration", c.Duration) + objectMap["objectType"] = "CustomCopyOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomCopyOption. +func (c *CustomCopyOption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "duration": + err = unpopulate(val, &c.Duration) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &c.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetDataStoreParameters implements the DataStoreParametersClassification interface for type DataStoreParameters. +func (d *DataStoreParameters) GetDataStoreParameters() *DataStoreParameters { return d } + +// GetDeleteOption implements the DeleteOptionClassification interface for type DeleteOption. +func (d *DeleteOption) GetDeleteOption() *DeleteOption { return d } + +// MarshalJSON implements the json.Marshaller interface for type DppBaseResourceList. +func (d DppBaseResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DppTrackedResource. +func (d DppTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", d.ETag) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DppWorkerRequest. +func (d DppWorkerRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cultureInfo", d.CultureInfo) + populate(objectMap, "httpMethod", d.HTTPMethod) + populate(objectMap, "headers", d.Headers) + populate(objectMap, "parameters", d.Parameters) + populate(objectMap, "subscriptionId", d.SubscriptionID) + populate(objectMap, "supportedGroupVersions", d.SupportedGroupVersions) + populate(objectMap, "uri", d.URI) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// GetFeatureValidationRequestBase implements the FeatureValidationRequestBaseClassification interface for type FeatureValidationRequest. +func (f *FeatureValidationRequest) GetFeatureValidationRequestBase() *FeatureValidationRequestBase { + return &FeatureValidationRequestBase{ + ObjectType: f.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type FeatureValidationRequest. +func (f FeatureValidationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "featureName", f.FeatureName) + populate(objectMap, "featureType", f.FeatureType) + objectMap["objectType"] = "FeatureValidationRequest" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationRequest. +func (f *FeatureValidationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "featureName": + err = unpopulate(val, &f.FeatureName) + delete(rawMsg, key) + case "featureType": + err = unpopulate(val, &f.FeatureType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &f.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetFeatureValidationRequestBase implements the FeatureValidationRequestBaseClassification interface for type FeatureValidationRequestBase. +func (f *FeatureValidationRequestBase) GetFeatureValidationRequestBase() *FeatureValidationRequestBase { + return f +} + +// GetFeatureValidationResponseBase implements the FeatureValidationResponseBaseClassification interface for type FeatureValidationResponse. +func (f *FeatureValidationResponse) GetFeatureValidationResponseBase() *FeatureValidationResponseBase { + return &FeatureValidationResponseBase{ + ObjectType: f.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type FeatureValidationResponse. +func (f FeatureValidationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "featureType", f.FeatureType) + populate(objectMap, "features", f.Features) + objectMap["objectType"] = "FeatureValidationResponse" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationResponse. +func (f *FeatureValidationResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "featureType": + err = unpopulate(val, &f.FeatureType) + delete(rawMsg, key) + case "features": + err = unpopulate(val, &f.Features) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &f.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetFeatureValidationResponseBase implements the FeatureValidationResponseBaseClassification interface for type FeatureValidationResponseBase. +func (f *FeatureValidationResponseBase) GetFeatureValidationResponseBase() *FeatureValidationResponseBase { + return f +} + +// GetCopyOption implements the CopyOptionClassification interface for type ImmediateCopyOption. +func (i *ImmediateCopyOption) GetCopyOption() *CopyOption { + return &CopyOption{ + ObjectType: i.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ImmediateCopyOption. +func (i ImmediateCopyOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "ImmediateCopyOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImmediateCopyOption. +func (i *ImmediateCopyOption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &i.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InnerError. +func (i InnerError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", i.AdditionalInfo) + populate(objectMap, "code", i.Code) + populate(objectMap, "embeddedInnerError", i.EmbeddedInnerError) + return json.Marshal(objectMap) +} + +// GetItemLevelRestoreCriteria implements the ItemLevelRestoreCriteriaClassification interface for type ItemLevelRestoreCriteria. +func (i *ItemLevelRestoreCriteria) GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria { return i } + +// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type ItemLevelRestoreTargetInfo. +func (i *ItemLevelRestoreTargetInfo) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { + return &RestoreTargetInfoBase{ + ObjectType: i.ObjectType, + RecoveryOption: i.RecoveryOption, + RestoreLocation: i.RestoreLocation, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ItemLevelRestoreTargetInfo. +func (i ItemLevelRestoreTargetInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceAuthCredentials", i.DatasourceAuthCredentials) + populate(objectMap, "datasourceInfo", i.DatasourceInfo) + populate(objectMap, "datasourceSetInfo", i.DatasourceSetInfo) + objectMap["objectType"] = "ItemLevelRestoreTargetInfo" + populate(objectMap, "recoveryOption", i.RecoveryOption) + populate(objectMap, "restoreCriteria", i.RestoreCriteria) + populate(objectMap, "restoreLocation", i.RestoreLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ItemLevelRestoreTargetInfo. +func (i *ItemLevelRestoreTargetInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "datasourceAuthCredentials": + i.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) + delete(rawMsg, key) + case "datasourceInfo": + err = unpopulate(val, &i.DatasourceInfo) + delete(rawMsg, key) + case "datasourceSetInfo": + err = unpopulate(val, &i.DatasourceSetInfo) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &i.ObjectType) + delete(rawMsg, key) + case "recoveryOption": + err = unpopulate(val, &i.RecoveryOption) + delete(rawMsg, key) + case "restoreCriteria": + i.RestoreCriteria, err = unmarshalItemLevelRestoreCriteriaClassificationArray(val) + delete(rawMsg, key) + case "restoreLocation": + err = unpopulate(val, &i.RestoreLocation) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobExtendedInfo. +func (j JobExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalDetails", j.AdditionalDetails) + populate(objectMap, "backupInstanceState", j.BackupInstanceState) + populate(objectMap, "dataTransferredInBytes", j.DataTransferredInBytes) + populate(objectMap, "recoveryDestination", j.RecoveryDestination) + populate(objectMap, "sourceRecoverPoint", j.SourceRecoverPoint) + populate(objectMap, "subTasks", j.SubTasks) + populate(objectMap, "targetRecoverPoint", j.TargetRecoverPoint) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type JobSubTask. +func (j JobSubTask) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalDetails", j.AdditionalDetails) + populate(objectMap, "taskId", j.TaskID) + populate(objectMap, "taskName", j.TaskName) + populate(objectMap, "taskProgress", j.TaskProgress) + populate(objectMap, "taskStatus", j.TaskStatus) + return json.Marshal(objectMap) +} + +// GetItemLevelRestoreCriteria implements the ItemLevelRestoreCriteriaClassification interface for type KubernetesPVRestoreCriteria. +func (k *KubernetesPVRestoreCriteria) GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria { + return &ItemLevelRestoreCriteria{ + ObjectType: k.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesPVRestoreCriteria. +func (k KubernetesPVRestoreCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", k.Name) + objectMap["objectType"] = "KubernetesPVRestoreCriteria" + populate(objectMap, "storageClassName", k.StorageClassName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesPVRestoreCriteria. +func (k *KubernetesPVRestoreCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, &k.Name) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &k.ObjectType) + delete(rawMsg, key) + case "storageClassName": + err = unpopulate(val, &k.StorageClassName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetItemLevelRestoreCriteria implements the ItemLevelRestoreCriteriaClassification interface for type KubernetesStorageClassRestoreCriteria. +func (k *KubernetesStorageClassRestoreCriteria) GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria { + return &ItemLevelRestoreCriteria{ + ObjectType: k.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesStorageClassRestoreCriteria. +func (k KubernetesStorageClassRestoreCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "KubernetesStorageClassRestoreCriteria" + populate(objectMap, "provisioner", k.Provisioner) + populate(objectMap, "selectedStorageClassName", k.SelectedStorageClassName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesStorageClassRestoreCriteria. +func (k *KubernetesStorageClassRestoreCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &k.ObjectType) + delete(rawMsg, key) + case "provisioner": + err = unpopulate(val, &k.Provisioner) + delete(rawMsg, key) + case "selectedStorageClassName": + err = unpopulate(val, &k.SelectedStorageClassName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetOperationExtendedInfo implements the OperationExtendedInfoClassification interface for type OperationExtendedInfo. +func (o *OperationExtendedInfo) GetOperationExtendedInfo() *OperationExtendedInfo { return o } + +// GetOperationExtendedInfo implements the OperationExtendedInfoClassification interface for type OperationJobExtendedInfo. +func (o *OperationJobExtendedInfo) GetOperationExtendedInfo() *OperationExtendedInfo { + return &OperationExtendedInfo{ + ObjectType: o.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type OperationJobExtendedInfo. +func (o OperationJobExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "jobId", o.JobID) + objectMap["objectType"] = "OperationJobExtendedInfo" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationJobExtendedInfo. +func (o *OperationJobExtendedInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "jobId": + err = unpopulate(val, &o.JobID) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &o.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResource. +func (o OperationResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResource. +func (o *OperationResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &o.Name) + delete(rawMsg, key) + case "properties": + o.Properties, err = unmarshalOperationExtendedInfoClassification(val) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, &o.Status) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchResourceRequestInput. +func (p PatchResourceRequestInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyParameters. +func (p PolicyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataStoreParametersList", p.DataStoreParametersList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyParameters. +func (p *PolicyParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "dataStoreParametersList": + p.DataStoreParametersList, err = unmarshalDataStoreParametersClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetItemLevelRestoreCriteria implements the ItemLevelRestoreCriteriaClassification interface for type RangeBasedItemLevelRestoreCriteria. +func (r *RangeBasedItemLevelRestoreCriteria) GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria { + return &ItemLevelRestoreCriteria{ + ObjectType: r.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type RangeBasedItemLevelRestoreCriteria. +func (r RangeBasedItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maxMatchingValue", r.MaxMatchingValue) + populate(objectMap, "minMatchingValue", r.MinMatchingValue) + objectMap["objectType"] = "RangeBasedItemLevelRestoreCriteria" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RangeBasedItemLevelRestoreCriteria. +func (r *RangeBasedItemLevelRestoreCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "maxMatchingValue": + err = unpopulate(val, &r.MaxMatchingValue) + delete(rawMsg, key) + case "minMatchingValue": + err = unpopulate(val, &r.MinMatchingValue) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &r.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointDataStoreDetails. +func (r RecoveryPointDataStoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) + populateTimeRFC3339(objectMap, "expiryTime", r.ExpiryTime) + populate(objectMap, "id", r.ID) + populate(objectMap, "metaData", r.MetaData) + populateTimeRFC3339(objectMap, "rehydrationExpiryTime", r.RehydrationExpiryTime) + populate(objectMap, "rehydrationStatus", r.RehydrationStatus) + populate(objectMap, "state", r.State) + populate(objectMap, "type", r.Type) + populate(objectMap, "visible", r.Visible) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointDataStoreDetails. +func (r *RecoveryPointDataStoreDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "creationTime": + err = unpopulateTimeRFC3339(val, &r.CreationTime) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateTimeRFC3339(val, &r.ExpiryTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, &r.ID) + delete(rawMsg, key) + case "metaData": + err = unpopulate(val, &r.MetaData) + delete(rawMsg, key) + case "rehydrationExpiryTime": + err = unpopulateTimeRFC3339(val, &r.RehydrationExpiryTime) + delete(rawMsg, key) + case "rehydrationStatus": + err = unpopulate(val, &r.RehydrationStatus) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &r.State) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &r.Type) + delete(rawMsg, key) + case "visible": + err = unpopulate(val, &r.Visible) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceGuard. +func (r ResourceGuard) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowAutoApprovals", r.AllowAutoApprovals) + populate(objectMap, "description", r.Description) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "resourceGuardOperations", r.ResourceGuardOperations) + populate(objectMap, "vaultCriticalOperationExclusionList", r.VaultCriticalOperationExclusionList) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceGuardResource. +func (r ResourceGuardResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", r.ETag) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceGuardResourceList. +func (r ResourceGuardResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type RestoreFilesTargetInfo. +func (r *RestoreFilesTargetInfo) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { + return &RestoreTargetInfoBase{ + ObjectType: r.ObjectType, + RecoveryOption: r.RecoveryOption, + RestoreLocation: r.RestoreLocation, + } +} + +// MarshalJSON implements the json.Marshaller interface for type RestoreFilesTargetInfo. +func (r RestoreFilesTargetInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "RestoreFilesTargetInfo" + populate(objectMap, "recoveryOption", r.RecoveryOption) + populate(objectMap, "restoreLocation", r.RestoreLocation) + populate(objectMap, "targetDetails", r.TargetDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreFilesTargetInfo. +func (r *RestoreFilesTargetInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &r.ObjectType) + delete(rawMsg, key) + case "recoveryOption": + err = unpopulate(val, &r.RecoveryOption) + delete(rawMsg, key) + case "restoreLocation": + err = unpopulate(val, &r.RestoreLocation) + delete(rawMsg, key) + case "targetDetails": + err = unpopulate(val, &r.TargetDetails) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestoreJobRecoveryPointDetails. +func (r RestoreJobRecoveryPointDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recoveryPointID", r.RecoveryPointID) + populateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreJobRecoveryPointDetails. +func (r *RestoreJobRecoveryPointDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "recoveryPointID": + err = unpopulate(val, &r.RecoveryPointID) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulateTimeRFC3339(val, &r.RecoveryPointTime) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type RestoreTargetInfo. +func (r *RestoreTargetInfo) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { + return &RestoreTargetInfoBase{ + ObjectType: r.ObjectType, + RecoveryOption: r.RecoveryOption, + RestoreLocation: r.RestoreLocation, + } +} + +// MarshalJSON implements the json.Marshaller interface for type RestoreTargetInfo. +func (r RestoreTargetInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceAuthCredentials", r.DatasourceAuthCredentials) + populate(objectMap, "datasourceInfo", r.DatasourceInfo) + populate(objectMap, "datasourceSetInfo", r.DatasourceSetInfo) + objectMap["objectType"] = "RestoreTargetInfo" + populate(objectMap, "recoveryOption", r.RecoveryOption) + populate(objectMap, "restoreLocation", r.RestoreLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreTargetInfo. +func (r *RestoreTargetInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "datasourceAuthCredentials": + r.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) + delete(rawMsg, key) + case "datasourceInfo": + err = unpopulate(val, &r.DatasourceInfo) + delete(rawMsg, key) + case "datasourceSetInfo": + err = unpopulate(val, &r.DatasourceSetInfo) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &r.ObjectType) + delete(rawMsg, key) + case "recoveryOption": + err = unpopulate(val, &r.RecoveryOption) + delete(rawMsg, key) + case "restoreLocation": + err = unpopulate(val, &r.RestoreLocation) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetRestoreTargetInfoBase implements the RestoreTargetInfoBaseClassification interface for type RestoreTargetInfoBase. +func (r *RestoreTargetInfoBase) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { return r } + +// GetBackupCriteria implements the BackupCriteriaClassification interface for type ScheduleBasedBackupCriteria. +func (s *ScheduleBasedBackupCriteria) GetBackupCriteria() *BackupCriteria { + return &BackupCriteria{ + ObjectType: s.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduleBasedBackupCriteria. +func (s ScheduleBasedBackupCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "absoluteCriteria", s.AbsoluteCriteria) + populate(objectMap, "daysOfMonth", s.DaysOfMonth) + populate(objectMap, "daysOfTheWeek", s.DaysOfTheWeek) + populate(objectMap, "monthsOfYear", s.MonthsOfYear) + objectMap["objectType"] = "ScheduleBasedBackupCriteria" + aux := make([]*timeRFC3339, len(s.ScheduleTimes), len(s.ScheduleTimes)) + for i := 0; i < len(s.ScheduleTimes); i++ { + aux[i] = (*timeRFC3339)(s.ScheduleTimes[i]) + } + populate(objectMap, "scheduleTimes", aux) + populate(objectMap, "weeksOfTheMonth", s.WeeksOfTheMonth) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedBackupCriteria. +func (s *ScheduleBasedBackupCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "absoluteCriteria": + err = unpopulate(val, &s.AbsoluteCriteria) + delete(rawMsg, key) + case "daysOfMonth": + err = unpopulate(val, &s.DaysOfMonth) + delete(rawMsg, key) + case "daysOfTheWeek": + err = unpopulate(val, &s.DaysOfTheWeek) + delete(rawMsg, key) + case "monthsOfYear": + err = unpopulate(val, &s.MonthsOfYear) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, &s.ObjectType) + delete(rawMsg, key) + case "scheduleTimes": + var aux []*timeRFC3339 + err = unpopulate(val, &aux) + for _, au := range aux { + s.ScheduleTimes = append(s.ScheduleTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + case "weeksOfTheMonth": + err = unpopulate(val, &s.WeeksOfTheMonth) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTriggerContext implements the TriggerContextClassification interface for type ScheduleBasedTriggerContext. +func (s *ScheduleBasedTriggerContext) GetTriggerContext() *TriggerContext { + return &TriggerContext{ + ObjectType: s.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduleBasedTriggerContext. +func (s ScheduleBasedTriggerContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "ScheduleBasedTriggerContext" + populate(objectMap, "schedule", s.Schedule) + populate(objectMap, "taggingCriteria", s.TaggingCriteria) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedTriggerContext. +func (s *ScheduleBasedTriggerContext) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &s.ObjectType) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, &s.Schedule) + delete(rawMsg, key) + case "taggingCriteria": + err = unpopulate(val, &s.TaggingCriteria) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetAuthCredentials implements the AuthCredentialsClassification interface for type SecretStoreBasedAuthCredentials. +func (s *SecretStoreBasedAuthCredentials) GetAuthCredentials() *AuthCredentials { + return &AuthCredentials{ + ObjectType: s.ObjectType, + } +} + +// MarshalJSON implements the json.Marshaller interface for type SecretStoreBasedAuthCredentials. +func (s SecretStoreBasedAuthCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "SecretStoreBasedAuthCredentials" + populate(objectMap, "secretStoreResource", s.SecretStoreResource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretStoreBasedAuthCredentials. +func (s *SecretStoreBasedAuthCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, &s.ObjectType) + delete(rawMsg, key) + case "secretStoreResource": + err = unpopulate(val, &s.SecretStoreResource) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceLifeCycle. +func (s SourceLifeCycle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deleteAfter", s.DeleteAfter) + populate(objectMap, "sourceDataStore", s.SourceDataStore) + populate(objectMap, "targetDataStoreCopySettings", s.TargetDataStoreCopySettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceLifeCycle. +func (s *SourceLifeCycle) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "deleteAfter": + s.DeleteAfter, err = unmarshalDeleteOptionClassification(val) + delete(rawMsg, key) + case "sourceDataStore": + err = unpopulate(val, &s.SourceDataStore) + delete(rawMsg, key) + case "targetDataStoreCopySettings": + err = unpopulate(val, &s.TargetDataStoreCopySettings) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SupportedFeature. +func (s SupportedFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exposureControlledFeatures", s.ExposureControlledFeatures) + populate(objectMap, "featureName", s.FeatureName) + populate(objectMap, "supportStatus", s.SupportStatus) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TaggingCriteria. +func (t TaggingCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "criteria", t.Criteria) + populate(objectMap, "isDefault", t.IsDefault) + populate(objectMap, "tagInfo", t.TagInfo) + populate(objectMap, "taggingPriority", t.TaggingPriority) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaggingCriteria. +func (t *TaggingCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "criteria": + t.Criteria, err = unmarshalBackupCriteriaClassificationArray(val) + delete(rawMsg, key) + case "isDefault": + err = unpopulate(val, &t.IsDefault) + delete(rawMsg, key) + case "tagInfo": + err = unpopulate(val, &t.TagInfo) + delete(rawMsg, key) + case "taggingPriority": + err = unpopulate(val, &t.TaggingPriority) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TargetCopySetting. +func (t TargetCopySetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "copyAfter", t.CopyAfter) + populate(objectMap, "dataStore", t.DataStore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetCopySetting. +func (t *TargetCopySetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "copyAfter": + t.CopyAfter, err = unmarshalCopyOptionClassification(val) + delete(rawMsg, key) + case "dataStore": + err = unpopulate(val, &t.DataStore) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// GetTriggerContext implements the TriggerContextClassification interface for type TriggerContext. +func (t *TriggerContext) GetTriggerContext() *TriggerContext { return t } + +// MarshalJSON implements the json.Marshaller interface for type UserFacingError. +func (u UserFacingError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", u.Code) + populate(objectMap, "details", u.Details) + populate(objectMap, "innerError", u.InnerError) + populate(objectMap, "isRetryable", u.IsRetryable) + populate(objectMap, "isUserError", u.IsUserError) + populate(objectMap, "message", u.Message) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "recommendedAction", u.RecommendedAction) + populate(objectMap, "target", u.Target) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ValidateRestoreRequestObject. +func (v ValidateRestoreRequestObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "restoreRequestObject", v.RestoreRequestObject) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateRestoreRequestObject. +func (v *ValidateRestoreRequestObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "restoreRequestObject": + v.RestoreRequestObject, err = unmarshalAzureBackupRestoreRequestClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationresult_client.go index b1f572fee9d4..603d2729a82c 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationresult_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -34,20 +35,24 @@ type OperationResultClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationResultClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationResultClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets the operation result for a resource @@ -88,7 +93,7 @@ func (client *OperationResultClient) getCreateRequest(ctx context.Context, opera return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -96,7 +101,7 @@ func (client *OperationResultClient) getCreateRequest(ctx context.Context, opera // getHandleResponse handles the Get response. func (client *OperationResultClient) getHandleResponse(resp *http.Response) (OperationResultClientGetResponse, error) { - result := OperationResultClientGetResponse{RawResponse: resp} + result := OperationResultClientGetResponse{} if val := resp.Header.Get("Location"); val != "" { result.Location = &val } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operations_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operations_client.go index ba4ec6addcda..315a22139a24 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operations_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operations_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -28,34 +29,54 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // List - Returns the list of available operations. // If the operation fails it returns an *azcore.ResponseError type. // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(options *OperationsClientListOptions) *OperationsClientListPager { - return &OperationsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) +func (client *OperationsClient) List(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp OperationsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ClientDiscoveryResponse.NextLink) + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -66,7 +87,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -74,7 +95,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{RawResponse: resp} + result := OperationsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ClientDiscoveryResponse); err != nil { return OperationsClientListResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatus_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatus_client.go index a8e72c056e70..dd88e30d76cc 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatus_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatus_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type OperationStatusClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationStatusClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &OperationStatusClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets the operation status for a resource. @@ -87,7 +92,7 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -95,7 +100,7 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, locat // getHandleResponse handles the Get response. func (client *OperationStatusClient) getHandleResponse(resp *http.Response) (OperationStatusClientGetResponse, error) { - result := OperationStatusClientGetResponse{RawResponse: resp} + result := OperationStatusClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationResource); err != nil { return OperationStatusClientGetResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusbackupvaultcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusbackupvaultcontext_client.go new file mode 100644 index 000000000000..bc0b92d0ad8d --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusbackupvaultcontext_client.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// 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. + +package armdataprotection + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// OperationStatusBackupVaultContextClient contains the methods for the OperationStatusBackupVaultContext group. +// Don't use this type directly, use NewOperationStatusBackupVaultContextClient() instead. +type OperationStatusBackupVaultContextClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewOperationStatusBackupVaultContextClient creates a new instance of OperationStatusBackupVaultContextClient with the specified values. +// subscriptionID - The subscription Id. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationStatusBackupVaultContextClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusBackupVaultContextClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationStatusBackupVaultContextClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the operation status for an operation over a BackupVault's context. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. +// options - OperationStatusBackupVaultContextClientGetOptions contains the optional parameters for the OperationStatusBackupVaultContextClient.Get +// method. +func (client *OperationStatusBackupVaultContextClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *OperationStatusBackupVaultContextClientGetOptions) (OperationStatusBackupVaultContextClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) + if err != nil { + return OperationStatusBackupVaultContextClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationStatusBackupVaultContextClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationStatusBackupVaultContextClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OperationStatusBackupVaultContextClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *OperationStatusBackupVaultContextClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationStatusBackupVaultContextClient) getHandleResponse(resp *http.Response) (OperationStatusBackupVaultContextClientGetResponse, error) { + result := OperationStatusBackupVaultContextClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationResource); err != nil { + return OperationStatusBackupVaultContextClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusresourcegroupcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusresourcegroupcontext_client.go new file mode 100644 index 000000000000..683afc6e4a3b --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusresourcegroupcontext_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// 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. + +package armdataprotection + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// OperationStatusResourceGroupContextClient contains the methods for the OperationStatusResourceGroupContext group. +// Don't use this type directly, use NewOperationStatusResourceGroupContextClient() instead. +type OperationStatusResourceGroupContextClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewOperationStatusResourceGroupContextClient creates a new instance of OperationStatusResourceGroupContextClient with the specified values. +// subscriptionID - The subscription Id. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationStatusResourceGroupContextClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusResourceGroupContextClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationStatusResourceGroupContextClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the operation status for an operation over a ResourceGroup's context. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group where the backup vault is present. +// options - OperationStatusResourceGroupContextClientGetOptions contains the optional parameters for the OperationStatusResourceGroupContextClient.Get +// method. +func (client *OperationStatusResourceGroupContextClient) Get(ctx context.Context, resourceGroupName string, operationID string, options *OperationStatusResourceGroupContextClientGetOptions) (OperationStatusResourceGroupContextClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, operationID, options) + if err != nil { + return OperationStatusResourceGroupContextClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationStatusResourceGroupContextClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationStatusResourceGroupContextClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OperationStatusResourceGroupContextClient) getCreateRequest(ctx context.Context, resourceGroupName string, operationID string, options *OperationStatusResourceGroupContextClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationStatusResourceGroupContextClient) getHandleResponse(resp *http.Response) (OperationStatusResourceGroupContextClientGetResponse, error) { + result := OperationStatusResourceGroupContextClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationResource); err != nil { + return OperationStatusResourceGroupContextClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pagers.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pagers.go deleted file mode 100644 index 7ca99e79e802..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pagers.go +++ /dev/null @@ -1,827 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// BackupInstancesClientListPager provides operations for iterating over paged responses. -type BackupInstancesClientListPager struct { - client *BackupInstancesClient - current BackupInstancesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, BackupInstancesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *BackupInstancesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *BackupInstancesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.BackupInstanceResourceList.NextLink == nil || len(*p.current.BackupInstanceResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current BackupInstancesClientListResponse page. -func (p *BackupInstancesClientListPager) PageResponse() BackupInstancesClientListResponse { - return p.current -} - -// BackupPoliciesClientListPager provides operations for iterating over paged responses. -type BackupPoliciesClientListPager struct { - client *BackupPoliciesClient - current BackupPoliciesClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, BackupPoliciesClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *BackupPoliciesClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *BackupPoliciesClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.BaseBackupPolicyResourceList.NextLink == nil || len(*p.current.BaseBackupPolicyResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current BackupPoliciesClientListResponse page. -func (p *BackupPoliciesClientListPager) PageResponse() BackupPoliciesClientListResponse { - return p.current -} - -// BackupVaultsClientGetInResourceGroupPager provides operations for iterating over paged responses. -type BackupVaultsClientGetInResourceGroupPager struct { - client *BackupVaultsClient - current BackupVaultsClientGetInResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, BackupVaultsClientGetInResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *BackupVaultsClientGetInResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *BackupVaultsClientGetInResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.BackupVaultResourceList.NextLink == nil || len(*p.current.BackupVaultResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getInResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current BackupVaultsClientGetInResourceGroupResponse page. -func (p *BackupVaultsClientGetInResourceGroupPager) PageResponse() BackupVaultsClientGetInResourceGroupResponse { - return p.current -} - -// BackupVaultsClientGetInSubscriptionPager provides operations for iterating over paged responses. -type BackupVaultsClientGetInSubscriptionPager struct { - client *BackupVaultsClient - current BackupVaultsClientGetInSubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, BackupVaultsClientGetInSubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *BackupVaultsClientGetInSubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *BackupVaultsClientGetInSubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.BackupVaultResourceList.NextLink == nil || len(*p.current.BackupVaultResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getInSubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current BackupVaultsClientGetInSubscriptionResponse page. -func (p *BackupVaultsClientGetInSubscriptionPager) PageResponse() BackupVaultsClientGetInSubscriptionResponse { - return p.current -} - -// JobsClientListPager provides operations for iterating over paged responses. -type JobsClientListPager struct { - client *JobsClient - current JobsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, JobsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *JobsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *JobsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AzureBackupJobResourceList.NextLink == nil || len(*p.current.AzureBackupJobResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current JobsClientListResponse page. -func (p *JobsClientListPager) PageResponse() JobsClientListResponse { - return p.current -} - -// OperationsClientListPager provides operations for iterating over paged responses. -type OperationsClientListPager struct { - client *OperationsClient - current OperationsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, OperationsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *OperationsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *OperationsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ClientDiscoveryResponse.NextLink == nil || len(*p.current.ClientDiscoveryResponse.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current OperationsClientListResponse page. -func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse { - return p.current -} - -// RecoveryPointsClientListPager provides operations for iterating over paged responses. -type RecoveryPointsClientListPager struct { - client *RecoveryPointsClient - current RecoveryPointsClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, RecoveryPointsClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *RecoveryPointsClientListPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *RecoveryPointsClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.AzureBackupRecoveryPointResourceList.NextLink == nil || len(*p.current.AzureBackupRecoveryPointResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current RecoveryPointsClientListResponse page. -func (p *RecoveryPointsClientListPager) PageResponse() RecoveryPointsClientListResponse { - return p.current -} - -// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DppBaseResourceList.NextLink == nil || len(*p.current.DppBaseResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getBackupSecurityPINRequestsObjectsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse page. -func (p *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager) PageResponse() ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse { - return p.current -} - -// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DppBaseResourceList.NextLink == nil || len(*p.current.DppBaseResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getDeleteProtectedItemRequestsObjectsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse page. -func (p *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager) PageResponse() ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse { - return p.current -} - -// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DppBaseResourceList.NextLink == nil || len(*p.current.DppBaseResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getDeleteResourceGuardProxyRequestsObjectsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse page. -func (p *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager) PageResponse() ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse { - return p.current -} - -// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DppBaseResourceList.NextLink == nil || len(*p.current.DppBaseResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getDisableSoftDeleteRequestsObjectsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse page. -func (p *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager) PageResponse() ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse { - return p.current -} - -// ResourceGuardsClientGetResourcesInResourceGroupPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetResourcesInResourceGroupPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetResourcesInResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetResourcesInResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetResourcesInResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetResourcesInResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ResourceGuardResourceList.NextLink == nil || len(*p.current.ResourceGuardResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getResourcesInResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetResourcesInResourceGroupResponse page. -func (p *ResourceGuardsClientGetResourcesInResourceGroupPager) PageResponse() ResourceGuardsClientGetResourcesInResourceGroupResponse { - return p.current -} - -// ResourceGuardsClientGetResourcesInSubscriptionPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetResourcesInSubscriptionPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetResourcesInSubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetResourcesInSubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetResourcesInSubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetResourcesInSubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.ResourceGuardResourceList.NextLink == nil || len(*p.current.ResourceGuardResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getResourcesInSubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetResourcesInSubscriptionResponse page. -func (p *ResourceGuardsClientGetResourcesInSubscriptionPager) PageResponse() ResourceGuardsClientGetResourcesInSubscriptionResponse { - return p.current -} - -// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DppBaseResourceList.NextLink == nil || len(*p.current.DppBaseResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getUpdateProtectedItemRequestsObjectsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse page. -func (p *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager) PageResponse() ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse { - return p.current -} - -// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager provides operations for iterating over paged responses. -type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager struct { - client *ResourceGuardsClient - current ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DppBaseResourceList.NextLink == nil || len(*p.current.DppBaseResourceList.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.getUpdateProtectionPolicyRequestsObjectsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse page. -func (p *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager) PageResponse() ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse { - return p.current -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pollers.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pollers.go deleted file mode 100644 index a819750ccd46..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_pollers.go +++ /dev/null @@ -1,445 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armdataprotection - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// BackupInstancesClientAdhocBackupPoller provides polling facilities until the operation reaches a terminal state. -type BackupInstancesClientAdhocBackupPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupInstancesClientAdhocBackupPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupInstancesClientAdhocBackupPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupInstancesClientAdhocBackupResponse will be returned. -func (p *BackupInstancesClientAdhocBackupPoller) FinalResponse(ctx context.Context) (BackupInstancesClientAdhocBackupResponse, error) { - respType := BackupInstancesClientAdhocBackupResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.OperationJobExtendedInfo) - if err != nil { - return BackupInstancesClientAdhocBackupResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupInstancesClientAdhocBackupPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupInstancesClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type BackupInstancesClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupInstancesClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupInstancesClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupInstancesClientCreateOrUpdateResponse will be returned. -func (p *BackupInstancesClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (BackupInstancesClientCreateOrUpdateResponse, error) { - respType := BackupInstancesClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.BackupInstanceResource) - if err != nil { - return BackupInstancesClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupInstancesClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupInstancesClientDeletePoller provides polling facilities until the operation reaches a terminal state. -type BackupInstancesClientDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupInstancesClientDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupInstancesClientDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupInstancesClientDeleteResponse will be returned. -func (p *BackupInstancesClientDeletePoller) FinalResponse(ctx context.Context) (BackupInstancesClientDeleteResponse, error) { - respType := BackupInstancesClientDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return BackupInstancesClientDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupInstancesClientDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupInstancesClientTriggerRehydratePoller provides polling facilities until the operation reaches a terminal state. -type BackupInstancesClientTriggerRehydratePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupInstancesClientTriggerRehydratePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupInstancesClientTriggerRehydratePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupInstancesClientTriggerRehydrateResponse will be returned. -func (p *BackupInstancesClientTriggerRehydratePoller) FinalResponse(ctx context.Context) (BackupInstancesClientTriggerRehydrateResponse, error) { - respType := BackupInstancesClientTriggerRehydrateResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return BackupInstancesClientTriggerRehydrateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupInstancesClientTriggerRehydratePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupInstancesClientTriggerRestorePoller provides polling facilities until the operation reaches a terminal state. -type BackupInstancesClientTriggerRestorePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupInstancesClientTriggerRestorePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupInstancesClientTriggerRestorePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupInstancesClientTriggerRestoreResponse will be returned. -func (p *BackupInstancesClientTriggerRestorePoller) FinalResponse(ctx context.Context) (BackupInstancesClientTriggerRestoreResponse, error) { - respType := BackupInstancesClientTriggerRestoreResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.OperationJobExtendedInfo) - if err != nil { - return BackupInstancesClientTriggerRestoreResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupInstancesClientTriggerRestorePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupInstancesClientValidateForBackupPoller provides polling facilities until the operation reaches a terminal state. -type BackupInstancesClientValidateForBackupPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupInstancesClientValidateForBackupPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupInstancesClientValidateForBackupPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupInstancesClientValidateForBackupResponse will be returned. -func (p *BackupInstancesClientValidateForBackupPoller) FinalResponse(ctx context.Context) (BackupInstancesClientValidateForBackupResponse, error) { - respType := BackupInstancesClientValidateForBackupResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.OperationJobExtendedInfo) - if err != nil { - return BackupInstancesClientValidateForBackupResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupInstancesClientValidateForBackupPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupInstancesClientValidateForRestorePoller provides polling facilities until the operation reaches a terminal state. -type BackupInstancesClientValidateForRestorePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupInstancesClientValidateForRestorePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupInstancesClientValidateForRestorePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupInstancesClientValidateForRestoreResponse will be returned. -func (p *BackupInstancesClientValidateForRestorePoller) FinalResponse(ctx context.Context) (BackupInstancesClientValidateForRestoreResponse, error) { - respType := BackupInstancesClientValidateForRestoreResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.OperationJobExtendedInfo) - if err != nil { - return BackupInstancesClientValidateForRestoreResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupInstancesClientValidateForRestorePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupVaultsClientCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type BackupVaultsClientCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupVaultsClientCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupVaultsClientCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupVaultsClientCreateOrUpdateResponse will be returned. -func (p *BackupVaultsClientCreateOrUpdatePoller) FinalResponse(ctx context.Context) (BackupVaultsClientCreateOrUpdateResponse, error) { - respType := BackupVaultsClientCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.BackupVaultResource) - if err != nil { - return BackupVaultsClientCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupVaultsClientCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// BackupVaultsClientUpdatePoller provides polling facilities until the operation reaches a terminal state. -type BackupVaultsClientUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *BackupVaultsClientUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *BackupVaultsClientUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final BackupVaultsClientUpdateResponse will be returned. -func (p *BackupVaultsClientUpdatePoller) FinalResponse(ctx context.Context) (BackupVaultsClientUpdateResponse, error) { - respType := BackupVaultsClientUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.BackupVaultResource) - if err != nil { - return BackupVaultsClientUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *BackupVaultsClientUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ExportJobsClientTriggerPoller provides polling facilities until the operation reaches a terminal state. -type ExportJobsClientTriggerPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ExportJobsClientTriggerPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ExportJobsClientTriggerPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ExportJobsClientTriggerResponse will be returned. -func (p *ExportJobsClientTriggerPoller) FinalResponse(ctx context.Context) (ExportJobsClientTriggerResponse, error) { - respType := ExportJobsClientTriggerResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ExportJobsClientTriggerResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ExportJobsClientTriggerPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_polymorphic_helpers.go index 5880142d6189..d1bce9802899 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_polymorphic_helpers.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -285,6 +285,10 @@ func unmarshalItemLevelRestoreCriteriaClassification(rawMsg json.RawMessage) (It } var b ItemLevelRestoreCriteriaClassification switch m["objectType"] { + case "KubernetesPVRestoreCriteria": + b = &KubernetesPVRestoreCriteria{} + case "KubernetesStorageClassRestoreCriteria": + b = &KubernetesStorageClassRestoreCriteria{} case "RangeBasedItemLevelRestoreCriteria": b = &RangeBasedItemLevelRestoreCriteria{} default: diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_recoverypoints_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_recoverypoints_client.go index 0d4e0ef76541..40f96d2d62d7 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_recoverypoints_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_recoverypoints_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,30 +34,34 @@ type RecoveryPointsClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecoveryPointsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &RecoveryPointsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets a Recovery Point using recoveryPointId for a Datasource. // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -func (client *RecoveryPointsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, recoveryPointID, options) +func (client *RecoveryPointsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, recoveryPointID, options) if err != nil { return RecoveryPointsClientGetResponse{}, err } @@ -71,20 +76,20 @@ func (client *RecoveryPointsClient) Get(ctx context.Context, vaultName string, r } // getCreateRequest creates the Get request. -func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { +func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -98,7 +103,7 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, vaultN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -106,7 +111,7 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, vaultN // getHandleResponse handles the Get response. func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (RecoveryPointsClientGetResponse, error) { - result := RecoveryPointsClientGetResponse{RawResponse: resp} + result := RecoveryPointsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupRecoveryPointResource); err != nil { return RecoveryPointsClientGetResponse{}, err } @@ -115,37 +120,53 @@ func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (Reco // List - Returns a list of Recovery Points for a DataSource in a vault. // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.List method. -func (client *RecoveryPointsClient) List(vaultName string, resourceGroupName string, backupInstanceName string, options *RecoveryPointsClientListOptions) *RecoveryPointsClientListPager { - return &RecoveryPointsClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, options) +func (client *RecoveryPointsClient) List(resourceGroupName string, vaultName string, backupInstanceName string, options *RecoveryPointsClientListOptions) *runtime.Pager[RecoveryPointsClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[RecoveryPointsClientListResponse]{ + More: func(page RecoveryPointsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp RecoveryPointsClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.AzureBackupRecoveryPointResourceList.NextLink) + Fetcher: func(ctx context.Context, page *RecoveryPointsClientListResponse) (RecoveryPointsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RecoveryPointsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RecoveryPointsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RecoveryPointsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. -func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, options *RecoveryPointsClientListOptions) (*policy.Request, error) { +func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *RecoveryPointsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -155,7 +176,7 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, vault return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -169,7 +190,7 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, vault // listHandleResponse handles the List response. func (client *RecoveryPointsClient) listHandleResponse(resp *http.Response) (RecoveryPointsClientListResponse, error) { - result := RecoveryPointsClientListResponse{RawResponse: resp} + result := RecoveryPointsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupRecoveryPointResourceList); err != nil { return RecoveryPointsClientListResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_resourceguards_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_resourceguards_client.go index 923aff5638be..ecf3f8420dea 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_resourceguards_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_resourceguards_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,20 +34,24 @@ type ResourceGuardsClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewResourceGuardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceGuardsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewResourceGuardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceGuardsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &ResourceGuardsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Delete - Deletes a ResourceGuard resource from the resource group. @@ -66,7 +71,7 @@ func (client *ResourceGuardsClient) Delete(ctx context.Context, resourceGroupNam if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return ResourceGuardsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return ResourceGuardsClientDeleteResponse{RawResponse: resp}, nil + return ResourceGuardsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -89,7 +94,7 @@ func (client *ResourceGuardsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -135,7 +140,7 @@ func (client *ResourceGuardsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -143,7 +148,7 @@ func (client *ResourceGuardsClient) getCreateRequest(ctx context.Context, resour // getHandleResponse handles the Get response. func (client *ResourceGuardsClient) getHandleResponse(resp *http.Response) (ResourceGuardsClientGetResponse, error) { - result := ResourceGuardsClientGetResponse{RawResponse: resp} + result := ResourceGuardsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardResource); err != nil { return ResourceGuardsClientGetResponse{}, err } @@ -156,16 +161,32 @@ func (client *ResourceGuardsClient) getHandleResponse(resp *http.Response) (Reso // resourceGroupName - The name of the resource group where the backup vault is present. // options - ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetBackupSecurityPINRequestsObjects // method. -func (client *ResourceGuardsClient) GetBackupSecurityPINRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions) *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager { - return &ResourceGuardsClientGetBackupSecurityPINRequestsObjectsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getBackupSecurityPINRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) +func (client *ResourceGuardsClient) GetBackupSecurityPINRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse]{ + More: func(page ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DppBaseResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse) (ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getBackupSecurityPINRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.getBackupSecurityPINRequestsObjectsHandleResponse(resp) }, - } + }) } // getBackupSecurityPINRequestsObjectsCreateRequest creates the GetBackupSecurityPINRequestsObjects request. @@ -188,7 +209,7 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -196,7 +217,7 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsCreateReq // getBackupSecurityPINRequestsObjectsHandleResponse handles the GetBackupSecurityPINRequestsObjects response. func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsHandleResponse(resp *http.Response) (ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse, error) { - result := ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse{RawResponse: resp} + result := ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResourceList); err != nil { return ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse{}, err } @@ -248,7 +269,7 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -256,7 +277,7 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectCre // getDefaultBackupSecurityPINRequestsObjectHandleResponse handles the GetDefaultBackupSecurityPINRequestsObject response. func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectHandleResponse(resp *http.Response) (ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse, error) { - result := ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse{RawResponse: resp} + result := ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResource); err != nil { return ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse{}, err } @@ -308,7 +329,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -316,7 +337,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectC // getDefaultDeleteProtectedItemRequestsObjectHandleResponse handles the GetDefaultDeleteProtectedItemRequestsObject response. func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectHandleResponse(resp *http.Response) (ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse, error) { - result := ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse{RawResponse: resp} + result := ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResource); err != nil { return ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse{}, err } @@ -368,7 +389,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -376,7 +397,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb // getDefaultDeleteResourceGuardProxyRequestsObjectHandleResponse handles the GetDefaultDeleteResourceGuardProxyRequestsObject response. func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsObjectHandleResponse(resp *http.Response) (ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse, error) { - result := ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse{RawResponse: resp} + result := ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResource); err != nil { return ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse{}, err } @@ -428,7 +449,7 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -436,7 +457,7 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectCre // getDefaultDisableSoftDeleteRequestsObjectHandleResponse handles the GetDefaultDisableSoftDeleteRequestsObject response. func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectHandleResponse(resp *http.Response) (ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse, error) { - result := ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse{RawResponse: resp} + result := ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResource); err != nil { return ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse{}, err } @@ -488,7 +509,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -496,7 +517,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectC // getDefaultUpdateProtectedItemRequestsObjectHandleResponse handles the GetDefaultUpdateProtectedItemRequestsObject response. func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectHandleResponse(resp *http.Response) (ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse, error) { - result := ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse{RawResponse: resp} + result := ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResource); err != nil { return ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse{}, err } @@ -548,7 +569,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -556,7 +577,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje // getDefaultUpdateProtectionPolicyRequestsObjectHandleResponse handles the GetDefaultUpdateProtectionPolicyRequestsObject response. func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObjectHandleResponse(resp *http.Response) (ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse, error) { - result := ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse{RawResponse: resp} + result := ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResource); err != nil { return ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse{}, err } @@ -569,16 +590,32 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje // resourceGroupName - The name of the resource group where the backup vault is present. // options - ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects // method. -func (client *ResourceGuardsClient) GetDeleteProtectedItemRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions) *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager { - return &ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getDeleteProtectedItemRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) +func (client *ResourceGuardsClient) GetDeleteProtectedItemRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse]{ + More: func(page ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DppBaseResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse) (ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getDeleteProtectedItemRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.getDeleteProtectedItemRequestsObjectsHandleResponse(resp) }, - } + }) } // getDeleteProtectedItemRequestsObjectsCreateRequest creates the GetDeleteProtectedItemRequestsObjects request. @@ -601,7 +638,7 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -609,7 +646,7 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsCreateR // getDeleteProtectedItemRequestsObjectsHandleResponse handles the GetDeleteProtectedItemRequestsObjects response. func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsHandleResponse(resp *http.Response) (ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse, error) { - result := ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse{RawResponse: resp} + result := ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResourceList); err != nil { return ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse{}, err } @@ -622,16 +659,32 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsHandleR // resourceGroupName - The name of the resource group where the backup vault is present. // options - ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the // ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects method. -func (client *ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions) *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager { - return &ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getDeleteResourceGuardProxyRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) +func (client *ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse]{ + More: func(page ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DppBaseResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse) (ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getDeleteResourceGuardProxyRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.getDeleteResourceGuardProxyRequestsObjectsHandleResponse(resp) }, - } + }) } // getDeleteResourceGuardProxyRequestsObjectsCreateRequest creates the GetDeleteResourceGuardProxyRequestsObjects request. @@ -654,7 +707,7 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -662,7 +715,7 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsCr // getDeleteResourceGuardProxyRequestsObjectsHandleResponse handles the GetDeleteResourceGuardProxyRequestsObjects response. func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsHandleResponse(resp *http.Response) (ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse, error) { - result := ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse{RawResponse: resp} + result := ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResourceList); err != nil { return ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse{}, err } @@ -675,16 +728,32 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsHa // resourceGroupName - The name of the resource group where the backup vault is present. // options - ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects // method. -func (client *ResourceGuardsClient) GetDisableSoftDeleteRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions) *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager { - return &ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getDisableSoftDeleteRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) +func (client *ResourceGuardsClient) GetDisableSoftDeleteRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse]{ + More: func(page ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DppBaseResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse) (ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getDisableSoftDeleteRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.getDisableSoftDeleteRequestsObjectsHandleResponse(resp) }, - } + }) } // getDisableSoftDeleteRequestsObjectsCreateRequest creates the GetDisableSoftDeleteRequestsObjects request. @@ -707,7 +776,7 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -715,7 +784,7 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsCreateReq // getDisableSoftDeleteRequestsObjectsHandleResponse handles the GetDisableSoftDeleteRequestsObjects response. func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsHandleResponse(resp *http.Response) (ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse, error) { - result := ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse{RawResponse: resp} + result := ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResourceList); err != nil { return ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse{}, err } @@ -727,16 +796,32 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsHandleRes // resourceGroupName - The name of the resource group where the backup vault is present. // options - ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInResourceGroup // method. -func (client *ResourceGuardsClient) GetResourcesInResourceGroup(resourceGroupName string, options *ResourceGuardsClientGetResourcesInResourceGroupOptions) *ResourceGuardsClientGetResourcesInResourceGroupPager { - return &ResourceGuardsClientGetResourcesInResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getResourcesInResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *ResourceGuardsClient) GetResourcesInResourceGroup(resourceGroupName string, options *ResourceGuardsClientGetResourcesInResourceGroupOptions) *runtime.Pager[ResourceGuardsClientGetResourcesInResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetResourcesInResourceGroupResponse]{ + More: func(page ResourceGuardsClientGetResourcesInResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetResourcesInResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourceGuardResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetResourcesInResourceGroupResponse) (ResourceGuardsClientGetResourcesInResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getResourcesInResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetResourcesInResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetResourcesInResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetResourcesInResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.getResourcesInResourceGroupHandleResponse(resp) }, - } + }) } // getResourcesInResourceGroupCreateRequest creates the GetResourcesInResourceGroup request. @@ -755,7 +840,7 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -763,7 +848,7 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupCreateRequest(ctx // getResourcesInResourceGroupHandleResponse handles the GetResourcesInResourceGroup response. func (client *ResourceGuardsClient) getResourcesInResourceGroupHandleResponse(resp *http.Response) (ResourceGuardsClientGetResourcesInResourceGroupResponse, error) { - result := ResourceGuardsClientGetResourcesInResourceGroupResponse{RawResponse: resp} + result := ResourceGuardsClientGetResourcesInResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardResourceList); err != nil { return ResourceGuardsClientGetResourcesInResourceGroupResponse{}, err } @@ -774,16 +859,32 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupHandleResponse(re // If the operation fails it returns an *azcore.ResponseError type. // options - ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInSubscription // method. -func (client *ResourceGuardsClient) GetResourcesInSubscription(options *ResourceGuardsClientGetResourcesInSubscriptionOptions) *ResourceGuardsClientGetResourcesInSubscriptionPager { - return &ResourceGuardsClientGetResourcesInSubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getResourcesInSubscriptionCreateRequest(ctx, options) +func (client *ResourceGuardsClient) GetResourcesInSubscription(options *ResourceGuardsClientGetResourcesInSubscriptionOptions) *runtime.Pager[ResourceGuardsClientGetResourcesInSubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetResourcesInSubscriptionResponse]{ + More: func(page ResourceGuardsClientGetResourcesInSubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetResourcesInSubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourceGuardResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetResourcesInSubscriptionResponse) (ResourceGuardsClientGetResourcesInSubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getResourcesInSubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetResourcesInSubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetResourcesInSubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetResourcesInSubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.getResourcesInSubscriptionHandleResponse(resp) }, - } + }) } // getResourcesInSubscriptionCreateRequest creates the GetResourcesInSubscription request. @@ -798,7 +899,7 @@ func (client *ResourceGuardsClient) getResourcesInSubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -806,7 +907,7 @@ func (client *ResourceGuardsClient) getResourcesInSubscriptionCreateRequest(ctx // getResourcesInSubscriptionHandleResponse handles the GetResourcesInSubscription response. func (client *ResourceGuardsClient) getResourcesInSubscriptionHandleResponse(resp *http.Response) (ResourceGuardsClientGetResourcesInSubscriptionResponse, error) { - result := ResourceGuardsClientGetResourcesInSubscriptionResponse{RawResponse: resp} + result := ResourceGuardsClientGetResourcesInSubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardResourceList); err != nil { return ResourceGuardsClientGetResourcesInSubscriptionResponse{}, err } @@ -819,16 +920,32 @@ func (client *ResourceGuardsClient) getResourcesInSubscriptionHandleResponse(res // resourceGroupName - The name of the resource group where the backup vault is present. // options - ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects // method. -func (client *ResourceGuardsClient) GetUpdateProtectedItemRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions) *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager { - return &ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getUpdateProtectedItemRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) +func (client *ResourceGuardsClient) GetUpdateProtectedItemRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse]{ + More: func(page ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DppBaseResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse) (ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getUpdateProtectedItemRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.getUpdateProtectedItemRequestsObjectsHandleResponse(resp) }, - } + }) } // getUpdateProtectedItemRequestsObjectsCreateRequest creates the GetUpdateProtectedItemRequestsObjects request. @@ -851,7 +968,7 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -859,7 +976,7 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsCreateR // getUpdateProtectedItemRequestsObjectsHandleResponse handles the GetUpdateProtectedItemRequestsObjects response. func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsHandleResponse(resp *http.Response) (ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse, error) { - result := ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse{RawResponse: resp} + result := ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResourceList); err != nil { return ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse{}, err } @@ -872,16 +989,32 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsHandleR // resourceGroupName - The name of the resource group where the backup vault is present. // options - ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the // ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects method. -func (client *ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions) *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager { - return &ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.getUpdateProtectionPolicyRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) +func (client *ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjects(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse] { + return runtime.NewPager(runtime.PageProcessor[ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse]{ + More: func(page ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DppBaseResourceList.NextLink) + Fetcher: func(ctx context.Context, page *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse) (ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getUpdateProtectionPolicyRequestsObjectsCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.getUpdateProtectionPolicyRequestsObjectsHandleResponse(resp) }, - } + }) } // getUpdateProtectionPolicyRequestsObjectsCreateRequest creates the GetUpdateProtectionPolicyRequestsObjects request. @@ -904,7 +1037,7 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -912,7 +1045,7 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsCrea // getUpdateProtectionPolicyRequestsObjectsHandleResponse handles the GetUpdateProtectionPolicyRequestsObjects response. func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsHandleResponse(resp *http.Response) (ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse, error) { - result := ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse{RawResponse: resp} + result := ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DppBaseResourceList); err != nil { return ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse{}, err } @@ -960,7 +1093,7 @@ func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -968,7 +1101,7 @@ func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, reso // patchHandleResponse handles the Patch response. func (client *ResourceGuardsClient) patchHandleResponse(resp *http.Response) (ResourceGuardsClientPatchResponse, error) { - result := ResourceGuardsClientPatchResponse{RawResponse: resp} + result := ResourceGuardsClientPatchResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardResource); err != nil { return ResourceGuardsClientPatchResponse{}, err } @@ -1016,7 +1149,7 @@ func (client *ResourceGuardsClient) putCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1024,7 +1157,7 @@ func (client *ResourceGuardsClient) putCreateRequest(ctx context.Context, resour // putHandleResponse handles the Put response. func (client *ResourceGuardsClient) putHandleResponse(resp *http.Response) (ResourceGuardsClientPutResponse, error) { - result := ResourceGuardsClientPutResponse{RawResponse: resp} + result := ResourceGuardsClientPutResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardResource); err != nil { return ResourceGuardsClientPutResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_response_types.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_response_types.go index 9c19a3ce02e5..324c093f81d8 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_response_types.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,440 +8,108 @@ package armdataprotection -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - -// BackupInstancesClientAdhocBackupPollerResponse contains the response from method BackupInstancesClient.AdhocBackup. -type BackupInstancesClientAdhocBackupPollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupInstancesClientAdhocBackupPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupInstancesClientAdhocBackupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupInstancesClientAdhocBackupResponse, error) { - respType := BackupInstancesClientAdhocBackupResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationJobExtendedInfo) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a BackupInstancesClientAdhocBackupPollerResponse from the provided client and resume token. -func (l *BackupInstancesClientAdhocBackupPollerResponse) Resume(ctx context.Context, client *BackupInstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupInstancesClient.AdhocBackup", token, client.pl) - if err != nil { - return err - } - poller := &BackupInstancesClientAdhocBackupPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // BackupInstancesClientAdhocBackupResponse contains the response from method BackupInstancesClient.AdhocBackup. type BackupInstancesClientAdhocBackupResponse struct { - BackupInstancesClientAdhocBackupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupInstancesClientAdhocBackupResult contains the result from method BackupInstancesClient.AdhocBackup. -type BackupInstancesClientAdhocBackupResult struct { OperationJobExtendedInfo } -// BackupInstancesClientCreateOrUpdatePollerResponse contains the response from method BackupInstancesClient.CreateOrUpdate. -type BackupInstancesClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupInstancesClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupInstancesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupInstancesClientCreateOrUpdateResponse, error) { - respType := BackupInstancesClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupInstanceResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a BackupInstancesClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *BackupInstancesClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *BackupInstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupInstancesClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &BackupInstancesClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // BackupInstancesClientCreateOrUpdateResponse contains the response from method BackupInstancesClient.CreateOrUpdate. type BackupInstancesClientCreateOrUpdateResponse struct { - BackupInstancesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupInstancesClientCreateOrUpdateResult contains the result from method BackupInstancesClient.CreateOrUpdate. -type BackupInstancesClientCreateOrUpdateResult struct { BackupInstanceResource } -// BackupInstancesClientDeletePollerResponse contains the response from method BackupInstancesClient.Delete. -type BackupInstancesClientDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupInstancesClientDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupInstancesClientDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupInstancesClientDeleteResponse, error) { - respType := BackupInstancesClientDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a BackupInstancesClientDeletePollerResponse from the provided client and resume token. -func (l *BackupInstancesClientDeletePollerResponse) Resume(ctx context.Context, client *BackupInstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupInstancesClient.Delete", token, client.pl) - if err != nil { - return err - } - poller := &BackupInstancesClientDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // BackupInstancesClientDeleteResponse contains the response from method BackupInstancesClient.Delete. type BackupInstancesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } -// BackupInstancesClientGetResponse contains the response from method BackupInstancesClient.Get. -type BackupInstancesClientGetResponse struct { - BackupInstancesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response +// BackupInstancesClientGetBackupInstanceOperationResultResponse contains the response from method BackupInstancesClient.GetBackupInstanceOperationResult. +type BackupInstancesClientGetBackupInstanceOperationResultResponse struct { + BackupInstanceResource } -// BackupInstancesClientGetResult contains the result from method BackupInstancesClient.Get. -type BackupInstancesClientGetResult struct { +// BackupInstancesClientGetResponse contains the response from method BackupInstancesClient.Get. +type BackupInstancesClientGetResponse struct { BackupInstanceResource } // BackupInstancesClientListResponse contains the response from method BackupInstancesClient.List. type BackupInstancesClientListResponse struct { - BackupInstancesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupInstancesClientListResult contains the result from method BackupInstancesClient.List. -type BackupInstancesClientListResult struct { BackupInstanceResourceList } -// BackupInstancesClientTriggerRehydratePollerResponse contains the response from method BackupInstancesClient.TriggerRehydrate. -type BackupInstancesClientTriggerRehydratePollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupInstancesClientTriggerRehydratePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupInstancesClientTriggerRehydratePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupInstancesClientTriggerRehydrateResponse, error) { - respType := BackupInstancesClientTriggerRehydrateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil +// BackupInstancesClientResumeBackupsResponse contains the response from method BackupInstancesClient.ResumeBackups. +type BackupInstancesClientResumeBackupsResponse struct { + // placeholder for future response values } -// Resume rehydrates a BackupInstancesClientTriggerRehydratePollerResponse from the provided client and resume token. -func (l *BackupInstancesClientTriggerRehydratePollerResponse) Resume(ctx context.Context, client *BackupInstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupInstancesClient.TriggerRehydrate", token, client.pl) - if err != nil { - return err - } - poller := &BackupInstancesClientTriggerRehydratePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil +// BackupInstancesClientResumeProtectionResponse contains the response from method BackupInstancesClient.ResumeProtection. +type BackupInstancesClientResumeProtectionResponse struct { + // placeholder for future response values } -// BackupInstancesClientTriggerRehydrateResponse contains the response from method BackupInstancesClient.TriggerRehydrate. -type BackupInstancesClientTriggerRehydrateResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response +// BackupInstancesClientStopProtectionResponse contains the response from method BackupInstancesClient.StopProtection. +type BackupInstancesClientStopProtectionResponse struct { + // placeholder for future response values } -// BackupInstancesClientTriggerRestorePollerResponse contains the response from method BackupInstancesClient.TriggerRestore. -type BackupInstancesClientTriggerRestorePollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupInstancesClientTriggerRestorePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response +// BackupInstancesClientSuspendBackupsResponse contains the response from method BackupInstancesClient.SuspendBackups. +type BackupInstancesClientSuspendBackupsResponse struct { + // placeholder for future response values } -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupInstancesClientTriggerRestorePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupInstancesClientTriggerRestoreResponse, error) { - respType := BackupInstancesClientTriggerRestoreResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationJobExtendedInfo) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil +// BackupInstancesClientSyncBackupInstanceResponse contains the response from method BackupInstancesClient.SyncBackupInstance. +type BackupInstancesClientSyncBackupInstanceResponse struct { + // placeholder for future response values } -// Resume rehydrates a BackupInstancesClientTriggerRestorePollerResponse from the provided client and resume token. -func (l *BackupInstancesClientTriggerRestorePollerResponse) Resume(ctx context.Context, client *BackupInstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupInstancesClient.TriggerRestore", token, client.pl) - if err != nil { - return err - } - poller := &BackupInstancesClientTriggerRestorePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil +// BackupInstancesClientTriggerRehydrateResponse contains the response from method BackupInstancesClient.TriggerRehydrate. +type BackupInstancesClientTriggerRehydrateResponse struct { + // placeholder for future response values } // BackupInstancesClientTriggerRestoreResponse contains the response from method BackupInstancesClient.TriggerRestore. type BackupInstancesClientTriggerRestoreResponse struct { - BackupInstancesClientTriggerRestoreResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupInstancesClientTriggerRestoreResult contains the result from method BackupInstancesClient.TriggerRestore. -type BackupInstancesClientTriggerRestoreResult struct { OperationJobExtendedInfo } -// BackupInstancesClientValidateForBackupPollerResponse contains the response from method BackupInstancesClient.ValidateForBackup. -type BackupInstancesClientValidateForBackupPollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupInstancesClientValidateForBackupPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupInstancesClientValidateForBackupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupInstancesClientValidateForBackupResponse, error) { - respType := BackupInstancesClientValidateForBackupResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationJobExtendedInfo) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a BackupInstancesClientValidateForBackupPollerResponse from the provided client and resume token. -func (l *BackupInstancesClientValidateForBackupPollerResponse) Resume(ctx context.Context, client *BackupInstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupInstancesClient.ValidateForBackup", token, client.pl) - if err != nil { - return err - } - poller := &BackupInstancesClientValidateForBackupPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // BackupInstancesClientValidateForBackupResponse contains the response from method BackupInstancesClient.ValidateForBackup. type BackupInstancesClientValidateForBackupResponse struct { - BackupInstancesClientValidateForBackupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupInstancesClientValidateForBackupResult contains the result from method BackupInstancesClient.ValidateForBackup. -type BackupInstancesClientValidateForBackupResult struct { OperationJobExtendedInfo } -// BackupInstancesClientValidateForRestorePollerResponse contains the response from method BackupInstancesClient.ValidateForRestore. -type BackupInstancesClientValidateForRestorePollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupInstancesClientValidateForRestorePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupInstancesClientValidateForRestorePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupInstancesClientValidateForRestoreResponse, error) { - respType := BackupInstancesClientValidateForRestoreResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationJobExtendedInfo) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a BackupInstancesClientValidateForRestorePollerResponse from the provided client and resume token. -func (l *BackupInstancesClientValidateForRestorePollerResponse) Resume(ctx context.Context, client *BackupInstancesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupInstancesClient.ValidateForRestore", token, client.pl) - if err != nil { - return err - } - poller := &BackupInstancesClientValidateForRestorePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // BackupInstancesClientValidateForRestoreResponse contains the response from method BackupInstancesClient.ValidateForRestore. type BackupInstancesClientValidateForRestoreResponse struct { - BackupInstancesClientValidateForRestoreResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + OperationJobExtendedInfo } -// BackupInstancesClientValidateForRestoreResult contains the result from method BackupInstancesClient.ValidateForRestore. -type BackupInstancesClientValidateForRestoreResult struct { - OperationJobExtendedInfo +// BackupInstancesExtensionRoutingClientListResponse contains the response from method BackupInstancesExtensionRoutingClient.List. +type BackupInstancesExtensionRoutingClientListResponse struct { + BackupInstanceResourceList } // BackupPoliciesClientCreateOrUpdateResponse contains the response from method BackupPoliciesClient.CreateOrUpdate. type BackupPoliciesClientCreateOrUpdateResponse struct { - BackupPoliciesClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupPoliciesClientCreateOrUpdateResult contains the result from method BackupPoliciesClient.CreateOrUpdate. -type BackupPoliciesClientCreateOrUpdateResult struct { BaseBackupPolicyResource } // BackupPoliciesClientDeleteResponse contains the response from method BackupPoliciesClient.Delete. type BackupPoliciesClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // BackupPoliciesClientGetResponse contains the response from method BackupPoliciesClient.Get. type BackupPoliciesClientGetResponse struct { - BackupPoliciesClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupPoliciesClientGetResult contains the result from method BackupPoliciesClient.Get. -type BackupPoliciesClientGetResult struct { BaseBackupPolicyResource } // BackupPoliciesClientListResponse contains the response from method BackupPoliciesClient.List. type BackupPoliciesClientListResponse struct { - BackupPoliciesClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupPoliciesClientListResult contains the result from method BackupPoliciesClient.List. -type BackupPoliciesClientListResult struct { BaseBackupPolicyResourceList } // BackupVaultOperationResultsClientGetResponse contains the response from method BackupVaultOperationResultsClient.Get. type BackupVaultOperationResultsClientGetResponse struct { - BackupVaultOperationResultsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupVaultOperationResultsClientGetResult contains the result from method BackupVaultOperationResultsClient.Get. -type BackupVaultOperationResultsClientGetResult struct { BackupVaultResource // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -455,176 +123,46 @@ type BackupVaultOperationResultsClientGetResult struct { // BackupVaultsClientCheckNameAvailabilityResponse contains the response from method BackupVaultsClient.CheckNameAvailability. type BackupVaultsClientCheckNameAvailabilityResponse struct { - BackupVaultsClientCheckNameAvailabilityResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupVaultsClientCheckNameAvailabilityResult contains the result from method BackupVaultsClient.CheckNameAvailability. -type BackupVaultsClientCheckNameAvailabilityResult struct { CheckNameAvailabilityResult } -// BackupVaultsClientCreateOrUpdatePollerResponse contains the response from method BackupVaultsClient.CreateOrUpdate. -type BackupVaultsClientCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupVaultsClientCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupVaultsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupVaultsClientCreateOrUpdateResponse, error) { - respType := BackupVaultsClientCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupVaultResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a BackupVaultsClientCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *BackupVaultsClientCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *BackupVaultsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupVaultsClient.CreateOrUpdate", token, client.pl) - if err != nil { - return err - } - poller := &BackupVaultsClientCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // BackupVaultsClientCreateOrUpdateResponse contains the response from method BackupVaultsClient.CreateOrUpdate. type BackupVaultsClientCreateOrUpdateResponse struct { - BackupVaultsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupVaultsClientCreateOrUpdateResult contains the result from method BackupVaultsClient.CreateOrUpdate. -type BackupVaultsClientCreateOrUpdateResult struct { BackupVaultResource } // BackupVaultsClientDeleteResponse contains the response from method BackupVaultsClient.Delete. type BackupVaultsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // BackupVaultsClientGetInResourceGroupResponse contains the response from method BackupVaultsClient.GetInResourceGroup. type BackupVaultsClientGetInResourceGroupResponse struct { - BackupVaultsClientGetInResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupVaultsClientGetInResourceGroupResult contains the result from method BackupVaultsClient.GetInResourceGroup. -type BackupVaultsClientGetInResourceGroupResult struct { BackupVaultResourceList } // BackupVaultsClientGetInSubscriptionResponse contains the response from method BackupVaultsClient.GetInSubscription. type BackupVaultsClientGetInSubscriptionResponse struct { - BackupVaultsClientGetInSubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupVaultsClientGetInSubscriptionResult contains the result from method BackupVaultsClient.GetInSubscription. -type BackupVaultsClientGetInSubscriptionResult struct { BackupVaultResourceList } // BackupVaultsClientGetResponse contains the response from method BackupVaultsClient.Get. type BackupVaultsClientGetResponse struct { - BackupVaultsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupVaultsClientGetResult contains the result from method BackupVaultsClient.Get. -type BackupVaultsClientGetResult struct { BackupVaultResource } -// BackupVaultsClientUpdatePollerResponse contains the response from method BackupVaultsClient.Update. -type BackupVaultsClientUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *BackupVaultsClientUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l BackupVaultsClientUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupVaultsClientUpdateResponse, error) { - respType := BackupVaultsClientUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupVaultResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a BackupVaultsClientUpdatePollerResponse from the provided client and resume token. -func (l *BackupVaultsClientUpdatePollerResponse) Resume(ctx context.Context, client *BackupVaultsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("BackupVaultsClient.Update", token, client.pl) - if err != nil { - return err - } - poller := &BackupVaultsClientUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // BackupVaultsClientUpdateResponse contains the response from method BackupVaultsClient.Update. type BackupVaultsClientUpdateResponse struct { - BackupVaultsClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// BackupVaultsClientUpdateResult contains the result from method BackupVaultsClient.Update. -type BackupVaultsClientUpdateResult struct { BackupVaultResource } // ClientCheckFeatureSupportResponse contains the response from method Client.CheckFeatureSupport. type ClientCheckFeatureSupportResponse struct { - ClientCheckFeatureSupportResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientCheckFeatureSupportResult contains the result from method Client.CheckFeatureSupport. -type ClientCheckFeatureSupportResult struct { FeatureValidationResponseBaseClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCheckFeatureSupportResult. -func (c *ClientCheckFeatureSupportResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCheckFeatureSupportResponse. +func (c *ClientCheckFeatureSupportResponse) UnmarshalJSON(data []byte) error { res, err := unmarshalFeatureValidationResponseBaseClassification(data) if err != nil { return err @@ -633,97 +171,28 @@ func (c *ClientCheckFeatureSupportResult) UnmarshalJSON(data []byte) error { return nil } -// ExportJobsClientTriggerPollerResponse contains the response from method ExportJobsClient.Trigger. -type ExportJobsClientTriggerPollerResponse struct { - // Poller contains an initialized poller. - Poller *ExportJobsClientTriggerPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ExportJobsClientTriggerPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExportJobsClientTriggerResponse, error) { - respType := ExportJobsClientTriggerResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ExportJobsClientTriggerPollerResponse from the provided client and resume token. -func (l *ExportJobsClientTriggerPollerResponse) Resume(ctx context.Context, client *ExportJobsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ExportJobsClient.Trigger", token, client.pl) - if err != nil { - return err - } - poller := &ExportJobsClientTriggerPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ExportJobsClientTriggerResponse contains the response from method ExportJobsClient.Trigger. type ExportJobsClientTriggerResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ExportJobsOperationResultClientGetResponse contains the response from method ExportJobsOperationResultClient.Get. type ExportJobsOperationResultClientGetResponse struct { - ExportJobsOperationResultClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ExportJobsOperationResultClientGetResult contains the result from method ExportJobsOperationResultClient.Get. -type ExportJobsOperationResultClientGetResult struct { ExportJobsResult } // JobsClientGetResponse contains the response from method JobsClient.Get. type JobsClientGetResponse struct { - JobsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// JobsClientGetResult contains the result from method JobsClient.Get. -type JobsClientGetResult struct { AzureBackupJobResource } // JobsClientListResponse contains the response from method JobsClient.List. type JobsClientListResponse struct { - JobsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// JobsClientListResult contains the result from method JobsClient.List. -type JobsClientListResult struct { AzureBackupJobResourceList } // OperationResultClientGetResponse contains the response from method OperationResultClient.Get. type OperationResultClientGetResponse struct { - OperationResultClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationResultClientGetResult contains the result from method OperationResultClient.Get. -type OperationResultClientGetResult struct { OperationJobExtendedInfo // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -735,272 +204,127 @@ type OperationResultClientGetResult struct { RetryAfter *int32 } +// OperationStatusBackupVaultContextClientGetResponse contains the response from method OperationStatusBackupVaultContextClient.Get. +type OperationStatusBackupVaultContextClientGetResponse struct { + OperationResource +} + // OperationStatusClientGetResponse contains the response from method OperationStatusClient.Get. type OperationStatusClientGetResponse struct { - OperationStatusClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + OperationResource } -// OperationStatusClientGetResult contains the result from method OperationStatusClient.Get. -type OperationStatusClientGetResult struct { +// OperationStatusResourceGroupContextClientGetResponse contains the response from method OperationStatusResourceGroupContextClient.Get. +type OperationStatusResourceGroupContextClientGetResponse struct { OperationResource } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { - OperationsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// OperationsClientListResult contains the result from method OperationsClient.List. -type OperationsClientListResult struct { ClientDiscoveryResponse } // RecoveryPointsClientGetResponse contains the response from method RecoveryPointsClient.Get. type RecoveryPointsClientGetResponse struct { - RecoveryPointsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RecoveryPointsClientGetResult contains the result from method RecoveryPointsClient.Get. -type RecoveryPointsClientGetResult struct { AzureBackupRecoveryPointResource } // RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.List. type RecoveryPointsClientListResponse struct { - RecoveryPointsClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RecoveryPointsClientListResult contains the result from method RecoveryPointsClient.List. -type RecoveryPointsClientListResult struct { AzureBackupRecoveryPointResourceList } // ResourceGuardsClientDeleteResponse contains the response from method ResourceGuardsClient.Delete. type ResourceGuardsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetBackupSecurityPINRequestsObjects. type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse struct { - ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResult contains the result from method ResourceGuardsClient.GetBackupSecurityPINRequestsObjects. -type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResult struct { DppBaseResourceList } // ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject. type ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse struct { - ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResult contains the result from method ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject. -type ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResult struct { DppBaseResource } // ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject. type ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse struct { - ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResult contains the result from method ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject. -type ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResult struct { DppBaseResource } // ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject. type ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse struct { - ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResult contains the result from method ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject. -type ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResult struct { DppBaseResource } // ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject. type ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse struct { - ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResult contains the result from method ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject. -type ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResult struct { DppBaseResource } // ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject. type ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse struct { - ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResult contains the result from method ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject. -type ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResult struct { DppBaseResource } // ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject. type ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse struct { - ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResult contains the result from method ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject. -type ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResult struct { DppBaseResource } // ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects. type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse struct { - ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResult contains the result from method ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects. -type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResult struct { DppBaseResourceList } // ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects. type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse struct { - ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResult contains the result from method ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects. -type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResult struct { DppBaseResourceList } // ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects. type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse struct { - ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResult contains the result from method ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects. -type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResult struct { DppBaseResourceList } // ResourceGuardsClientGetResourcesInResourceGroupResponse contains the response from method ResourceGuardsClient.GetResourcesInResourceGroup. type ResourceGuardsClientGetResourcesInResourceGroupResponse struct { - ResourceGuardsClientGetResourcesInResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetResourcesInResourceGroupResult contains the result from method ResourceGuardsClient.GetResourcesInResourceGroup. -type ResourceGuardsClientGetResourcesInResourceGroupResult struct { ResourceGuardResourceList } // ResourceGuardsClientGetResourcesInSubscriptionResponse contains the response from method ResourceGuardsClient.GetResourcesInSubscription. type ResourceGuardsClientGetResourcesInSubscriptionResponse struct { - ResourceGuardsClientGetResourcesInSubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetResourcesInSubscriptionResult contains the result from method ResourceGuardsClient.GetResourcesInSubscription. -type ResourceGuardsClientGetResourcesInSubscriptionResult struct { ResourceGuardResourceList } // ResourceGuardsClientGetResponse contains the response from method ResourceGuardsClient.Get. type ResourceGuardsClientGetResponse struct { - ResourceGuardsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetResult contains the result from method ResourceGuardsClient.Get. -type ResourceGuardsClientGetResult struct { ResourceGuardResource } // ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects. type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse struct { - ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResult contains the result from method ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects. -type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResult struct { DppBaseResourceList } // ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects. type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse struct { - ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResult contains the result from method ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects. -type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResult struct { DppBaseResourceList } // ResourceGuardsClientPatchResponse contains the response from method ResourceGuardsClient.Patch. type ResourceGuardsClientPatchResponse struct { - ResourceGuardsClientPatchResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientPatchResult contains the result from method ResourceGuardsClient.Patch. -type ResourceGuardsClientPatchResult struct { ResourceGuardResource } // ResourceGuardsClientPutResponse contains the response from method ResourceGuardsClient.Put. type ResourceGuardsClientPutResponse struct { - ResourceGuardsClientPutResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ResourceGuardsClientPutResult contains the result from method ResourceGuardsClient.Put. -type ResourceGuardsClientPutResult struct { ResourceGuardResource } // RestorableTimeRangesClientFindResponse contains the response from method RestorableTimeRangesClient.Find. type RestorableTimeRangesClientFindResponse struct { - RestorableTimeRangesClientFindResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// RestorableTimeRangesClientFindResult contains the result from method RestorableTimeRangesClient.Find. -type RestorableTimeRangesClientFindResult struct { AzureBackupFindRestorableTimeRangesResponseResource } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_restorabletimeranges_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_restorabletimeranges_client.go index 69bd94e6a977..b9120056d4b1 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_restorabletimeranges_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_restorabletimeranges_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -33,32 +34,36 @@ type RestorableTimeRangesClient struct { // subscriptionID - The subscription Id. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewRestorableTimeRangesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableTimeRangesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewRestorableTimeRangesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RestorableTimeRangesClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err } client := &RestorableTimeRangesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Find - // If the operation fails it returns an *azcore.ResponseError type. -// vaultName - The name of the backup vault. // resourceGroupName - The name of the resource group where the backup vault is present. +// vaultName - The name of the backup vault. // backupInstanceName - The name of the backup instance // parameters - Request body for operation // options - RestorableTimeRangesClientFindOptions contains the optional parameters for the RestorableTimeRangesClient.Find // method. -func (client *RestorableTimeRangesClient) Find(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest, options *RestorableTimeRangesClientFindOptions) (RestorableTimeRangesClientFindResponse, error) { - req, err := client.findCreateRequest(ctx, vaultName, resourceGroupName, backupInstanceName, parameters, options) +func (client *RestorableTimeRangesClient) Find(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest, options *RestorableTimeRangesClientFindOptions) (RestorableTimeRangesClientFindResponse, error) { + req, err := client.findCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return RestorableTimeRangesClientFindResponse{}, err } @@ -73,20 +78,20 @@ func (client *RestorableTimeRangesClient) Find(ctx context.Context, vaultName st } // findCreateRequest creates the Find request. -func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest, options *RestorableTimeRangesClientFindOptions) (*policy.Request, error) { +func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest, options *RestorableTimeRangesClientFindOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if backupInstanceName == "" { return nil, errors.New("parameter backupInstanceName cannot be empty") } @@ -96,7 +101,7 @@ func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-03-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -104,7 +109,7 @@ func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, // findHandleResponse handles the Find response. func (client *RestorableTimeRangesClient) findHandleResponse(resp *http.Response) (RestorableTimeRangesClientFindResponse, error) { - result := RestorableTimeRangesClientFindResponse{RawResponse: resp} + result := RestorableTimeRangesClientFindResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupFindRestorableTimeRangesResponseResource); err != nil { return RestorableTimeRangesClientFindResponse{}, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_time_rfc3339.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_time_rfc3339.go index 75d145a71451..86044538a5d9 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//go:build go1.18 +// +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information.