diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/CHANGELOG.md b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/CHANGELOG.md index 71e2a4a569a3..ea9060f0c5fb 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/CHANGELOG.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/CHANGELOG.md @@ -1,5 +1,641 @@ # Release History +## 5.0.0 (2024-12-17) +### Breaking Changes + +- Type of `AzureWorkloadPointInTimeRecoveryPoint.RecoveryPointTierDetails` has been changed from `[]*RecoveryPointTierInformationV2` to `[]*RecoveryPointTierInformation` +- Type of `AzureWorkloadRecoveryPoint.RecoveryPointTierDetails` has been changed from `[]*RecoveryPointTierInformationV2` to `[]*RecoveryPointTierInformation` +- Type of `AzureWorkloadSAPHanaPointInTimeRecoveryPoint.RecoveryPointTierDetails` has been changed from `[]*RecoveryPointTierInformationV2` to `[]*RecoveryPointTierInformation` +- Type of `AzureWorkloadSAPHanaRecoveryPoint.RecoveryPointTierDetails` has been changed from `[]*RecoveryPointTierInformationV2` to `[]*RecoveryPointTierInformation` +- Type of `AzureWorkloadSQLPointInTimeRecoveryPoint.RecoveryPointTierDetails` has been changed from `[]*RecoveryPointTierInformationV2` to `[]*RecoveryPointTierInformation` +- Type of `AzureWorkloadSQLRecoveryPoint.RecoveryPointTierDetails` has been changed from `[]*RecoveryPointTierInformationV2` to `[]*RecoveryPointTierInformation` +- Type of `IaasVMRecoveryPoint.RecoveryPointTierDetails` has been changed from `[]*RecoveryPointTierInformationV2` to `[]*RecoveryPointTierInformation` +- `DataSourceTypeSAPHanaDBInstance` from enum `DataSourceType` has been removed +- `ProtectedItemStateBackupsSuspended` from enum `ProtectedItemState` has been removed +- `ProtectionStateBackupsSuspended` from enum `ProtectionState` has been removed +- `RecoveryModeRecoveryUsingSnapshot`, `RecoveryModeSnapshotAttach`, `RecoveryModeSnapshotAttachAndRecover` from enum `RecoveryMode` has been removed +- `RestorePointQueryTypeSnapshotCopyOnlyFull`, `RestorePointQueryTypeSnapshotFull` from enum `RestorePointQueryType` has been removed +- `RestorePointTypeSnapshotCopyOnlyFull`, `RestorePointTypeSnapshotFull` from enum `RestorePointType` has been removed +- `WorkloadTypeSAPHanaDBInstance` from enum `WorkloadType` has been removed +- Enum `AcquireStorageAccountLock` has been removed +- Enum `AzureFileShareType` has been removed +- Enum `BackupEngineType` has been removed +- Enum `BackupItemType` has been removed +- Enum `BackupType` has been removed +- Enum `ContainerType` has been removed +- Enum `DataMoveLevel` has been removed +- Enum `DayOfWeek` has been removed +- Enum `DedupState` has been removed +- Enum `EncryptionAtRestType` has been removed +- Enum `EnhancedSecurityState` has been removed +- Enum `FabricName` has been removed +- Enum `HTTPStatusCode` has been removed +- Enum `IAASVMPolicyType` has been removed +- Enum `IaasVMSnapshotConsistencyType` has been removed +- Enum `InfrastructureEncryptionState` has been removed +- Enum `InquiryStatus` has been removed +- Enum `IntentItemType` has been removed +- Enum `LastUpdateStatus` has been removed +- Enum `MonthOfYear` has been removed +- Enum `OperationType` has been removed +- Enum `PolicyType` has been removed +- Enum `PrivateEndpointConnectionStatus` has been removed +- Enum `ProtectableContainerType` has been removed +- Enum `ProtectionIntentItemType` has been removed +- Enum `ProtectionStatus` has been removed +- Enum `ProvisioningState` has been removed +- Enum `RehydrationPriority` has been removed +- Enum `RetentionDurationType` has been removed +- Enum `RetentionScheduleFormat` has been removed +- Enum `ScheduleRunType` has been removed +- Enum `SoftDeleteFeatureState` has been removed +- Enum `SupportStatus` has been removed +- Enum `TargetDiskNetworkAccessOption` has been removed +- Enum `TieringMode` has been removed +- Enum `ValidationStatus` has been removed +- Enum `VaultSubResourceType` has been removed +- Enum `WeekOfMonth` has been removed +- Enum `WorkloadItemType` has been removed +- Enum `XcoolState` has been removed +- Function `*AzureBackupGoalFeatureSupportRequest.GetFeatureSupportRequest` has been removed +- Function `*AzureBackupServerContainer.GetDpmContainer` has been removed +- Function `*AzureBackupServerContainer.GetProtectionContainer` has been removed +- Function `*AzureBackupServerEngine.GetBackupEngineBase` has been removed +- Function `*AzureFileShareBackupRequest.GetBackupRequest` has been removed +- Function `*AzureFileShareProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureFileShareProtectionPolicy.GetProtectionPolicy` has been removed +- Function `*AzureFileShareProvisionILRRequest.GetILRRequest` has been removed +- Function `*AzureIaaSClassicComputeVMContainer.GetIaaSVMContainer` has been removed +- Function `*AzureIaaSClassicComputeVMContainer.GetProtectionContainer` has been removed +- Function `*AzureIaaSClassicComputeVMProtectableItem.GetIaaSVMProtectableItem` has been removed +- Function `*AzureIaaSClassicComputeVMProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureIaaSComputeVMContainer.GetIaaSVMContainer` has been removed +- Function `*AzureIaaSComputeVMContainer.GetProtectionContainer` has been removed +- Function `*AzureIaaSComputeVMProtectableItem.GetIaaSVMProtectableItem` has been removed +- Function `*AzureIaaSComputeVMProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureIaaSVMJobV2.GetJob` has been removed +- Function `*AzureIaaSVMProtectionPolicy.GetProtectionPolicy` has been removed +- Function `*AzureRecoveryServiceVaultProtectionIntent.GetAzureRecoveryServiceVaultProtectionIntent` has been removed +- Function `*AzureRecoveryServiceVaultProtectionIntent.GetProtectionIntent` has been removed +- Function `*AzureResourceProtectionIntent.GetProtectionIntent` has been removed +- Function `*AzureSQLAGWorkloadContainerProtectionContainer.GetAzureWorkloadContainer` has been removed +- Function `*AzureSQLAGWorkloadContainerProtectionContainer.GetProtectionContainer` has been removed +- Function `*AzureSQLContainer.GetProtectionContainer` has been removed +- Function `*AzureSQLProtectionPolicy.GetProtectionPolicy` has been removed +- Function `*AzureStorageContainer.GetProtectionContainer` has been removed +- Function `*AzureStorageProtectableContainer.GetProtectableContainer` has been removed +- Function `*AzureVMAppContainerProtectableContainer.GetProtectableContainer` has been removed +- Function `*AzureVMAppContainerProtectionContainer.GetAzureWorkloadContainer` has been removed +- Function `*AzureVMAppContainerProtectionContainer.GetProtectionContainer` has been removed +- Function `*AzureVMResourceFeatureSupportRequest.GetFeatureSupportRequest` has been removed +- Function `*AzureVMWorkloadItem.GetAzureVMWorkloadItem` has been removed +- Function `*AzureVMWorkloadItem.GetWorkloadItem` has been removed +- Function `*AzureVMWorkloadProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadProtectionPolicy.GetProtectionPolicy` has been removed +- Function `*AzureVMWorkloadSAPAseDatabaseWorkloadItem.GetAzureVMWorkloadItem` has been removed +- Function `*AzureVMWorkloadSAPAseDatabaseWorkloadItem.GetWorkloadItem` has been removed +- Function `*AzureVMWorkloadSAPAseSystemProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPAseSystemProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPAseSystemWorkloadItem.GetAzureVMWorkloadItem` has been removed +- Function `*AzureVMWorkloadSAPAseSystemWorkloadItem.GetWorkloadItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDBInstance.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDBInstance.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDBInstanceProtectedItem.GetAzureVMWorkloadProtectedItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDBInstanceProtectedItem.GetProtectedItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDatabaseProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDatabaseProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDatabaseWorkloadItem.GetAzureVMWorkloadItem` has been removed +- Function `*AzureVMWorkloadSAPHanaDatabaseWorkloadItem.GetWorkloadItem` has been removed +- Function `*AzureVMWorkloadSAPHanaHSRProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaHSRProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaSystemProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaSystemProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSAPHanaSystemWorkloadItem.GetAzureVMWorkloadItem` has been removed +- Function `*AzureVMWorkloadSAPHanaSystemWorkloadItem.GetWorkloadItem` has been removed +- Function `*AzureVMWorkloadSQLAvailabilityGroupProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSQLAvailabilityGroupProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSQLDatabaseProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSQLDatabaseProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSQLDatabaseWorkloadItem.GetAzureVMWorkloadItem` has been removed +- Function `*AzureVMWorkloadSQLDatabaseWorkloadItem.GetWorkloadItem` has been removed +- Function `*AzureVMWorkloadSQLInstanceProtectableItem.GetAzureVMWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSQLInstanceProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*AzureVMWorkloadSQLInstanceWorkloadItem.GetAzureVMWorkloadItem` has been removed +- Function `*AzureVMWorkloadSQLInstanceWorkloadItem.GetWorkloadItem` has been removed +- Function `*AzureWorkloadAutoProtectionIntent.GetAzureRecoveryServiceVaultProtectionIntent` has been removed +- Function `*AzureWorkloadAutoProtectionIntent.GetAzureWorkloadAutoProtectionIntent` has been removed +- Function `*AzureWorkloadAutoProtectionIntent.GetProtectionIntent` has been removed +- Function `*AzureWorkloadBackupRequest.GetBackupRequest` has been removed +- Function `*AzureWorkloadContainer.GetAzureWorkloadContainer` has been removed +- Function `*AzureWorkloadContainer.GetProtectionContainer` has been removed +- Function `*AzureWorkloadContainerAutoProtectionIntent.GetProtectionIntent` has been removed +- Function `*AzureWorkloadSAPHanaPointInTimeRestoreRequest.GetAzureWorkloadSAPHanaPointInTimeRestoreRequest` has been removed +- Function `*AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest.GetAzureWorkloadRestoreRequest` has been removed +- Function `*AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest.GetAzureWorkloadSAPHanaPointInTimeRestoreRequest` has been removed +- Function `*AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest.GetAzureWorkloadSAPHanaRestoreRequest` has been removed +- Function `*AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest.GetRestoreRequest` has been removed +- Function `*AzureWorkloadSAPHanaRestoreWithRehydrateRequest.GetAzureWorkloadRestoreRequest` has been removed +- Function `*AzureWorkloadSAPHanaRestoreWithRehydrateRequest.GetAzureWorkloadSAPHanaRestoreRequest` has been removed +- Function `*AzureWorkloadSAPHanaRestoreWithRehydrateRequest.GetRestoreRequest` has been removed +- Function `*AzureWorkloadSQLAutoProtectionIntent.GetAzureRecoveryServiceVaultProtectionIntent` has been removed +- Function `*AzureWorkloadSQLAutoProtectionIntent.GetAzureWorkloadAutoProtectionIntent` has been removed +- Function `*AzureWorkloadSQLAutoProtectionIntent.GetProtectionIntent` has been removed +- Function `*AzureWorkloadSQLPointInTimeRestoreRequest.GetAzureWorkloadSQLPointInTimeRestoreRequest` has been removed +- Function `*AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest.GetAzureWorkloadRestoreRequest` has been removed +- Function `*AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest.GetAzureWorkloadSQLPointInTimeRestoreRequest` has been removed +- Function `*AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest.GetAzureWorkloadSQLRestoreRequest` has been removed +- Function `*AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest.GetRestoreRequest` has been removed +- Function `*AzureWorkloadSQLRestoreWithRehydrateRequest.GetAzureWorkloadRestoreRequest` has been removed +- Function `*AzureWorkloadSQLRestoreWithRehydrateRequest.GetAzureWorkloadSQLRestoreRequest` has been removed +- Function `*AzureWorkloadSQLRestoreWithRehydrateRequest.GetRestoreRequest` has been removed +- Function `NewBMSPrepareDataMoveOperationResultClient` has been removed +- Function `*BMSPrepareDataMoveOperationResultClient.Get` has been removed +- Function `*BackupEngineBase.GetBackupEngineBase` has been removed +- Function `NewBackupEnginesClient` has been removed +- Function `*BackupEnginesClient.Get` has been removed +- Function `*BackupEnginesClient.NewListPager` has been removed +- Function `NewBackupJobsClient` has been removed +- Function `*BackupJobsClient.NewListPager` has been removed +- Function `NewBackupOperationResultsClient` has been removed +- Function `*BackupOperationResultsClient.Get` has been removed +- Function `NewBackupOperationStatusesClient` has been removed +- Function `*BackupOperationStatusesClient.Get` has been removed +- Function `NewBackupPoliciesClient` has been removed +- Function `*BackupPoliciesClient.NewListPager` has been removed +- Function `NewBackupProtectableItemsClient` has been removed +- Function `*BackupProtectableItemsClient.NewListPager` has been removed +- Function `NewBackupProtectedItemsClient` has been removed +- Function `*BackupProtectedItemsClient.NewListPager` has been removed +- Function `NewBackupProtectionContainersClient` has been removed +- Function `*BackupProtectionContainersClient.NewListPager` has been removed +- Function `NewBackupProtectionIntentClient` has been removed +- Function `*BackupProtectionIntentClient.NewListPager` has been removed +- Function `*BackupRequest.GetBackupRequest` has been removed +- Function `NewBackupResourceEncryptionConfigsClient` has been removed +- Function `*BackupResourceEncryptionConfigsClient.Get` has been removed +- Function `*BackupResourceEncryptionConfigsClient.Update` has been removed +- Function `NewBackupResourceStorageConfigsNonCRRClient` has been removed +- Function `*BackupResourceStorageConfigsNonCRRClient.Get` has been removed +- Function `*BackupResourceStorageConfigsNonCRRClient.Patch` has been removed +- Function `*BackupResourceStorageConfigsNonCRRClient.Update` has been removed +- Function `NewBackupResourceVaultConfigsClient` has been removed +- Function `*BackupResourceVaultConfigsClient.Get` has been removed +- Function `*BackupResourceVaultConfigsClient.Put` has been removed +- Function `*BackupResourceVaultConfigsClient.Update` has been removed +- Function `NewBackupStatusClient` has been removed +- Function `*BackupStatusClient.Get` has been removed +- Function `NewBackupUsageSummariesClient` has been removed +- Function `*BackupUsageSummariesClient.NewListPager` has been removed +- Function `NewBackupWorkloadItemsClient` has been removed +- Function `*BackupWorkloadItemsClient.NewListPager` has been removed +- Function `NewBackupsClient` has been removed +- Function `*BackupsClient.Trigger` has been removed +- Function `NewClient` has been removed +- Function `*Client.GetOperationStatus` has been removed +- Function `*Client.BeginBMSPrepareDataMove` has been removed +- Function `*Client.BeginBMSTriggerDataMove` has been removed +- Function `*Client.BeginMoveRecoveryPoint` has been removed +- Function `*ClientFactory.NewBMSPrepareDataMoveOperationResultClient` has been removed +- Function `*ClientFactory.NewBackupEnginesClient` has been removed +- Function `*ClientFactory.NewBackupJobsClient` has been removed +- Function `*ClientFactory.NewBackupOperationResultsClient` has been removed +- Function `*ClientFactory.NewBackupOperationStatusesClient` has been removed +- Function `*ClientFactory.NewBackupPoliciesClient` has been removed +- Function `*ClientFactory.NewBackupProtectableItemsClient` has been removed +- Function `*ClientFactory.NewBackupProtectedItemsClient` has been removed +- Function `*ClientFactory.NewBackupProtectionContainersClient` has been removed +- Function `*ClientFactory.NewBackupProtectionIntentClient` has been removed +- Function `*ClientFactory.NewBackupResourceEncryptionConfigsClient` has been removed +- Function `*ClientFactory.NewBackupResourceStorageConfigsNonCRRClient` has been removed +- Function `*ClientFactory.NewBackupResourceVaultConfigsClient` has been removed +- Function `*ClientFactory.NewBackupStatusClient` has been removed +- Function `*ClientFactory.NewBackupUsageSummariesClient` has been removed +- Function `*ClientFactory.NewBackupWorkloadItemsClient` has been removed +- Function `*ClientFactory.NewBackupsClient` has been removed +- Function `*ClientFactory.NewClient` has been removed +- Function `*ClientFactory.NewDeletedProtectionContainersClient` has been removed +- Function `*ClientFactory.NewExportJobsOperationResultsClient` has been removed +- Function `*ClientFactory.NewFeatureSupportClient` has been removed +- Function `*ClientFactory.NewFetchTieringCostClient` has been removed +- Function `*ClientFactory.NewGetTieringCostOperationResultClient` has been removed +- Function `*ClientFactory.NewItemLevelRecoveryConnectionsClient` has been removed +- Function `*ClientFactory.NewJobCancellationsClient` has been removed +- Function `*ClientFactory.NewJobDetailsClient` has been removed +- Function `*ClientFactory.NewJobOperationResultsClient` has been removed +- Function `*ClientFactory.NewJobsClient` has been removed +- Function `*ClientFactory.NewOperationClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewPrivateEndpointClient` has been removed +- Function `*ClientFactory.NewPrivateEndpointConnectionClient` has been removed +- Function `*ClientFactory.NewProtectableContainersClient` has been removed +- Function `*ClientFactory.NewProtectedItemOperationResultsClient` has been removed +- Function `*ClientFactory.NewProtectedItemOperationStatusesClient` has been removed +- Function `*ClientFactory.NewProtectedItemsClient` has been removed +- Function `*ClientFactory.NewProtectionContainerOperationResultsClient` has been removed +- Function `*ClientFactory.NewProtectionContainerRefreshOperationResultsClient` has been removed +- Function `*ClientFactory.NewProtectionContainersClient` has been removed +- Function `*ClientFactory.NewProtectionIntentClient` has been removed +- Function `*ClientFactory.NewProtectionPoliciesClient` has been removed +- Function `*ClientFactory.NewProtectionPolicyOperationResultsClient` has been removed +- Function `*ClientFactory.NewProtectionPolicyOperationStatusesClient` has been removed +- Function `*ClientFactory.NewRecoveryPointsRecommendedForMoveClient` has been removed +- Function `*ClientFactory.NewResourceGuardProxiesClient` has been removed +- Function `*ClientFactory.NewResourceGuardProxyClient` has been removed +- Function `*ClientFactory.NewRestoresClient` has been removed +- Function `*ClientFactory.NewSecurityPINsClient` has been removed +- Function `*ClientFactory.NewTieringCostOperationStatusClient` has been removed +- Function `*ClientFactory.NewValidateOperationClient` has been removed +- Function `*ClientFactory.NewValidateOperationResultsClient` has been removed +- Function `*ClientFactory.NewValidateOperationStatusesClient` has been removed +- Function `NewDeletedProtectionContainersClient` has been removed +- Function `*DeletedProtectionContainersClient.NewListPager` has been removed +- Function `*DpmBackupEngine.GetBackupEngineBase` has been removed +- Function `*DpmContainer.GetDpmContainer` has been removed +- Function `*DpmContainer.GetProtectionContainer` has been removed +- Function `*ExportJobsOperationResultInfo.GetOperationResultInfoBase` has been removed +- Function `NewExportJobsOperationResultsClient` has been removed +- Function `*ExportJobsOperationResultsClient.Get` has been removed +- Function `NewFeatureSupportClient` has been removed +- Function `*FeatureSupportClient.Validate` has been removed +- Function `*FeatureSupportRequest.GetFeatureSupportRequest` has been removed +- Function `NewFetchTieringCostClient` has been removed +- Function `*FetchTieringCostClient.BeginPost` has been removed +- Function `*FetchTieringCostInfoForRehydrationRequest.GetFetchTieringCostInfoRequest` has been removed +- Function `*FetchTieringCostInfoRequest.GetFetchTieringCostInfoRequest` has been removed +- Function `*FetchTieringCostSavingsInfoForPolicyRequest.GetFetchTieringCostInfoRequest` has been removed +- Function `*FetchTieringCostSavingsInfoForProtectedItemRequest.GetFetchTieringCostInfoRequest` has been removed +- Function `*FetchTieringCostSavingsInfoForVaultRequest.GetFetchTieringCostInfoRequest` has been removed +- Function `*GenericContainer.GetProtectionContainer` has been removed +- Function `*GenericProtectionPolicy.GetProtectionPolicy` has been removed +- Function `NewGetTieringCostOperationResultClient` has been removed +- Function `*GetTieringCostOperationResultClient.Get` has been removed +- Function `*ILRRequest.GetILRRequest` has been removed +- Function `*IaaSVMContainer.GetIaaSVMContainer` has been removed +- Function `*IaaSVMContainer.GetProtectionContainer` has been removed +- Function `*IaaSVMProtectableItem.GetIaaSVMProtectableItem` has been removed +- Function `*IaaSVMProtectableItem.GetWorkloadProtectableItem` has been removed +- Function `*IaasVMBackupRequest.GetBackupRequest` has been removed +- Function `*IaasVMILRRegistrationRequest.GetILRRequest` has been removed +- Function `*IaasVMRestoreRequest.GetIaasVMRestoreRequest` has been removed +- Function `*IaasVMRestoreWithRehydrationRequest.GetIaasVMRestoreRequest` has been removed +- Function `*IaasVMRestoreWithRehydrationRequest.GetRestoreRequest` has been removed +- Function `NewItemLevelRecoveryConnectionsClient` has been removed +- Function `*ItemLevelRecoveryConnectionsClient.Provision` has been removed +- Function `*ItemLevelRecoveryConnectionsClient.Revoke` has been removed +- Function `NewJobCancellationsClient` has been removed +- Function `*JobCancellationsClient.Trigger` has been removed +- Function `NewJobDetailsClient` has been removed +- Function `*JobDetailsClient.Get` has been removed +- Function `NewJobOperationResultsClient` has been removed +- Function `*JobOperationResultsClient.Get` has been removed +- Function `NewJobsClient` has been removed +- Function `*JobsClient.Export` has been removed +- Function `*LogSchedulePolicy.GetSchedulePolicy` has been removed +- Function `*LongTermRetentionPolicy.GetRetentionPolicy` has been removed +- Function `*LongTermSchedulePolicy.GetSchedulePolicy` has been removed +- Function `*MabContainer.GetProtectionContainer` has been removed +- Function `*MabProtectionPolicy.GetProtectionPolicy` has been removed +- Function `NewOperationClient` has been removed +- Function `*OperationClient.Validate` has been removed +- Function `*OperationResultInfo.GetOperationResultInfoBase` has been removed +- Function `*OperationResultInfoBase.GetOperationResultInfoBase` has been removed +- Function `*OperationStatusValidateOperationExtendedInfo.GetOperationStatusExtendedInfo` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `*PrepareDataMoveResponse.GetVaultStorageConfigOperationResultResponse` has been removed +- Function `NewPrivateEndpointClient` has been removed +- Function `*PrivateEndpointClient.GetOperationStatus` has been removed +- Function `NewPrivateEndpointConnectionClient` has been removed +- Function `*PrivateEndpointConnectionClient.BeginDelete` has been removed +- Function `*PrivateEndpointConnectionClient.Get` has been removed +- Function `*PrivateEndpointConnectionClient.BeginPut` has been removed +- Function `*ProtectableContainer.GetProtectableContainer` has been removed +- Function `NewProtectableContainersClient` has been removed +- Function `*ProtectableContainersClient.NewListPager` has been removed +- Function `NewProtectedItemOperationResultsClient` has been removed +- Function `*ProtectedItemOperationResultsClient.Get` has been removed +- Function `NewProtectedItemOperationStatusesClient` has been removed +- Function `*ProtectedItemOperationStatusesClient.Get` has been removed +- Function `NewProtectedItemsClient` has been removed +- Function `*ProtectedItemsClient.CreateOrUpdate` has been removed +- Function `*ProtectedItemsClient.Delete` has been removed +- Function `*ProtectedItemsClient.Get` has been removed +- Function `*ProtectionContainer.GetProtectionContainer` has been removed +- Function `NewProtectionContainerOperationResultsClient` has been removed +- Function `*ProtectionContainerOperationResultsClient.Get` has been removed +- Function `NewProtectionContainerRefreshOperationResultsClient` has been removed +- Function `*ProtectionContainerRefreshOperationResultsClient.Get` has been removed +- Function `NewProtectionContainersClient` has been removed +- Function `*ProtectionContainersClient.Get` has been removed +- Function `*ProtectionContainersClient.Inquire` has been removed +- Function `*ProtectionContainersClient.Refresh` has been removed +- Function `*ProtectionContainersClient.BeginRegister` has been removed +- Function `*ProtectionContainersClient.Unregister` has been removed +- Function `*ProtectionIntent.GetProtectionIntent` has been removed +- Function `NewProtectionIntentClient` has been removed +- Function `*ProtectionIntentClient.CreateOrUpdate` has been removed +- Function `*ProtectionIntentClient.Delete` has been removed +- Function `*ProtectionIntentClient.Get` has been removed +- Function `*ProtectionIntentClient.Validate` has been removed +- Function `NewProtectionPoliciesClient` has been removed +- Function `*ProtectionPoliciesClient.CreateOrUpdate` has been removed +- Function `*ProtectionPoliciesClient.BeginDelete` has been removed +- Function `*ProtectionPoliciesClient.Get` has been removed +- Function `*ProtectionPolicy.GetProtectionPolicy` has been removed +- Function `NewProtectionPolicyOperationResultsClient` has been removed +- Function `*ProtectionPolicyOperationResultsClient.Get` has been removed +- Function `NewProtectionPolicyOperationStatusesClient` has been removed +- Function `*ProtectionPolicyOperationStatusesClient.Get` has been removed +- Function `*RecoveryPointsClient.Get` has been removed +- Function `*RecoveryPointsClient.NewListPager` has been removed +- Function `NewRecoveryPointsRecommendedForMoveClient` has been removed +- Function `*RecoveryPointsRecommendedForMoveClient.NewListPager` has been removed +- Function `NewResourceGuardProxiesClient` has been removed +- Function `*ResourceGuardProxiesClient.NewGetPager` has been removed +- Function `NewResourceGuardProxyClient` has been removed +- Function `*ResourceGuardProxyClient.Delete` has been removed +- Function `*ResourceGuardProxyClient.Get` has been removed +- Function `*ResourceGuardProxyClient.Put` has been removed +- Function `*ResourceGuardProxyClient.UnlockDelete` has been removed +- Function `NewRestoresClient` has been removed +- Function `*RestoresClient.BeginTrigger` has been removed +- Function `*RetentionPolicy.GetRetentionPolicy` has been removed +- Function `*SchedulePolicy.GetSchedulePolicy` has been removed +- Function `NewSecurityPINsClient` has been removed +- Function `*SecurityPINsClient.Get` has been removed +- Function `*SimpleRetentionPolicy.GetRetentionPolicy` has been removed +- Function `*SimpleSchedulePolicy.GetSchedulePolicy` has been removed +- Function `*SimpleSchedulePolicyV2.GetSchedulePolicy` has been removed +- Function `*TieringCostInfo.GetTieringCostInfo` has been removed +- Function `NewTieringCostOperationStatusClient` has been removed +- Function `*TieringCostOperationStatusClient.Get` has been removed +- Function `*TieringCostRehydrationInfo.GetTieringCostInfo` has been removed +- Function `*TieringCostSavingInfo.GetTieringCostInfo` has been removed +- Function `*ValidateIaasVMRestoreOperationRequest.GetValidateOperationRequest` has been removed +- Function `*ValidateIaasVMRestoreOperationRequest.GetValidateRestoreOperationRequest` has been removed +- Function `NewValidateOperationClient` has been removed +- Function `*ValidateOperationClient.BeginTrigger` has been removed +- Function `*ValidateOperationRequest.GetValidateOperationRequest` has been removed +- Function `NewValidateOperationResultsClient` has been removed +- Function `*ValidateOperationResultsClient.Get` has been removed +- Function `NewValidateOperationStatusesClient` has been removed +- Function `*ValidateOperationStatusesClient.Get` has been removed +- Function `*ValidateRestoreOperationRequest.GetValidateOperationRequest` has been removed +- Function `*ValidateRestoreOperationRequest.GetValidateRestoreOperationRequest` has been removed +- Function `*VaultJob.GetJob` has been removed +- Function `*VaultStorageConfigOperationResultResponse.GetVaultStorageConfigOperationResultResponse` has been removed +- Function `*WorkloadItem.GetWorkloadItem` has been removed +- Function `*WorkloadProtectableItem.GetWorkloadProtectableItem` has been removed +- Struct `AzureBackupGoalFeatureSupportRequest` has been removed +- Struct `AzureBackupServerContainer` has been removed +- Struct `AzureBackupServerEngine` has been removed +- Struct `AzureFileShareBackupRequest` has been removed +- Struct `AzureFileShareProtectableItem` has been removed +- Struct `AzureFileShareProtectionPolicy` has been removed +- Struct `AzureFileShareProvisionILRRequest` has been removed +- Struct `AzureIaaSClassicComputeVMContainer` has been removed +- Struct `AzureIaaSClassicComputeVMProtectableItem` has been removed +- Struct `AzureIaaSComputeVMContainer` has been removed +- Struct `AzureIaaSComputeVMProtectableItem` has been removed +- Struct `AzureIaaSVMJobV2` has been removed +- Struct `AzureIaaSVMProtectionPolicy` has been removed +- Struct `AzureResourceProtectionIntent` has been removed +- Struct `AzureSQLAGWorkloadContainerProtectionContainer` has been removed +- Struct `AzureSQLContainer` has been removed +- Struct `AzureSQLProtectionPolicy` has been removed +- Struct `AzureStorageContainer` has been removed +- Struct `AzureStorageProtectableContainer` has been removed +- Struct `AzureVMAppContainerProtectableContainer` has been removed +- Struct `AzureVMAppContainerProtectionContainer` has been removed +- Struct `AzureVMResourceFeatureSupportRequest` has been removed +- Struct `AzureVMResourceFeatureSupportResponse` has been removed +- Struct `AzureVMWorkloadProtectionPolicy` has been removed +- Struct `AzureVMWorkloadSAPAseDatabaseWorkloadItem` has been removed +- Struct `AzureVMWorkloadSAPAseSystemProtectableItem` has been removed +- Struct `AzureVMWorkloadSAPAseSystemWorkloadItem` has been removed +- Struct `AzureVMWorkloadSAPHanaDBInstance` has been removed +- Struct `AzureVMWorkloadSAPHanaDBInstanceProtectedItem` has been removed +- Struct `AzureVMWorkloadSAPHanaDatabaseProtectableItem` has been removed +- Struct `AzureVMWorkloadSAPHanaDatabaseWorkloadItem` has been removed +- Struct `AzureVMWorkloadSAPHanaHSRProtectableItem` has been removed +- Struct `AzureVMWorkloadSAPHanaSystemProtectableItem` has been removed +- Struct `AzureVMWorkloadSAPHanaSystemWorkloadItem` has been removed +- Struct `AzureVMWorkloadSQLAvailabilityGroupProtectableItem` has been removed +- Struct `AzureVMWorkloadSQLDatabaseProtectableItem` has been removed +- Struct `AzureVMWorkloadSQLDatabaseWorkloadItem` has been removed +- Struct `AzureVMWorkloadSQLInstanceProtectableItem` has been removed +- Struct `AzureVMWorkloadSQLInstanceWorkloadItem` has been removed +- Struct `AzureWorkloadBackupRequest` has been removed +- Struct `AzureWorkloadContainerAutoProtectionIntent` has been removed +- Struct `AzureWorkloadContainerExtendedInfo` has been removed +- Struct `AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest` has been removed +- Struct `AzureWorkloadSAPHanaRestoreWithRehydrateRequest` has been removed +- Struct `AzureWorkloadSQLAutoProtectionIntent` has been removed +- Struct `AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest` has been removed +- Struct `AzureWorkloadSQLRestoreWithRehydrateRequest` has been removed +- Struct `BMSBackupEngineQueryObject` has been removed +- Struct `BMSBackupEnginesQueryObject` has been removed +- Struct `BMSContainerQueryObject` has been removed +- Struct `BMSContainersInquiryQueryObject` has been removed +- Struct `BMSPOQueryObject` has been removed +- Struct `BMSRefreshContainersQueryObject` has been removed +- Struct `BMSWorkloadItemQueryObject` has been removed +- Struct `BackupEngineBaseResource` has been removed +- Struct `BackupEngineBaseResourceList` has been removed +- Struct `BackupEngineExtendedInfo` has been removed +- Struct `BackupRequestResource` has been removed +- Struct `BackupResourceEncryptionConfig` has been removed +- Struct `BackupResourceEncryptionConfigExtended` has been removed +- Struct `BackupResourceEncryptionConfigExtendedResource` has been removed +- Struct `BackupResourceEncryptionConfigResource` has been removed +- Struct `BackupResourceVaultConfig` has been removed +- Struct `BackupResourceVaultConfigResource` has been removed +- Struct `BackupStatusRequest` has been removed +- Struct `BackupStatusResponse` has been removed +- Struct `ClientDiscoveryDisplay` has been removed +- Struct `ClientDiscoveryForLogSpecification` has been removed +- Struct `ClientDiscoveryForProperties` has been removed +- Struct `ClientDiscoveryForServiceSpecification` has been removed +- Struct `ClientDiscoveryResponse` has been removed +- Struct `ClientDiscoveryValueForSingleAPI` has been removed +- Struct `ContainerIdentityInfo` has been removed +- Struct `DPMContainerExtendedInfo` has been removed +- Struct `DailyRetentionFormat` has been removed +- Struct `DailyRetentionSchedule` has been removed +- Struct `DailySchedule` has been removed +- Struct `Day` has been removed +- Struct `DistributedNodesInfo` has been removed +- Struct `DpmBackupEngine` has been removed +- Struct `ExportJobsOperationResultInfo` has been removed +- Struct `ExtendedLocation` has been removed +- Struct `FetchTieringCostInfoForRehydrationRequest` has been removed +- Struct `FetchTieringCostSavingsInfoForPolicyRequest` has been removed +- Struct `FetchTieringCostSavingsInfoForProtectedItemRequest` has been removed +- Struct `FetchTieringCostSavingsInfoForVaultRequest` has been removed +- Struct `GenericContainer` has been removed +- Struct `GenericContainerExtendedInfo` has been removed +- Struct `GenericProtectionPolicy` has been removed +- Struct `GetProtectedItemQueryObject` has been removed +- Struct `HourlySchedule` has been removed +- Struct `ILRRequestResource` has been removed +- Struct `IaasVMBackupRequest` has been removed +- Struct `IaasVMILRRegistrationRequest` has been removed +- Struct `IaasVMRestoreWithRehydrationRequest` has been removed +- Struct `InquiryInfo` has been removed +- Struct `InquiryValidation` has been removed +- Struct `InstantRPAdditionalDetails` has been removed +- Struct `ListRecoveryPointsRecommendedForMoveRequest` has been removed +- Struct `LogSchedulePolicy` has been removed +- Struct `LongTermRetentionPolicy` has been removed +- Struct `LongTermSchedulePolicy` has been removed +- Struct `MABContainerHealthDetails` has been removed +- Struct `MabContainer` has been removed +- Struct `MabContainerExtendedInfo` has been removed +- Struct `MabProtectionPolicy` has been removed +- Struct `MonthlyRetentionSchedule` has been removed +- Struct `MoveRPAcrossTiersRequest` has been removed +- Struct `OperationResultInfo` has been removed +- Struct `OperationResultInfoBaseResource` has been removed +- Struct `OperationStatusValidateOperationExtendedInfo` has been removed +- Struct `OperationWorkerResponse` has been removed +- Struct `PreBackupValidation` has been removed +- Struct `PreValidateEnableBackupRequest` has been removed +- Struct `PreValidateEnableBackupResponse` has been removed +- Struct `PrepareDataMoveRequest` has been removed +- Struct `PrepareDataMoveResponse` has been removed +- Struct `PrivateEndpoint` has been removed +- Struct `PrivateEndpointConnection` has been removed +- Struct `PrivateEndpointConnectionResource` has been removed +- Struct `PrivateLinkServiceConnectionState` has been removed +- Struct `ProtectableContainerResource` has been removed +- Struct `ProtectableContainerResourceList` has been removed +- Struct `ProtectionContainerResource` has been removed +- Struct `ProtectionContainerResourceList` has been removed +- Struct `ProtectionIntentQueryObject` has been removed +- Struct `ProtectionIntentResource` has been removed +- Struct `ProtectionIntentResourceList` has been removed +- Struct `ProtectionPolicyQueryObject` has been removed +- Struct `ProtectionPolicyResource` has been removed +- Struct `ProtectionPolicyResourceList` has been removed +- Struct `RecoveryPointRehydrationInfo` has been removed +- Struct `RecoveryPointTierInformationV2` has been removed +- Struct `ResourceGuardOperationDetail` has been removed +- Struct `ResourceGuardProxyBase` has been removed +- Struct `ResourceGuardProxyBaseResource` has been removed +- Struct `ResourceGuardProxyBaseResourceList` has been removed +- Struct `RestoreRequestResource` has been removed +- Struct `RetentionDuration` has been removed +- Struct `SecuredVMDetails` has been removed +- Struct `SecurityPinBase` has been removed +- Struct `Settings` has been removed +- Struct `SimpleRetentionPolicy` has been removed +- Struct `SimpleSchedulePolicy` has been removed +- Struct `SimpleSchedulePolicyV2` has been removed +- Struct `SnapshotBackupAdditionalDetails` has been removed +- Struct `SnapshotRestoreParameters` has been removed +- Struct `SubProtectionPolicy` has been removed +- Struct `TargetDiskNetworkAccessSettings` has been removed +- Struct `TieringCostRehydrationInfo` has been removed +- Struct `TieringCostSavingInfo` has been removed +- Struct `TieringPolicy` has been removed +- Struct `TokenInformation` has been removed +- Struct `TriggerDataMoveRequest` has been removed +- Struct `UnlockDeleteRequest` has been removed +- Struct `UnlockDeleteResponse` has been removed +- Struct `UserAssignedIdentityProperties` has been removed +- Struct `UserAssignedManagedIdentityDetails` has been removed +- Struct `ValidateIaasVMRestoreOperationRequest` has been removed +- Struct `ValidateOperationRequestResource` has been removed +- Struct `ValidateOperationResponse` has been removed +- Struct `ValidateOperationsResponse` has been removed +- Struct `VaultJob` has been removed +- Struct `VaultJobErrorInfo` has been removed +- Struct `VaultJobExtendedInfo` has been removed +- Struct `VaultRetentionPolicy` has been removed +- Struct `WeeklyRetentionFormat` has been removed +- Struct `WeeklyRetentionSchedule` has been removed +- Struct `WeeklySchedule` has been removed +- Struct `WorkloadInquiryDetails` has been removed +- Struct `WorkloadItemResource` has been removed +- Struct `WorkloadItemResourceList` has been removed +- Struct `WorkloadProtectableItemResource` has been removed +- Struct `WorkloadProtectableItemResourceList` has been removed +- Struct `YearlyRetentionSchedule` has been removed +- Field `ResourceGuardOperationRequests` of struct `AzureFileShareRestoreRequest` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureFileshareProtectedItem` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureIaaSClassicComputeVMProtectedItem` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureIaaSComputeVMProtectedItem` has been removed +- Field `ContainerName`, `IsUserTriggered` of struct `AzureIaaSVMJob` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureIaaSVMProtectedItem` has been removed +- Field `NewestRecoveryPointInArchive`, `OldestRecoveryPointInArchive`, `OldestRecoveryPointInVault` of struct `AzureIaaSVMProtectedItemExtendedInfo` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureSQLProtectedItem` has been removed +- Field `IsUserTriggered` of struct `AzureStorageJob` has been removed +- Field `NewestRecoveryPointInArchive`, `OldestRecoveryPointInArchive`, `OldestRecoveryPointInVault`, `RecoveryModel` of struct `AzureVMWorkloadProtectedItemExtendedInfo` has been removed +- Field `IsArchiveEnabled`, `NodesList`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureVMWorkloadSAPAseDatabaseProtectedItem` has been removed +- Field `IsArchiveEnabled`, `NodesList`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureVMWorkloadSAPHanaDatabaseProtectedItem` has been removed +- Field `IsArchiveEnabled`, `NodesList`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `AzureVMWorkloadSQLDatabaseProtectedItem` has been removed +- Field `ResourceGuardOperationRequests`, `SnapshotRestoreParameters`, `TargetResourceGroupName`, `UserAssignedManagedIdentityDetails` of struct `AzureWorkloadPointInTimeRestoreRequest` has been removed +- Field `DedupState`, `XcoolState` of struct `BackupResourceConfig` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `DPMProtectedItem` has been removed +- Field `LinuxVMApplicationName` of struct `ExtendedProperties` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `GenericProtectedItem` has been removed +- Field `ExtendedLocation`, `IsPrivateAccessEnabledOnAnyDisk`, `SecurityType` of struct `IaasVMRecoveryPoint` has been removed +- Field `IsArchiveEnabled`, `PolicyName`, `SoftDeleteRetentionPeriodInDays`, `VaultID` of struct `MabFileFolderProtectedItem` has been removed + +### Features Added + +- New function `NewAADPropertiesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AADPropertiesClient, error)` +- New function `*AADPropertiesClient.Get(context.Context, string, *AADPropertiesClientGetOptions) (AADPropertiesClientGetResponse, error)` +- New function `NewBackupCrrJobDetailsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupCrrJobDetailsClient, error)` +- New function `*BackupCrrJobDetailsClient.Get(context.Context, string, CrrJobRequest, *BackupCrrJobDetailsClientGetOptions) (BackupCrrJobDetailsClientGetResponse, error)` +- New function `NewBackupCrrJobsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupCrrJobsClient, error)` +- New function `*BackupCrrJobsClient.NewListPager(string, CrrJobRequest, *BackupCrrJobsClientListOptions) *runtime.Pager[BackupCrrJobsClientListResponse]` +- New function `NewBackupProtectedItemsCrrClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupProtectedItemsCrrClient, error)` +- New function `*BackupProtectedItemsCrrClient.NewListPager(string, string, *BackupProtectedItemsCrrClientListOptions) *runtime.Pager[BackupProtectedItemsCrrClientListResponse]` +- New function `NewBackupResourceStorageConfigsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupResourceStorageConfigsClient, error)` +- New function `*BackupResourceStorageConfigsClient.Get(context.Context, string, string, *BackupResourceStorageConfigsClientGetOptions) (BackupResourceStorageConfigsClientGetResponse, error)` +- New function `*BackupResourceStorageConfigsClient.Patch(context.Context, string, string, BackupResourceConfigResource, *BackupResourceStorageConfigsClientPatchOptions) (BackupResourceStorageConfigsClientPatchResponse, error)` +- New function `*BackupResourceStorageConfigsClient.Update(context.Context, string, string, BackupResourceConfigResource, *BackupResourceStorageConfigsClientUpdateOptions) (BackupResourceStorageConfigsClientUpdateResponse, error)` +- New function `NewBackupUsageSummariesCRRClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupUsageSummariesCRRClient, error)` +- New function `*BackupUsageSummariesCRRClient.NewListPager(string, string, *BackupUsageSummariesCRRClientListOptions) *runtime.Pager[BackupUsageSummariesCRRClientListResponse]` +- New function `*ClientFactory.NewAADPropertiesClient() *AADPropertiesClient` +- New function `*ClientFactory.NewBackupCrrJobDetailsClient() *BackupCrrJobDetailsClient` +- New function `*ClientFactory.NewBackupCrrJobsClient() *BackupCrrJobsClient` +- New function `*ClientFactory.NewBackupProtectedItemsCrrClient() *BackupProtectedItemsCrrClient` +- New function `*ClientFactory.NewBackupResourceStorageConfigsClient() *BackupResourceStorageConfigsClient` +- New function `*ClientFactory.NewBackupUsageSummariesCRRClient() *BackupUsageSummariesCRRClient` +- New function `*ClientFactory.NewCrossRegionRestoreClient() *CrossRegionRestoreClient` +- New function `*ClientFactory.NewCrrOperationResultsClient() *CrrOperationResultsClient` +- New function `*ClientFactory.NewCrrOperationStatusClient() *CrrOperationStatusClient` +- New function `*ClientFactory.NewRecoveryPointsCrrClient() *RecoveryPointsCrrClient` +- New function `NewCrossRegionRestoreClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CrossRegionRestoreClient, error)` +- New function `*CrossRegionRestoreClient.BeginTrigger(context.Context, string, CrossRegionRestoreRequest, *CrossRegionRestoreClientBeginTriggerOptions) (*runtime.Poller[CrossRegionRestoreClientTriggerResponse], error)` +- New function `*CrrAccessToken.GetCrrAccessToken() *CrrAccessToken` +- New function `NewCrrOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CrrOperationResultsClient, error)` +- New function `*CrrOperationResultsClient.Get(context.Context, string, string, *CrrOperationResultsClientGetOptions) (CrrOperationResultsClientGetResponse, error)` +- New function `NewCrrOperationStatusClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CrrOperationStatusClient, error)` +- New function `*CrrOperationStatusClient.Get(context.Context, string, string, *CrrOperationStatusClientGetOptions) (CrrOperationStatusClientGetResponse, error)` +- New function `*OperationStatusRecoveryPointExtendedInfo.GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo` +- New function `*RecoveryPointsClient.GetAccessToken(context.Context, string, string, string, string, string, string, AADPropertiesResource, *RecoveryPointsClientGetAccessTokenOptions) (RecoveryPointsClientGetAccessTokenResponse, error)` +- New function `NewRecoveryPointsCrrClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RecoveryPointsCrrClient, error)` +- New function `*RecoveryPointsCrrClient.Get(context.Context, string, string, string, string, string, string, *RecoveryPointsCrrClientGetOptions) (RecoveryPointsCrrClientGetResponse, error)` +- New function `*RecoveryPointsCrrClient.NewListPager(string, string, string, string, string, *RecoveryPointsCrrClientListOptions) *runtime.Pager[RecoveryPointsCrrClientListResponse]` +- New function `*WorkloadCrrAccessToken.GetCrrAccessToken() *CrrAccessToken` +- New struct `AADProperties` +- New struct `AADPropertiesResource` +- New struct `BMSAADPropertiesQueryObject` +- New struct `CrossRegionRestoreRequest` +- New struct `CrossRegionRestoreRequestResource` +- New struct `CrrAccessTokenResource` +- New struct `CrrJobRequest` +- New struct `CrrJobRequestResource` +- New struct `OperationStatusRecoveryPointExtendedInfo` +- New struct `WorkloadCrrAccessToken` +- New field `CrossRegionRestoreState` in struct `AzureFileShareRecoveryPoint` +- New field `HealthStatus` in struct `AzureFileshareProtectedItem` + + ## 4.1.0 (2024-05-24) ### Features Added diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/README.md b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/README.md index a59b52b4e53b..a78df547dcf6 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/README.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Recovery Services Backup module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4 +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armrecoveryservicesbackup.NewClientFactory( 0 + }, + Fetcher: func(ctx context.Context, page *BackupCrrJobsClientListResponse) (BackupCrrJobsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupCrrJobsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, azureRegion, parameters, options) + }, nil) + if err != nil { + return BackupCrrJobsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *BackupCrrJobsClient) listCreateRequest(ctx context.Context, azureRegion string, parameters CrrJobRequest, options *BackupCrrJobsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs" + if azureRegion == "" { + return nil, errors.New("parameter azureRegion cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureRegion}", url.PathEscape(azureRegion)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2024-11-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BackupCrrJobsClient) listHandleResponse(resp *http.Response) (BackupCrrJobsClientListResponse, error) { + result := BackupCrrJobsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobResourceList); err != nil { + return BackupCrrJobsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupengines_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupengines_client.go deleted file mode 100644 index 9822a0f3daff..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupengines_client.go +++ /dev/null @@ -1,189 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupEnginesClient contains the methods for the BackupEngines group. -// Don't use this type directly, use NewBackupEnginesClient() instead. -type BackupEnginesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupEnginesClient creates a new instance of BackupEnginesClient 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 NewBackupEnginesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupEnginesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupEnginesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Returns backup management server registered to Recovery Services Vault. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - backupEngineName - Name of the backup management server. -// - options - BackupEnginesClientGetOptions contains the optional parameters for the BackupEnginesClient.Get method. -func (client *BackupEnginesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, backupEngineName string, options *BackupEnginesClientGetOptions) (BackupEnginesClientGetResponse, error) { - var err error - const operationName = "BackupEnginesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, backupEngineName, options) - if err != nil { - return BackupEnginesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupEnginesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return BackupEnginesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *BackupEnginesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, backupEngineName string, options *BackupEnginesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 backupEngineName == "" { - return nil, errors.New("parameter backupEngineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{backupEngineName}", url.PathEscape(backupEngineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *BackupEnginesClient) getHandleResponse(resp *http.Response) (BackupEnginesClientGetResponse, error) { - result := BackupEnginesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupEngineBaseResource); err != nil { - return BackupEnginesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Backup management servers registered to Recovery Services Vault. Returns a pageable list of servers. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupEnginesClientListOptions contains the optional parameters for the BackupEnginesClient.NewListPager method. -func (client *BackupEnginesClient) NewListPager(vaultName string, resourceGroupName string, options *BackupEnginesClientListOptions) *runtime.Pager[BackupEnginesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupEnginesClientListResponse]{ - More: func(page BackupEnginesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupEnginesClientListResponse) (BackupEnginesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupEnginesClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) - }, nil) - if err != nil { - return BackupEnginesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BackupEnginesClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupEnginesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BackupEnginesClient) listHandleResponse(resp *http.Response) (BackupEnginesClientListResponse, error) { - result := BackupEnginesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupEngineBaseResourceList); err != nil { - return BackupEnginesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupengines_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupengines_client_example_test.go deleted file mode 100644 index f7320761cd68..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupengines_client_example_test.go +++ /dev/null @@ -1,136 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Dpm/BackupEngines_List.json -func ExampleBackupEnginesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupEnginesClient().NewListPager("testVault", "testRG", &armrecoveryservicesbackup.BackupEnginesClientListOptions{Filter: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BackupEngineBaseResourceList = armrecoveryservicesbackup.BackupEngineBaseResourceList{ - // Value: []*armrecoveryservicesbackup.BackupEngineBaseResource{ - // { - // Name: to.Ptr("testServer1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupEngines"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupEngines/testServer1"), - // Properties: &armrecoveryservicesbackup.DpmBackupEngine{ - // AzureBackupAgentVersion: to.Ptr("2.0.9532.0"), - // BackupEngineState: to.Ptr("Active"), - // BackupEngineType: to.Ptr(armrecoveryservicesbackup.BackupEngineTypeDpmBackupEngine), - // DpmVersion: to.Ptr("5.1.348.0"), - // ExtendedInfo: &armrecoveryservicesbackup.BackupEngineExtendedInfo{ - // AvailableDiskSpace: to.Ptr[float64](50), - // DiskCount: to.Ptr[int32](5), - // ProtectedItemsCount: to.Ptr[int32](35), - // ProtectedServersCount: to.Ptr[int32](21), - // UsedDiskSpace: to.Ptr[float64](20), - // }, - // FriendlyName: to.Ptr("testServer1"), - // IsAzureBackupAgentUpgradeAvailable: to.Ptr(false), - // IsDpmUpgradeAvailable: to.Ptr(false), - // RegistrationStatus: to.Ptr("Registered"), - // }, - // }, - // { - // Name: to.Ptr("testServer5"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupEngines"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupEngines/testServer5"), - // Properties: &armrecoveryservicesbackup.DpmBackupEngine{ - // AzureBackupAgentVersion: to.Ptr("2.0.9530.0"), - // BackupEngineState: to.Ptr("Active"), - // BackupEngineType: to.Ptr(armrecoveryservicesbackup.BackupEngineTypeDpmBackupEngine), - // DpmVersion: to.Ptr("5.1.348.0"), - // ExtendedInfo: &armrecoveryservicesbackup.BackupEngineExtendedInfo{ - // AvailableDiskSpace: to.Ptr[float64](50), - // DiskCount: to.Ptr[int32](5), - // ProtectedItemsCount: to.Ptr[int32](35), - // ProtectedServersCount: to.Ptr[int32](21), - // UsedDiskSpace: to.Ptr[float64](20), - // }, - // FriendlyName: to.Ptr("testServer5"), - // IsAzureBackupAgentUpgradeAvailable: to.Ptr(false), - // IsDpmUpgradeAvailable: to.Ptr(false), - // RegistrationStatus: to.Ptr("Registered"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Dpm/BackupEngines_Get.json -func ExampleBackupEnginesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupEnginesClient().Get(ctx, "testVault", "testRG", "testServer", &armrecoveryservicesbackup.BackupEnginesClientGetOptions{Filter: nil, - SkipToken: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupEngineBaseResource = armrecoveryservicesbackup.BackupEngineBaseResource{ - // Name: to.Ptr("testServer"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupEngines"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupEngines/testServer"), - // Properties: &armrecoveryservicesbackup.DpmBackupEngine{ - // AzureBackupAgentVersion: to.Ptr("2.0.9532.0"), - // BackupEngineState: to.Ptr("Active"), - // BackupEngineType: to.Ptr(armrecoveryservicesbackup.BackupEngineTypeDpmBackupEngine), - // DpmVersion: to.Ptr("5.1.348.0"), - // ExtendedInfo: &armrecoveryservicesbackup.BackupEngineExtendedInfo{ - // AvailableDiskSpace: to.Ptr[float64](50), - // DiskCount: to.Ptr[int32](5), - // ProtectedItemsCount: to.Ptr[int32](35), - // ProtectedServersCount: to.Ptr[int32](21), - // UsedDiskSpace: to.Ptr[float64](20), - // }, - // FriendlyName: to.Ptr("testServer"), - // IsAzureBackupAgentUpgradeAvailable: to.Ptr(false), - // IsDpmUpgradeAvailable: to.Ptr(false), - // RegistrationStatus: to.Ptr("Registered"), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupjobs_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupjobs_client.go deleted file mode 100644 index eaba6e0ce32d..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupjobs_client.go +++ /dev/null @@ -1,114 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupJobsClient contains the methods for the BackupJobs group. -// Don't use this type directly, use NewBackupJobsClient() instead. -type BackupJobsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupJobsClient creates a new instance of BackupJobsClient 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 NewBackupJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupJobsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupJobsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Provides a pageable list of jobs. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupJobsClientListOptions contains the optional parameters for the BackupJobsClient.NewListPager method. -func (client *BackupJobsClient) NewListPager(vaultName string, resourceGroupName string, options *BackupJobsClientListOptions) *runtime.Pager[BackupJobsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupJobsClientListResponse]{ - More: func(page BackupJobsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupJobsClientListResponse) (BackupJobsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupJobsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) - }, nil) - if err != nil { - return BackupJobsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BackupJobsClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupJobsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BackupJobsClient) listHandleResponse(resp *http.Response) (BackupJobsClientListResponse, error) { - result := BackupJobsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JobResourceList); err != nil { - return BackupJobsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupjobs_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupjobs_client_example_test.go deleted file mode 100644 index f56ae490da65..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupjobs_client_example_test.go +++ /dev/null @@ -1,191 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobs.json -func ExampleBackupJobsClient_NewListPager_listAllJobs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupJobsClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupJobsClientListOptions{Filter: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobResourceList = armrecoveryservicesbackup.JobResourceList{ - // Value: []*armrecoveryservicesbackup.JobResource{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupJobs"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupJobs/00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMJob{ - // ActivityID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // EntityFriendlyName: to.Ptr("testvm"), - // JobType: to.Ptr("AzureIaaSVMJob"), - // Operation: to.Ptr("Backup"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:31:07.014Z"); return t}()), - // Status: to.Ptr("InProgress"), - // Duration: to.Ptr("PT12.4272909S"), - // VirtualMachineVersion: to.Ptr("Compute"), - // }, - // }, - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupJobs"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupJobs/00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMJob{ - // ActivityID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:31:03.755Z"); return t}()), - // EntityFriendlyName: to.Ptr("testvm"), - // JobType: to.Ptr("AzureIaaSVMJob"), - // Operation: to.Ptr("ConfigureBackup"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:30:32.448Z"); return t}()), - // Status: to.Ptr("Completed"), - // Duration: to.Ptr("PT31.3066291S"), - // VirtualMachineVersion: to.Ptr("Compute"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobsWithAllSupportedFilters.json -func ExampleBackupJobsClient_NewListPager_listJobsWithFilters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupJobsClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupJobsClientListOptions{Filter: to.Ptr("startTime eq '2016-01-01 00:00:00 AM' and endTime eq '2017-11-29 00:00:00 AM' and operation eq 'Backup' and backupManagementType eq 'AzureIaasVM' and status eq 'InProgress'"), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobResourceList = armrecoveryservicesbackup.JobResourceList{ - // Value: []*armrecoveryservicesbackup.JobResource{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupJobs"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupJobs/00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMJob{ - // ActivityID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // EntityFriendlyName: to.Ptr("testvm"), - // JobType: to.Ptr("AzureIaaSVMJob"), - // Operation: to.Ptr("Backup"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:31:07.014Z"); return t}()), - // Status: to.Ptr("InProgress"), - // Duration: to.Ptr("PT12.4272909S"), - // VirtualMachineVersion: to.Ptr("Compute"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobsWithStartTimeAndEndTimeFilters.json -func ExampleBackupJobsClient_NewListPager_listJobsWithTimeFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupJobsClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupJobsClientListOptions{Filter: to.Ptr("startTime eq '2016-01-01 00:00:00 AM' and endTime eq '2017-11-29 00:00:00 AM'"), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobResourceList = armrecoveryservicesbackup.JobResourceList{ - // Value: []*armrecoveryservicesbackup.JobResource{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupJobs"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupJobs/00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMJob{ - // ActivityID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // EntityFriendlyName: to.Ptr("testvm"), - // JobType: to.Ptr("AzureIaaSVMJob"), - // Operation: to.Ptr("Backup"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:31:07.014Z"); return t}()), - // Status: to.Ptr("InProgress"), - // Duration: to.Ptr("PT12.4272909S"), - // VirtualMachineVersion: to.Ptr("Compute"), - // }, - // }, - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupJobs"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupJobs/00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMJob{ - // ActivityID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:31:03.755Z"); return t}()), - // EntityFriendlyName: to.Ptr("testvm"), - // JobType: to.Ptr("AzureIaaSVMJob"), - // Operation: to.Ptr("ConfigureBackup"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:30:32.448Z"); return t}()), - // Status: to.Ptr("Completed"), - // Duration: to.Ptr("PT31.3066291S"), - // VirtualMachineVersion: to.Ptr("Compute"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationresults_client.go deleted file mode 100644 index adb5ca6b51d9..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationresults_client.go +++ /dev/null @@ -1,107 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupOperationResultsClient contains the methods for the BackupOperationResults group. -// Don't use this type directly, use NewBackupOperationResultsClient() instead. -type BackupOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupOperationResultsClient creates a new instance of BackupOperationResultsClient 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 NewBackupOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Provides the status of the delete operations such as deleting backed up item. Once the operation has started, the -// status code in the response would be Accepted. It will continue to be in this state -// till it reaches completion. On successful completion, the status code will be OK. This method expects OperationID as an -// argument. OperationID is part of the Location header of the operation response. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - operationID - OperationID which represents the operation. -// - options - BackupOperationResultsClientGetOptions contains the optional parameters for the BackupOperationResultsClient.Get -// method. -func (client *BackupOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BackupOperationResultsClientGetOptions) (BackupOperationResultsClientGetResponse, error) { - var err error - const operationName = "BackupOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) - if err != nil { - return BackupOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return BackupOperationResultsClientGetResponse{}, err - } - return BackupOperationResultsClientGetResponse{}, nil -} - -// getCreateRequest creates the Get request. -func (client *BackupOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BackupOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationresults_client_example_test.go deleted file mode 100644 index 0a8e23c58ac8..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationresults_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete_OperationResult.json -func ExampleBackupOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackupOperationResultsClient().Get(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationstatuses_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationstatuses_client.go deleted file mode 100644 index d8da0365a9e3..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationstatuses_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupOperationStatusesClient contains the methods for the BackupOperationStatuses group. -// Don't use this type directly, use NewBackupOperationStatusesClient() instead. -type BackupOperationStatusesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupOperationStatusesClient creates a new instance of BackupOperationStatusesClient 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 NewBackupOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupOperationStatusesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupOperationStatusesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches the status of an operation such as triggering a backup, restore. The status can be in progress, completed -// or failed. You can refer to the OperationStatus enum for all the possible states of an -// operation. Some operations create jobs. This method returns the list of jobs when the operation is complete. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - operationID - OperationID which represents the operation. -// - options - BackupOperationStatusesClientGetOptions contains the optional parameters for the BackupOperationStatusesClient.Get -// method. -func (client *BackupOperationStatusesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BackupOperationStatusesClientGetOptions) (BackupOperationStatusesClientGetResponse, error) { - var err error - const operationName = "BackupOperationStatusesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) - if err != nil { - return BackupOperationStatusesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupOperationStatusesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return BackupOperationStatusesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *BackupOperationStatusesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BackupOperationStatusesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *BackupOperationStatusesClient) getHandleResponse(resp *http.Response) (BackupOperationStatusesClientGetResponse, error) { - result := BackupOperationStatusesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return BackupOperationStatusesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationstatuses_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationstatuses_client_example_test.go deleted file mode 100644 index a79817f56278..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupoperationstatuses_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete_OperationStatus.json -func ExampleBackupOperationStatusesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupOperationStatusesClient().Get(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armrecoveryservicesbackup.OperationStatus{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T06:52:53.886Z"); return t}()), - // Status: to.Ptr(armrecoveryservicesbackup.OperationStatusValuesInProgress), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backuppolicies_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backuppolicies_client.go deleted file mode 100644 index 7b803954f0b0..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backuppolicies_client.go +++ /dev/null @@ -1,112 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupPoliciesClient contains the methods for the BackupPolicies group. -// Don't use this type directly, use NewBackupPoliciesClient() instead. -type BackupPoliciesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupPoliciesClient creates a new instance of BackupPoliciesClient 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 NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupPoliciesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupPoliciesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Lists of backup policies associated with Recovery Services Vault. API provides pagination parameters to -// fetch scoped results. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. -func (client *BackupPoliciesClient) NewListPager(vaultName string, resourceGroupName string, options *BackupPoliciesClientListOptions) *runtime.Pager[BackupPoliciesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupPoliciesClientListResponse]{ - More: func(page BackupPoliciesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupPoliciesClientListResponse) (BackupPoliciesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupPoliciesClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) - }, nil) - if err != nil { - return BackupPoliciesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupPoliciesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BackupPoliciesClient) listHandleResponse(resp *http.Response) (BackupPoliciesClientListResponse, error) { - result := BackupPoliciesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionPolicyResourceList); err != nil { - return BackupPoliciesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backuppolicies_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backuppolicies_client_example_test.go deleted file mode 100644 index 093159a58977..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backuppolicies_client_example_test.go +++ /dev/null @@ -1,292 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupPolicies_List.json -func ExampleBackupPoliciesClient_NewListPager_listProtectionPoliciesWithBackupManagementTypeFilterAsAzureIaasVm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupPoliciesClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupPoliciesClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureIaasVM'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectionPolicyResourceList = armrecoveryservicesbackup.ProtectionPolicyResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectionPolicyResource{ - // { - // Name: to.Ptr("DefaultPolicy"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/DefaultPolicy"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](30), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // }, - // }, - // { - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/v2-List-Policies.json -func ExampleBackupPoliciesClient_NewListPager_listProtectionPoliciesWithBackupManagementTypeFilterAsAzureIaasVmWithBothV1AndV2Policies() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupPoliciesClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupPoliciesClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureIaasVM'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectionPolicyResourceList = armrecoveryservicesbackup.ProtectionPolicyResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectionPolicyResource{ - // { - // Name: to.Ptr("DefaultPolicy"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/DefaultPolicy"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](30), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // }, - // }, - // { - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("v2-daily-policy"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/v2-daily-policy"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicyV2{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicyV2"), - // DailySchedule: &armrecoveryservicesbackup.DailySchedule{ - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // }, - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupPolicies_List.json -func ExampleBackupPoliciesClient_NewListPager_listProtectionPoliciesWithBackupManagementTypeFilterAsAzureWorkload() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupPoliciesClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupPoliciesClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureWorkload'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectionPolicyResourceList = armrecoveryservicesbackup.ProtectionPolicyResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectionPolicyResource{ - // { - // Name: to.Ptr("HourlyLogBackup"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/HourlyLogBackup"), - // Properties: &armrecoveryservicesbackup.AzureVMWorkloadProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureWorkload"), - // ProtectedItemsCount: to.Ptr[int32](0), - // Settings: &armrecoveryservicesbackup.Settings{ - // Issqlcompression: to.Ptr(false), - // TimeZone: to.Ptr("UTC"), - // }, - // SubProtectionPolicy: []*armrecoveryservicesbackup.SubProtectionPolicy{ - // { - // PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeFull), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](30), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // }, - // { - // PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeLog), - // RetentionPolicy: &armrecoveryservicesbackup.SimpleRetentionPolicy{ - // RetentionPolicyType: to.Ptr("SimpleRetentionPolicy"), - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](30), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.LogSchedulePolicy{ - // SchedulePolicyType: to.Ptr("LogSchedulePolicy"), - // ScheduleFrequencyInMins: to.Ptr[int32](60), - // }, - // }}, - // WorkLoadType: to.Ptr(armrecoveryservicesbackup.WorkloadTypeSQLDataBase), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectableitems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectableitems_client.go deleted file mode 100644 index cd32018bf022..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectableitems_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupProtectableItemsClient contains the methods for the BackupProtectableItems group. -// Don't use this type directly, use NewBackupProtectableItemsClient() instead. -type BackupProtectableItemsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupProtectableItemsClient creates a new instance of BackupProtectableItemsClient 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 NewBackupProtectableItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupProtectableItemsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupProtectableItemsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Provides a pageable list of protectable objects within your subscription according to the query filter and -// the pagination parameters. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupProtectableItemsClientListOptions contains the optional parameters for the BackupProtectableItemsClient.NewListPager -// method. -func (client *BackupProtectableItemsClient) NewListPager(vaultName string, resourceGroupName string, options *BackupProtectableItemsClientListOptions) *runtime.Pager[BackupProtectableItemsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupProtectableItemsClientListResponse]{ - More: func(page BackupProtectableItemsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupProtectableItemsClientListResponse) (BackupProtectableItemsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupProtectableItemsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) - }, nil) - if err != nil { - return BackupProtectableItemsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BackupProtectableItemsClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupProtectableItemsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BackupProtectableItemsClient) listHandleResponse(resp *http.Response) (BackupProtectableItemsClientListResponse, error) { - result := BackupProtectableItemsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadProtectableItemResourceList); err != nil { - return BackupProtectableItemsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectableitems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectableitems_client_example_test.go deleted file mode 100644 index 290402b32457..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectableitems_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupProtectableItems_List.json -func ExampleBackupProtectableItemsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupProtectableItemsClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupProtectableItemsClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureIaasVM'"), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WorkloadProtectableItemResourceList = armrecoveryservicesbackup.WorkloadProtectableItemResourceList{ - // Value: []*armrecoveryservicesbackup.WorkloadProtectableItemResource{ - // { - // Name: to.Ptr("VM;iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectableItems"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/protectionContainers/IaasVMContainer;iaasvmcontainer;iaasvm-rg;iaasvm-1/protectableItems/VM;iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSClassicComputeVMProtectableItem{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // FriendlyName: to.Ptr("iaasvm-1"), - // ProtectableItemType: to.Ptr("Microsoft.ClassicCompute/virtualMachines"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStatusNotProtected), - // WorkloadType: to.Ptr("VM"), - // VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.ClassicCompute/virtualMachines/iaasvm-1"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditems_client_example_test.go deleted file mode 100644 index 5133fa29b887..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditems_client_example_test.go +++ /dev/null @@ -1,71 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupProtectedItems_List.json -func ExampleBackupProtectedItemsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupProtectedItemsClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupProtectedItemsClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureIaasVM' and itemType eq 'VM'"), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectedItemResourceList = armrecoveryservicesbackup.ProtectedItemResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectedItemResource{ - // { - // Name: to.Ptr("VM;iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/protectionContainers/IaasVMContainer;iaasvmcontainer;iaasvm-rg;iaasvm-1/protectedItems/VM;iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSClassicComputeVMProtectedItem{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // ContainerName: to.Ptr("iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // LastRecoveryPoint: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-22T12:25:32.048Z"); return t}()), - // PolicyID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // ProtectedItemType: to.Ptr("Microsoft.ClassicCompute/virtualMachines"), - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.ClassicCompute/virtualMachines/iaasvm-1"), - // WorkloadType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - // FriendlyName: to.Ptr("iaasvm-1"), - // HealthStatus: to.Ptr(armrecoveryservicesbackup.HealthStatusPassed), - // LastBackupStatus: to.Ptr("Completed"), - // LastBackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-22T12:25:32.048Z"); return t}()), - // ProtectedItemDataID: to.Ptr("636482643132986882"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStateProtected), - // ProtectionStatus: to.Ptr("Healthy"), - // VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.ClassicCompute/virtualMachines/iaasvm-1"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditemscrr_client.go similarity index 66% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditems_client.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditemscrr_client.go index 92a6b0530dfa..9993ebbfec66 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditems_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotecteditemscrr_client.go @@ -20,23 +20,23 @@ import ( "strings" ) -// BackupProtectedItemsClient contains the methods for the BackupProtectedItems group. -// Don't use this type directly, use NewBackupProtectedItemsClient() instead. -type BackupProtectedItemsClient struct { +// BackupProtectedItemsCrrClient contains the methods for the BackupProtectedItemsCrr group. +// Don't use this type directly, use NewBackupProtectedItemsCrrClient() instead. +type BackupProtectedItemsCrrClient struct { internal *arm.Client subscriptionID string } -// NewBackupProtectedItemsClient creates a new instance of BackupProtectedItemsClient with the specified values. +// NewBackupProtectedItemsCrrClient creates a new instance of BackupProtectedItemsCrrClient 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 NewBackupProtectedItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupProtectedItemsClient, error) { +func NewBackupProtectedItemsCrrClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupProtectedItemsCrrClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &BackupProtectedItemsClient{ + client := &BackupProtectedItemsCrrClient{ subscriptionID: subscriptionID, internal: cl, } @@ -45,18 +45,18 @@ func NewBackupProtectedItemsClient(subscriptionID string, credential azcore.Toke // NewListPager - Provides a pageable list of all items that are backed up within a vault. // -// Generated from API version 2024-04-01 +// Generated from API version 2024-11-15 // - vaultName - The name of the recovery services vault. // - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupProtectedItemsClientListOptions contains the optional parameters for the BackupProtectedItemsClient.NewListPager +// - options - BackupProtectedItemsCrrClientListOptions contains the optional parameters for the BackupProtectedItemsCrrClient.NewListPager // method. -func (client *BackupProtectedItemsClient) NewListPager(vaultName string, resourceGroupName string, options *BackupProtectedItemsClientListOptions) *runtime.Pager[BackupProtectedItemsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupProtectedItemsClientListResponse]{ - More: func(page BackupProtectedItemsClientListResponse) bool { +func (client *BackupProtectedItemsCrrClient) NewListPager(vaultName string, resourceGroupName string, options *BackupProtectedItemsCrrClientListOptions) *runtime.Pager[BackupProtectedItemsCrrClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupProtectedItemsCrrClientListResponse]{ + More: func(page BackupProtectedItemsCrrClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *BackupProtectedItemsClientListResponse) (BackupProtectedItemsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupProtectedItemsClient.NewListPager") + Fetcher: func(ctx context.Context, page *BackupProtectedItemsCrrClientListResponse) (BackupProtectedItemsCrrClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupProtectedItemsCrrClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -65,7 +65,7 @@ func (client *BackupProtectedItemsClient) NewListPager(vaultName string, resourc return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) }, nil) if err != nil { - return BackupProtectedItemsClientListResponse{}, err + return BackupProtectedItemsCrrClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -74,8 +74,8 @@ func (client *BackupProtectedItemsClient) NewListPager(vaultName string, resourc } // listCreateRequest creates the List request. -func (client *BackupProtectedItemsClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupProtectedItemsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems" +func (client *BackupProtectedItemsCrrClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupProtectedItemsCrrClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/" if vaultName == "" { return nil, errors.New("parameter vaultName cannot be empty") } @@ -99,17 +99,17 @@ func (client *BackupProtectedItemsClient) listCreateRequest(ctx context.Context, if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } - reqQP.Set("api-version", "2024-04-01") + reqQP.Set("api-version", "2024-11-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *BackupProtectedItemsClient) listHandleResponse(resp *http.Response) (BackupProtectedItemsClientListResponse, error) { - result := BackupProtectedItemsClientListResponse{} +func (client *BackupProtectedItemsCrrClient) listHandleResponse(resp *http.Response) (BackupProtectedItemsCrrClientListResponse, error) { + result := BackupProtectedItemsCrrClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemResourceList); err != nil { - return BackupProtectedItemsClientListResponse{}, err + return BackupProtectedItemsCrrClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectioncontainers_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectioncontainers_client.go deleted file mode 100644 index 465c26fb02f3..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectioncontainers_client.go +++ /dev/null @@ -1,112 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupProtectionContainersClient contains the methods for the BackupProtectionContainers group. -// Don't use this type directly, use NewBackupProtectionContainersClient() instead. -type BackupProtectionContainersClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupProtectionContainersClient creates a new instance of BackupProtectionContainersClient 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 NewBackupProtectionContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupProtectionContainersClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupProtectionContainersClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the containers registered to Recovery Services Vault. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupProtectionContainersClientListOptions contains the optional parameters for the BackupProtectionContainersClient.NewListPager -// method. -func (client *BackupProtectionContainersClient) NewListPager(vaultName string, resourceGroupName string, options *BackupProtectionContainersClientListOptions) *runtime.Pager[BackupProtectionContainersClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupProtectionContainersClientListResponse]{ - More: func(page BackupProtectionContainersClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupProtectionContainersClientListResponse) (BackupProtectionContainersClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupProtectionContainersClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) - }, nil) - if err != nil { - return BackupProtectionContainersClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BackupProtectionContainersClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupProtectionContainersClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BackupProtectionContainersClient) listHandleResponse(resp *http.Response) (BackupProtectionContainersClientListResponse, error) { - result := BackupProtectionContainersClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionContainerResourceList); err != nil { - return BackupProtectionContainersClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectioncontainers_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectioncontainers_client_example_test.go deleted file mode 100644 index 0832628df07b..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectioncontainers_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_List.json -func ExampleBackupProtectionContainersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupProtectionContainersClient().NewListPager("testVault", "testRg", &armrecoveryservicesbackup.BackupProtectionContainersClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureWorkload'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectionContainerResourceList = armrecoveryservicesbackup.ProtectionContainerResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectionContainerResource{ - // { - // Name: to.Ptr("StorageContainer;Storage;testrg;suchandrtestsa125"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers"), - // ID: to.Ptr("/subscriptions/172424a4-d65f-421e-a8de-197d98aabeba/resourcegroups/testrg/providers/microsoft.recoveryservices/vaults/suchandr-test-vault-wcus/backupFabrics/Azure/protectionContainers/StorageContainer;Storage;testrg;suchandrtestsa125"), - // Properties: &armrecoveryservicesbackup.AzureStorageContainer{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureStorage), - // ContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeStorageContainer), - // FriendlyName: to.Ptr("suchandrtestsa125"), - // HealthStatus: to.Ptr("Healthy"), - // RegistrationStatus: to.Ptr("Registered"), - // ProtectedItemCount: to.Ptr[int64](2), - // SourceResourceID: to.Ptr("/subscriptions/172424a4-d65f-421e-a8de-197d98aabeba/resourceGroups/testrg/providers/Microsoft.Storage/storageAccounts/suchandrtestsa125"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectionintent_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectionintent_client.go deleted file mode 100644 index 6a6b9eaacf42..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectionintent_client.go +++ /dev/null @@ -1,115 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupProtectionIntentClient contains the methods for the BackupProtectionIntent group. -// Don't use this type directly, use NewBackupProtectionIntentClient() instead. -type BackupProtectionIntentClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupProtectionIntentClient creates a new instance of BackupProtectionIntentClient 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 NewBackupProtectionIntentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupProtectionIntentClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupProtectionIntentClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Provides a pageable list of all intents that are present within a vault. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupProtectionIntentClientListOptions contains the optional parameters for the BackupProtectionIntentClient.NewListPager -// method. -func (client *BackupProtectionIntentClient) NewListPager(vaultName string, resourceGroupName string, options *BackupProtectionIntentClientListOptions) *runtime.Pager[BackupProtectionIntentClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupProtectionIntentClientListResponse]{ - More: func(page BackupProtectionIntentClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupProtectionIntentClientListResponse) (BackupProtectionIntentClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupProtectionIntentClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, options) - }, nil) - if err != nil { - return BackupProtectionIntentClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BackupProtectionIntentClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupProtectionIntentClientListOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BackupProtectionIntentClient) listHandleResponse(resp *http.Response) (BackupProtectionIntentClientListResponse, error) { - result := BackupProtectionIntentClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionIntentResourceList); err != nil { - return BackupProtectionIntentClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectionintent_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectionintent_client_example_test.go deleted file mode 100644 index 39b84b74d45b..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupprotectionintent_client_example_test.go +++ /dev/null @@ -1,59 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_List.json -func ExampleBackupProtectionIntentClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupProtectionIntentClient().NewListPager("myVault", "myRG", &armrecoveryservicesbackup.BackupProtectionIntentClientListOptions{Filter: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectionIntentResourceList = armrecoveryservicesbackup.ProtectionIntentResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectionIntentResource{ - // { - // Name: to.Ptr("249D9B07-D2EF-4202-AA64-65F35418564E"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupProtectionIntent"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupFabrics/Azure/backupProtectionIntent/249D9B07-D2EF-4202-AA64-65F35418564E"), - // Properties: &armrecoveryservicesbackup.AzureWorkloadContainerAutoProtectionIntent{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureWorkload), - // ItemID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupProtectionContainer/VMAppContainer;Compute;testVmName/backupProtectableItems/SQLInstance;MSSQLSERVER"), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupPolicies/myPolicy"), - // ProtectionIntentItemType: to.Ptr(armrecoveryservicesbackup.ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourceencryptionconfigs_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourceencryptionconfigs_client.go deleted file mode 100644 index 133c6aed4e26..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourceencryptionconfigs_client.go +++ /dev/null @@ -1,168 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupResourceEncryptionConfigsClient contains the methods for the BackupResourceEncryptionConfigs group. -// Don't use this type directly, use NewBackupResourceEncryptionConfigsClient() instead. -type BackupResourceEncryptionConfigsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupResourceEncryptionConfigsClient creates a new instance of BackupResourceEncryptionConfigsClient 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 NewBackupResourceEncryptionConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupResourceEncryptionConfigsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupResourceEncryptionConfigsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches Vault Encryption config. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupResourceEncryptionConfigsClientGetOptions contains the optional parameters for the BackupResourceEncryptionConfigsClient.Get -// method. -func (client *BackupResourceEncryptionConfigsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceEncryptionConfigsClientGetOptions) (BackupResourceEncryptionConfigsClientGetResponse, error) { - var err error - const operationName = "BackupResourceEncryptionConfigsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, options) - if err != nil { - return BackupResourceEncryptionConfigsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupResourceEncryptionConfigsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return BackupResourceEncryptionConfigsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *BackupResourceEncryptionConfigsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceEncryptionConfigsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *BackupResourceEncryptionConfigsClient) getHandleResponse(resp *http.Response) (BackupResourceEncryptionConfigsClientGetResponse, error) { - result := BackupResourceEncryptionConfigsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupResourceEncryptionConfigExtendedResource); err != nil { - return BackupResourceEncryptionConfigsClientGetResponse{}, err - } - return result, nil -} - -// Update - Updates Vault encryption config. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - Vault encryption input config request -// - options - BackupResourceEncryptionConfigsClientUpdateOptions contains the optional parameters for the BackupResourceEncryptionConfigsClient.Update -// method. -func (client *BackupResourceEncryptionConfigsClient) Update(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceEncryptionConfigResource, options *BackupResourceEncryptionConfigsClientUpdateOptions) (BackupResourceEncryptionConfigsClientUpdateResponse, error) { - var err error - const operationName = "BackupResourceEncryptionConfigsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return BackupResourceEncryptionConfigsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupResourceEncryptionConfigsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return BackupResourceEncryptionConfigsClientUpdateResponse{}, err - } - return BackupResourceEncryptionConfigsClientUpdateResponse{}, nil -} - -// updateCreateRequest creates the Update request. -func (client *BackupResourceEncryptionConfigsClient) updateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceEncryptionConfigResource, options *BackupResourceEncryptionConfigsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourceencryptionconfigs_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourceencryptionconfigs_client_example_test.go deleted file mode 100644 index 83c85754f630..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourceencryptionconfigs_client_example_test.go +++ /dev/null @@ -1,77 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupResourceEncryptionConfig_Get.json -func ExampleBackupResourceEncryptionConfigsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupResourceEncryptionConfigsClient().Get(ctx, "rishTestVault", "rishgrp", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupResourceEncryptionConfigExtendedResource = armrecoveryservicesbackup.BackupResourceEncryptionConfigExtendedResource{ - // Name: to.Ptr("backupResourceEncryptionConfig"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupEncryptionConfigs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rishgrp/providers/Microsoft.RecoveryServicesBVTD2/vaults/rishTestVault/backupEncryptionConfigs/backupResourceEncryptionConfig"), - // Properties: &armrecoveryservicesbackup.BackupResourceEncryptionConfigExtended{ - // EncryptionAtRestType: to.Ptr(armrecoveryservicesbackup.EncryptionAtRestTypeCustomerManaged), - // InfrastructureEncryptionState: to.Ptr(armrecoveryservicesbackup.InfrastructureEncryptionStateDisabled), - // KeyURI: to.Ptr("https://gktestkv1.vault.azure.net/keys/Test1/ed2e8cdc7f86477ebf0c6462b504a9ed"), - // LastUpdateStatus: to.Ptr(armrecoveryservicesbackup.LastUpdateStatusSucceeded), - // SubscriptionID: to.Ptr("1a2311d9-66f5-47d3-a9fb-7a37da63934b"), - // UseSystemAssignedIdentity: to.Ptr(false), - // UserAssignedIdentity: to.Ptr("/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupResourceEncryptionConfig_Put.json -func ExampleBackupResourceEncryptionConfigsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackupResourceEncryptionConfigsClient().Update(ctx, "source-rsv", "test-rg", armrecoveryservicesbackup.BackupResourceEncryptionConfigResource{ - Properties: &armrecoveryservicesbackup.BackupResourceEncryptionConfig{ - EncryptionAtRestType: to.Ptr(armrecoveryservicesbackup.EncryptionAtRestTypeCustomerManaged), - InfrastructureEncryptionState: to.Ptr(armrecoveryservicesbackup.InfrastructureEncryptionState("true")), - KeyURI: to.Ptr("https://gktestkv1.vault.azure.net/keys/Test1/ed2e8cdc7f86477ebf0c6462b504a9ed"), - SubscriptionID: to.Ptr("1a2311d9-66f5-47d3-a9fb-7a37da63934b"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigsnoncrr_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigs_client.go similarity index 61% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigsnoncrr_client.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigs_client.go index 949687f8437b..60a74c7f85c6 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigsnoncrr_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigs_client.go @@ -20,23 +20,23 @@ import ( "strings" ) -// BackupResourceStorageConfigsNonCRRClient contains the methods for the BackupResourceStorageConfigsNonCRR group. -// Don't use this type directly, use NewBackupResourceStorageConfigsNonCRRClient() instead. -type BackupResourceStorageConfigsNonCRRClient struct { +// BackupResourceStorageConfigsClient contains the methods for the BackupResourceStorageConfigs group. +// Don't use this type directly, use NewBackupResourceStorageConfigsClient() instead. +type BackupResourceStorageConfigsClient struct { internal *arm.Client subscriptionID string } -// NewBackupResourceStorageConfigsNonCRRClient creates a new instance of BackupResourceStorageConfigsNonCRRClient with the specified values. +// NewBackupResourceStorageConfigsClient creates a new instance of BackupResourceStorageConfigsClient 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 NewBackupResourceStorageConfigsNonCRRClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupResourceStorageConfigsNonCRRClient, error) { +func NewBackupResourceStorageConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupResourceStorageConfigsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &BackupResourceStorageConfigsNonCRRClient{ + client := &BackupResourceStorageConfigsClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,36 +46,36 @@ func NewBackupResourceStorageConfigsNonCRRClient(subscriptionID string, credenti // Get - Fetches resource storage config. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-01 +// Generated from API version 2024-11-15 // - vaultName - The name of the recovery services vault. // - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupResourceStorageConfigsNonCRRClientGetOptions contains the optional parameters for the BackupResourceStorageConfigsNonCRRClient.Get +// - options - BackupResourceStorageConfigsClientGetOptions contains the optional parameters for the BackupResourceStorageConfigsClient.Get // method. -func (client *BackupResourceStorageConfigsNonCRRClient) Get(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceStorageConfigsNonCRRClientGetOptions) (BackupResourceStorageConfigsNonCRRClientGetResponse, error) { +func (client *BackupResourceStorageConfigsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceStorageConfigsClientGetOptions) (BackupResourceStorageConfigsClientGetResponse, error) { var err error - const operationName = "BackupResourceStorageConfigsNonCRRClient.Get" + const operationName = "BackupResourceStorageConfigsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, options) if err != nil { - return BackupResourceStorageConfigsNonCRRClientGetResponse{}, err + return BackupResourceStorageConfigsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return BackupResourceStorageConfigsNonCRRClientGetResponse{}, err + return BackupResourceStorageConfigsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return BackupResourceStorageConfigsNonCRRClientGetResponse{}, err + return BackupResourceStorageConfigsClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *BackupResourceStorageConfigsNonCRRClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceStorageConfigsNonCRRClientGetOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" +func (client *BackupResourceStorageConfigsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceStorageConfigsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" if vaultName == "" { return nil, errors.New("parameter vaultName cannot be empty") } @@ -93,17 +93,17 @@ func (client *BackupResourceStorageConfigsNonCRRClient) getCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") + reqQP.Set("api-version", "2024-11-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *BackupResourceStorageConfigsNonCRRClient) getHandleResponse(resp *http.Response) (BackupResourceStorageConfigsNonCRRClientGetResponse, error) { - result := BackupResourceStorageConfigsNonCRRClientGetResponse{} +func (client *BackupResourceStorageConfigsClient) getHandleResponse(resp *http.Response) (BackupResourceStorageConfigsClientGetResponse, error) { + result := BackupResourceStorageConfigsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupResourceConfigResource); err != nil { - return BackupResourceStorageConfigsNonCRRClientGetResponse{}, err + return BackupResourceStorageConfigsClientGetResponse{}, err } return result, nil } @@ -111,36 +111,36 @@ func (client *BackupResourceStorageConfigsNonCRRClient) getHandleResponse(resp * // Patch - Updates vault storage model type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-01 +// Generated from API version 2024-11-15 // - vaultName - The name of the recovery services vault. // - resourceGroupName - The name of the resource group where the recovery services vault is present. // - parameters - Vault storage config request -// - options - BackupResourceStorageConfigsNonCRRClientPatchOptions contains the optional parameters for the BackupResourceStorageConfigsNonCRRClient.Patch +// - options - BackupResourceStorageConfigsClientPatchOptions contains the optional parameters for the BackupResourceStorageConfigsClient.Patch // method. -func (client *BackupResourceStorageConfigsNonCRRClient) Patch(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsNonCRRClientPatchOptions) (BackupResourceStorageConfigsNonCRRClientPatchResponse, error) { +func (client *BackupResourceStorageConfigsClient) Patch(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsClientPatchOptions) (BackupResourceStorageConfigsClientPatchResponse, error) { var err error - const operationName = "BackupResourceStorageConfigsNonCRRClient.Patch" + const operationName = "BackupResourceStorageConfigsClient.Patch" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.patchCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) if err != nil { - return BackupResourceStorageConfigsNonCRRClientPatchResponse{}, err + return BackupResourceStorageConfigsClientPatchResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return BackupResourceStorageConfigsNonCRRClientPatchResponse{}, err + return BackupResourceStorageConfigsClientPatchResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return BackupResourceStorageConfigsNonCRRClientPatchResponse{}, err + return BackupResourceStorageConfigsClientPatchResponse{}, err } - return BackupResourceStorageConfigsNonCRRClientPatchResponse{}, nil + return BackupResourceStorageConfigsClientPatchResponse{}, nil } // patchCreateRequest creates the Patch request. -func (client *BackupResourceStorageConfigsNonCRRClient) patchCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsNonCRRClientPatchOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" +func (client *BackupResourceStorageConfigsClient) patchCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" if vaultName == "" { return nil, errors.New("parameter vaultName cannot be empty") } @@ -158,7 +158,7 @@ func (client *BackupResourceStorageConfigsNonCRRClient) patchCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") + reqQP.Set("api-version", "2024-11-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -170,37 +170,37 @@ func (client *BackupResourceStorageConfigsNonCRRClient) patchCreateRequest(ctx c // Update - Updates vault storage model type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-01 +// Generated from API version 2024-11-15 // - vaultName - The name of the recovery services vault. // - resourceGroupName - The name of the resource group where the recovery services vault is present. // - parameters - Vault storage config request -// - options - BackupResourceStorageConfigsNonCRRClientUpdateOptions contains the optional parameters for the BackupResourceStorageConfigsNonCRRClient.Update +// - options - BackupResourceStorageConfigsClientUpdateOptions contains the optional parameters for the BackupResourceStorageConfigsClient.Update // method. -func (client *BackupResourceStorageConfigsNonCRRClient) Update(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsNonCRRClientUpdateOptions) (BackupResourceStorageConfigsNonCRRClientUpdateResponse, error) { +func (client *BackupResourceStorageConfigsClient) Update(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsClientUpdateOptions) (BackupResourceStorageConfigsClientUpdateResponse, error) { var err error - const operationName = "BackupResourceStorageConfigsNonCRRClient.Update" + const operationName = "BackupResourceStorageConfigsClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) if err != nil { - return BackupResourceStorageConfigsNonCRRClientUpdateResponse{}, err + return BackupResourceStorageConfigsClientUpdateResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return BackupResourceStorageConfigsNonCRRClientUpdateResponse{}, err + return BackupResourceStorageConfigsClientUpdateResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return BackupResourceStorageConfigsNonCRRClientUpdateResponse{}, err + return BackupResourceStorageConfigsClientUpdateResponse{}, err } resp, err := client.updateHandleResponse(httpResp) return resp, err } // updateCreateRequest creates the Update request. -func (client *BackupResourceStorageConfigsNonCRRClient) updateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsNonCRRClientUpdateOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" +func (client *BackupResourceStorageConfigsClient) updateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceConfigResource, options *BackupResourceStorageConfigsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" if vaultName == "" { return nil, errors.New("parameter vaultName cannot be empty") } @@ -218,7 +218,7 @@ func (client *BackupResourceStorageConfigsNonCRRClient) updateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") + reqQP.Set("api-version", "2024-11-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -228,10 +228,10 @@ func (client *BackupResourceStorageConfigsNonCRRClient) updateCreateRequest(ctx } // updateHandleResponse handles the Update response. -func (client *BackupResourceStorageConfigsNonCRRClient) updateHandleResponse(resp *http.Response) (BackupResourceStorageConfigsNonCRRClientUpdateResponse, error) { - result := BackupResourceStorageConfigsNonCRRClientUpdateResponse{} +func (client *BackupResourceStorageConfigsClient) updateHandleResponse(resp *http.Response) (BackupResourceStorageConfigsClientUpdateResponse, error) { + result := BackupResourceStorageConfigsClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupResourceConfigResource); err != nil { - return BackupResourceStorageConfigsNonCRRClientUpdateResponse{}, err + return BackupResourceStorageConfigsClientUpdateResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigsnoncrr_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigsnoncrr_client_example_test.go deleted file mode 100644 index d374fbea71c8..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcestorageconfigsnoncrr_client_example_test.go +++ /dev/null @@ -1,106 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Get.json -func ExampleBackupResourceStorageConfigsNonCRRClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupResourceStorageConfigsNonCRRClient().Get(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupResourceConfigResource = armrecoveryservicesbackup.BackupResourceConfigResource{ - // Name: to.Ptr("vaultstorageconfig"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupstorageconfig"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupstorageconfig/vaultstorageconfig"), - // Properties: &armrecoveryservicesbackup.BackupResourceConfig{ - // StorageModelType: to.Ptr(armrecoveryservicesbackup.StorageTypeGeoRedundant), - // StorageType: to.Ptr(armrecoveryservicesbackup.StorageTypeGeoRedundant), - // StorageTypeState: to.Ptr(armrecoveryservicesbackup.StorageTypeStateLocked), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Put.json -func ExampleBackupResourceStorageConfigsNonCRRClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupResourceStorageConfigsNonCRRClient().Update(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", armrecoveryservicesbackup.BackupResourceConfigResource{ - Properties: &armrecoveryservicesbackup.BackupResourceConfig{ - StorageType: to.Ptr(armrecoveryservicesbackup.StorageTypeLocallyRedundant), - StorageTypeState: to.Ptr(armrecoveryservicesbackup.StorageTypeStateUnlocked), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupResourceConfigResource = armrecoveryservicesbackup.BackupResourceConfigResource{ - // Name: to.Ptr("vaultstorageconfig"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupstorageconfig"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupstorageconfig/vaultstorageconfig"), - // Properties: &armrecoveryservicesbackup.BackupResourceConfig{ - // StorageModelType: to.Ptr(armrecoveryservicesbackup.StorageTypeLocallyRedundant), - // StorageType: to.Ptr(armrecoveryservicesbackup.StorageTypeLocallyRedundant), - // StorageTypeState: to.Ptr(armrecoveryservicesbackup.StorageTypeStateUnlocked), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Patch.json -func ExampleBackupResourceStorageConfigsNonCRRClient_Patch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackupResourceStorageConfigsNonCRRClient().Patch(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", armrecoveryservicesbackup.BackupResourceConfigResource{ - Properties: &armrecoveryservicesbackup.BackupResourceConfig{ - StorageType: to.Ptr(armrecoveryservicesbackup.StorageTypeLocallyRedundant), - StorageTypeState: to.Ptr(armrecoveryservicesbackup.StorageTypeStateUnlocked), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcevaultconfigs_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcevaultconfigs_client.go deleted file mode 100644 index 932b10bb7fbe..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcevaultconfigs_client.go +++ /dev/null @@ -1,253 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupResourceVaultConfigsClient contains the methods for the BackupResourceVaultConfigs group. -// Don't use this type directly, use NewBackupResourceVaultConfigsClient() instead. -type BackupResourceVaultConfigsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupResourceVaultConfigsClient creates a new instance of BackupResourceVaultConfigsClient 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 NewBackupResourceVaultConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupResourceVaultConfigsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupResourceVaultConfigsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches resource vault config. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupResourceVaultConfigsClientGetOptions contains the optional parameters for the BackupResourceVaultConfigsClient.Get -// method. -func (client *BackupResourceVaultConfigsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceVaultConfigsClientGetOptions) (BackupResourceVaultConfigsClientGetResponse, error) { - var err error - const operationName = "BackupResourceVaultConfigsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, options) - if err != nil { - return BackupResourceVaultConfigsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupResourceVaultConfigsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return BackupResourceVaultConfigsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *BackupResourceVaultConfigsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupResourceVaultConfigsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *BackupResourceVaultConfigsClient) getHandleResponse(resp *http.Response) (BackupResourceVaultConfigsClientGetResponse, error) { - result := BackupResourceVaultConfigsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupResourceVaultConfigResource); err != nil { - return BackupResourceVaultConfigsClientGetResponse{}, err - } - return result, nil -} - -// Put - Updates vault security config. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - resource config request -// - options - BackupResourceVaultConfigsClientPutOptions contains the optional parameters for the BackupResourceVaultConfigsClient.Put -// method. -func (client *BackupResourceVaultConfigsClient) Put(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource, options *BackupResourceVaultConfigsClientPutOptions) (BackupResourceVaultConfigsClientPutResponse, error) { - var err error - const operationName = "BackupResourceVaultConfigsClient.Put" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.putCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return BackupResourceVaultConfigsClientPutResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupResourceVaultConfigsClientPutResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return BackupResourceVaultConfigsClientPutResponse{}, err - } - resp, err := client.putHandleResponse(httpResp) - return resp, err -} - -// putCreateRequest creates the Put request. -func (client *BackupResourceVaultConfigsClient) putCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource, options *BackupResourceVaultConfigsClientPutOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.XMSAuthorizationAuxiliary != nil { - req.Raw().Header["x-ms-authorization-auxiliary"] = []string{*options.XMSAuthorizationAuxiliary} - } - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// putHandleResponse handles the Put response. -func (client *BackupResourceVaultConfigsClient) putHandleResponse(resp *http.Response) (BackupResourceVaultConfigsClientPutResponse, error) { - result := BackupResourceVaultConfigsClientPutResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupResourceVaultConfigResource); err != nil { - return BackupResourceVaultConfigsClientPutResponse{}, err - } - return result, nil -} - -// Update - Updates vault security config. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - resource config request -// - options - BackupResourceVaultConfigsClientUpdateOptions contains the optional parameters for the BackupResourceVaultConfigsClient.Update -// method. -func (client *BackupResourceVaultConfigsClient) Update(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource, options *BackupResourceVaultConfigsClientUpdateOptions) (BackupResourceVaultConfigsClientUpdateResponse, error) { - var err error - const operationName = "BackupResourceVaultConfigsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return BackupResourceVaultConfigsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupResourceVaultConfigsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return BackupResourceVaultConfigsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *BackupResourceVaultConfigsClient) updateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource, options *BackupResourceVaultConfigsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.XMSAuthorizationAuxiliary != nil { - req.Raw().Header["x-ms-authorization-auxiliary"] = []string{*options.XMSAuthorizationAuxiliary} - } - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *BackupResourceVaultConfigsClient) updateHandleResponse(resp *http.Response) (BackupResourceVaultConfigsClientUpdateResponse, error) { - result := BackupResourceVaultConfigsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupResourceVaultConfigResource); err != nil { - return BackupResourceVaultConfigsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcevaultconfigs_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcevaultconfigs_client_example_test.go deleted file mode 100644 index b64676bc9555..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupresourcevaultconfigs_client_example_test.go +++ /dev/null @@ -1,113 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Get.json -func ExampleBackupResourceVaultConfigsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupResourceVaultConfigsClient().Get(ctx, "SwaggerTest", "SwaggerTestRg", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupResourceVaultConfigResource = armrecoveryservicesbackup.BackupResourceVaultConfigResource{ - // Name: to.Ptr("vaultconfig"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/SwaggerTest/backupconfig/vaultconfig"), - // Properties: &armrecoveryservicesbackup.BackupResourceVaultConfig{ - // EnhancedSecurityState: to.Ptr(armrecoveryservicesbackup.EnhancedSecurityStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Patch.json -func ExampleBackupResourceVaultConfigsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupResourceVaultConfigsClient().Update(ctx, "SwaggerTest", "SwaggerTestRg", armrecoveryservicesbackup.BackupResourceVaultConfigResource{ - Properties: &armrecoveryservicesbackup.BackupResourceVaultConfig{ - EnhancedSecurityState: to.Ptr(armrecoveryservicesbackup.EnhancedSecurityStateEnabled), - }, - }, &armrecoveryservicesbackup.BackupResourceVaultConfigsClientUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupResourceVaultConfigResource = armrecoveryservicesbackup.BackupResourceVaultConfigResource{ - // Name: to.Ptr("vaultconfig"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/SwaggerTest/backupconfig/vaultconfig"), - // Properties: &armrecoveryservicesbackup.BackupResourceVaultConfig{ - // EnhancedSecurityState: to.Ptr(armrecoveryservicesbackup.EnhancedSecurityStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Put.json -func ExampleBackupResourceVaultConfigsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupResourceVaultConfigsClient().Put(ctx, "SwaggerTest", "SwaggerTestRg", armrecoveryservicesbackup.BackupResourceVaultConfigResource{ - Properties: &armrecoveryservicesbackup.BackupResourceVaultConfig{ - EnhancedSecurityState: to.Ptr(armrecoveryservicesbackup.EnhancedSecurityStateEnabled), - SoftDeleteFeatureState: to.Ptr(armrecoveryservicesbackup.SoftDeleteFeatureStateEnabled), - }, - }, &armrecoveryservicesbackup.BackupResourceVaultConfigsClientPutOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupResourceVaultConfigResource = armrecoveryservicesbackup.BackupResourceVaultConfigResource{ - // Name: to.Ptr("vaultconfig"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/SwaggerTest/backupconfig/vaultconfig"), - // Properties: &armrecoveryservicesbackup.BackupResourceVaultConfig{ - // EnhancedSecurityState: to.Ptr(armrecoveryservicesbackup.EnhancedSecurityStateEnabled), - // SoftDeleteFeatureState: to.Ptr(armrecoveryservicesbackup.SoftDeleteFeatureStateEnabled), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backups_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backups_client.go deleted file mode 100644 index 27f15d816c11..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backups_client.go +++ /dev/null @@ -1,118 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupsClient contains the methods for the Backups group. -// Don't use this type directly, use NewBackupsClient() instead. -type BackupsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupsClient creates a new instance of BackupsClient 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 NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Trigger - Triggers backup for specified backed up item. This is an asynchronous operation. To know the status of the operation, -// call GetProtectedItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backup item. -// - containerName - Container name associated with the backup item. -// - protectedItemName - Backup item for which backup needs to be triggered. -// - parameters - resource backup request -// - options - BackupsClientTriggerOptions contains the optional parameters for the BackupsClient.Trigger method. -func (client *BackupsClient) Trigger(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters BackupRequestResource, options *BackupsClientTriggerOptions) (BackupsClientTriggerResponse, error) { - var err error - const operationName = "BackupsClient.Trigger" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.triggerCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters, options) - if err != nil { - return BackupsClientTriggerResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BackupsClientTriggerResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return BackupsClientTriggerResponse{}, err - } - return BackupsClientTriggerResponse{}, nil -} - -// triggerCreateRequest creates the Trigger request. -func (client *BackupsClient) triggerCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters BackupRequestResource, options *BackupsClientTriggerOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backups_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backups_client_example_test.go deleted file mode 100644 index 85ba24c20ab6..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backups_client_example_test.go +++ /dev/null @@ -1,40 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerBackup_Post.json -func ExampleBackupsClient_Trigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackupsClient().Trigger(ctx, "linuxRsVault", "linuxRsVaultRG", "Azure", "IaasVMContainer;iaasvmcontainerv2;testrg;v1win2012r", "VM;iaasvmcontainerv2;testrg;v1win2012r", armrecoveryservicesbackup.BackupRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMBackupRequest{ - ObjectType: to.Ptr("IaasVMBackupRequest"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupstatus_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupstatus_client_example_test.go deleted file mode 100644 index e4ebfa427ff2..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupstatus_client_example_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/GetBackupStatus.json -func ExampleBackupStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupStatusClient().Get(ctx, "southeastasia", armrecoveryservicesbackup.BackupStatusRequest{ - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Compute/VirtualMachines/testVm"), - ResourceType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupStatusResponse = armrecoveryservicesbackup.BackupStatusResponse{ - // ContainerName: to.Ptr("iaasvmcontainer;iaasvmcontainerv2;testRg;testVm"), - // ErrorCode: to.Ptr("Success"), - // ErrorMessage: to.Ptr("ErrorMessage"), - // FabricName: to.Ptr(armrecoveryservicesbackup.FabricNameAzure), - // PolicyName: to.Ptr("myPolicy"), - // ProtectedItemName: to.Ptr("vm;iaasvmcontainerv2;testRg;testVm"), - // ProtectionStatus: to.Ptr(armrecoveryservicesbackup.ProtectionStatusProtected), - // VaultID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.RecoveryServices/Vaults/testVault"), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummaries_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummaries_client_example_test.go deleted file mode 100644 index 9a96ca60aa5d..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummaries_client_example_test.go +++ /dev/null @@ -1,151 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupProtectionContainers_UsageSummary_Get.json -func ExampleBackupUsageSummariesClient_NewListPager_getProtectedContainersUsagesSummary() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupUsageSummariesClient().NewListPager("testVault", "testRG", &armrecoveryservicesbackup.BackupUsageSummariesClientListOptions{Filter: to.Ptr("type eq 'BackupProtectionContainerCountSummary'"), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BackupManagementUsageList = armrecoveryservicesbackup.BackupManagementUsageList{ - // Value: []*armrecoveryservicesbackup.BackupManagementUsage{ - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("Azure Backup Server"), - // Value: to.Ptr("AzureBackupServer"), - // }, - // CurrentValue: to.Ptr[int64](2), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }, - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("Azure Backup Agent"), - // Value: to.Ptr("MAB"), - // }, - // CurrentValue: to.Ptr[int64](3), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }, - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("SQL in Azure VM"), - // Value: to.Ptr("AzureWorkload"), - // }, - // CurrentValue: to.Ptr[int64](1), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupProtectedItem_UsageSummary_Get.json -func ExampleBackupUsageSummariesClient_NewListPager_getProtectedItemsUsagesSummary() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupUsageSummariesClient().NewListPager("testVault", "testRG", &armrecoveryservicesbackup.BackupUsageSummariesClientListOptions{Filter: to.Ptr("type eq 'BackupProtectedItemCountSummary'"), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BackupManagementUsageList = armrecoveryservicesbackup.BackupManagementUsageList{ - // Value: []*armrecoveryservicesbackup.BackupManagementUsage{ - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("Azure Virtual Machine"), - // Value: to.Ptr("AzureIaasVM"), - // }, - // CurrentValue: to.Ptr[int64](7), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }, - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("Azure Backup Agent"), - // Value: to.Ptr("MAB"), - // }, - // CurrentValue: to.Ptr[int64](3), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }, - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("Azure Backup Server"), - // Value: to.Ptr("AzureBackupServer"), - // }, - // CurrentValue: to.Ptr[int64](1), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }, - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("Azure Storage (Azure Files)"), - // Value: to.Ptr("AzureStorage"), - // }, - // CurrentValue: to.Ptr[int64](2), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }, - // { - // Name: &armrecoveryservicesbackup.NameInfo{ - // LocalizedValue: to.Ptr("SQL in Azure VM"), - // Value: to.Ptr("AzureWorkload"), - // }, - // CurrentValue: to.Ptr[int64](2), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr(armrecoveryservicesbackup.UsagesUnitCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummaries_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummariescrr_client.go similarity index 63% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummaries_client.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummariescrr_client.go index fba65f2b1d3f..6a4e844d9428 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummaries_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupusagesummariescrr_client.go @@ -20,23 +20,23 @@ import ( "strings" ) -// BackupUsageSummariesClient contains the methods for the BackupUsageSummaries group. -// Don't use this type directly, use NewBackupUsageSummariesClient() instead. -type BackupUsageSummariesClient struct { +// BackupUsageSummariesCRRClient contains the methods for the BackupUsageSummariesCRR group. +// Don't use this type directly, use NewBackupUsageSummariesCRRClient() instead. +type BackupUsageSummariesCRRClient struct { internal *arm.Client subscriptionID string } -// NewBackupUsageSummariesClient creates a new instance of BackupUsageSummariesClient with the specified values. +// NewBackupUsageSummariesCRRClient creates a new instance of BackupUsageSummariesCRRClient 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 NewBackupUsageSummariesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupUsageSummariesClient, error) { +func NewBackupUsageSummariesCRRClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupUsageSummariesCRRClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &BackupUsageSummariesClient{ + client := &BackupUsageSummariesCRRClient{ subscriptionID: subscriptionID, internal: cl, } @@ -45,28 +45,28 @@ func NewBackupUsageSummariesClient(subscriptionID string, credential azcore.Toke // NewListPager - Fetches the backup management usage summaries of the vault. // -// Generated from API version 2024-04-01 +// Generated from API version 2024-11-15 // - vaultName - The name of the recovery services vault. // - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BackupUsageSummariesClientListOptions contains the optional parameters for the BackupUsageSummariesClient.NewListPager +// - options - BackupUsageSummariesCRRClientListOptions contains the optional parameters for the BackupUsageSummariesCRRClient.NewListPager // method. -func (client *BackupUsageSummariesClient) NewListPager(vaultName string, resourceGroupName string, options *BackupUsageSummariesClientListOptions) *runtime.Pager[BackupUsageSummariesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupUsageSummariesClientListResponse]{ - More: func(page BackupUsageSummariesClientListResponse) bool { +func (client *BackupUsageSummariesCRRClient) NewListPager(vaultName string, resourceGroupName string, options *BackupUsageSummariesCRRClientListOptions) *runtime.Pager[BackupUsageSummariesCRRClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupUsageSummariesCRRClientListResponse]{ + More: func(page BackupUsageSummariesCRRClientListResponse) bool { return false }, - Fetcher: func(ctx context.Context, page *BackupUsageSummariesClientListResponse) (BackupUsageSummariesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupUsageSummariesClient.NewListPager") + Fetcher: func(ctx context.Context, page *BackupUsageSummariesCRRClientListResponse) (BackupUsageSummariesCRRClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupUsageSummariesCRRClient.NewListPager") req, err := client.listCreateRequest(ctx, vaultName, resourceGroupName, options) if err != nil { - return BackupUsageSummariesClientListResponse{}, err + return BackupUsageSummariesCRRClientListResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { - return BackupUsageSummariesClientListResponse{}, err + return BackupUsageSummariesCRRClientListResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupUsageSummariesClientListResponse{}, runtime.NewResponseError(resp) + return BackupUsageSummariesCRRClientListResponse{}, runtime.NewResponseError(resp) } return client.listHandleResponse(resp) }, @@ -75,8 +75,8 @@ func (client *BackupUsageSummariesClient) NewListPager(vaultName string, resourc } // listCreateRequest creates the List request. -func (client *BackupUsageSummariesClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupUsageSummariesClientListOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries" +func (client *BackupUsageSummariesCRRClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *BackupUsageSummariesCRRClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries" if vaultName == "" { return nil, errors.New("parameter vaultName cannot be empty") } @@ -100,17 +100,17 @@ func (client *BackupUsageSummariesClient) listCreateRequest(ctx context.Context, if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } - reqQP.Set("api-version", "2024-04-01") + reqQP.Set("api-version", "2024-11-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *BackupUsageSummariesClient) listHandleResponse(resp *http.Response) (BackupUsageSummariesClientListResponse, error) { - result := BackupUsageSummariesClientListResponse{} +func (client *BackupUsageSummariesCRRClient) listHandleResponse(resp *http.Response) (BackupUsageSummariesCRRClientListResponse, error) { + result := BackupUsageSummariesCRRClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.BackupManagementUsageList); err != nil { - return BackupUsageSummariesClientListResponse{}, err + return BackupUsageSummariesCRRClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupworkloaditems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupworkloaditems_client.go deleted file mode 100644 index 393ccbebf0a0..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupworkloaditems_client.go +++ /dev/null @@ -1,126 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BackupWorkloadItemsClient contains the methods for the BackupWorkloadItems group. -// Don't use this type directly, use NewBackupWorkloadItemsClient() instead. -type BackupWorkloadItemsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBackupWorkloadItemsClient creates a new instance of BackupWorkloadItemsClient 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 NewBackupWorkloadItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupWorkloadItemsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BackupWorkloadItemsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Provides a pageable list of workload item of a specific container according to the query filter and the -// pagination parameters. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the container. -// - containerName - Name of the container. -// - options - BackupWorkloadItemsClientListOptions contains the optional parameters for the BackupWorkloadItemsClient.NewListPager -// method. -func (client *BackupWorkloadItemsClient) NewListPager(vaultName string, resourceGroupName string, fabricName string, containerName string, options *BackupWorkloadItemsClientListOptions) *runtime.Pager[BackupWorkloadItemsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupWorkloadItemsClientListResponse]{ - More: func(page BackupWorkloadItemsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupWorkloadItemsClientListResponse) (BackupWorkloadItemsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupWorkloadItemsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, options) - }, nil) - if err != nil { - return BackupWorkloadItemsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BackupWorkloadItemsClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *BackupWorkloadItemsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BackupWorkloadItemsClient) listHandleResponse(resp *http.Response) (BackupWorkloadItemsClientListResponse, error) { - result := BackupWorkloadItemsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadItemResourceList); err != nil { - return BackupWorkloadItemsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupworkloaditems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupworkloaditems_client_example_test.go deleted file mode 100644 index 3a2b7eb5a942..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/backupworkloaditems_client_example_test.go +++ /dev/null @@ -1,75 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupWorkloadItems_List.json -func ExampleBackupWorkloadItemsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupWorkloadItemsClient().NewListPager("suchandr-seacan-rsv", "testRg", "Azure", "VMAppContainer;Compute;bvtdtestag;sqlserver-1", &armrecoveryservicesbackup.BackupWorkloadItemsClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureWorkload'"), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WorkloadItemResourceList = armrecoveryservicesbackup.WorkloadItemResourceList{ - // Value: []*armrecoveryservicesbackup.WorkloadItemResource{ - // { - // Name: to.Ptr("SQLInstance;MSSQLSERVER"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/items"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testRg/providers/Microsoft.RecoveryServices/vaults/suchandr-seacan-rsv/backupFabrics/Azure/protectionContainers/VMAppContainer;Compute;bvtdtestag;sqlserver-1/protectableItems/SQLInstance;MSSQLSERVER"), - // Properties: &armrecoveryservicesbackup.AzureVMWorkloadSQLInstanceWorkloadItem{ - // BackupManagementType: to.Ptr("AzureWorkload"), - // FriendlyName: to.Ptr("MSSQLSERVER"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStatusNotProtected), - // WorkloadItemType: to.Ptr("SQLInstance"), - // WorkloadType: to.Ptr("SQL"), - // IsAutoProtectable: to.Ptr(true), - // ParentName: to.Ptr("MSSQLSERVER"), - // ServerName: to.Ptr("sqlserver-1.contoso.com"), - // SubWorkloadItemCount: to.Ptr[int32](3), - // Subinquireditemcount: to.Ptr[int32](0), - // DataDirectoryPaths: []*armrecoveryservicesbackup.SQLDataDirectory{ - // { - // Type: to.Ptr(armrecoveryservicesbackup.SQLDataDirectoryTypeData), - // Path: to.Ptr("F:\\DATA\\"), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.SQLDataDirectoryTypeLog), - // Path: to.Ptr("F:\\LOG\\"), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/bmspreparedatamoveoperationresult_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/bmspreparedatamoveoperationresult_client.go deleted file mode 100644 index 8c2fa04c2c02..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/bmspreparedatamoveoperationresult_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// BMSPrepareDataMoveOperationResultClient contains the methods for the BMSPrepareDataMoveOperationResult group. -// Don't use this type directly, use NewBMSPrepareDataMoveOperationResultClient() instead. -type BMSPrepareDataMoveOperationResultClient struct { - internal *arm.Client - subscriptionID string -} - -// NewBMSPrepareDataMoveOperationResultClient creates a new instance of BMSPrepareDataMoveOperationResultClient 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 NewBMSPrepareDataMoveOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BMSPrepareDataMoveOperationResultClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BMSPrepareDataMoveOperationResultClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches Operation Result for Prepare Data Move -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - BMSPrepareDataMoveOperationResultClientGetOptions contains the optional parameters for the BMSPrepareDataMoveOperationResultClient.Get -// method. -func (client *BMSPrepareDataMoveOperationResultClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BMSPrepareDataMoveOperationResultClientGetOptions) (BMSPrepareDataMoveOperationResultClientGetResponse, error) { - var err error - const operationName = "BMSPrepareDataMoveOperationResultClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) - if err != nil { - return BMSPrepareDataMoveOperationResultClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BMSPrepareDataMoveOperationResultClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return BMSPrepareDataMoveOperationResultClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *BMSPrepareDataMoveOperationResultClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *BMSPrepareDataMoveOperationResultClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *BMSPrepareDataMoveOperationResultClient) getHandleResponse(resp *http.Response) (BMSPrepareDataMoveOperationResultClientGetResponse, error) { - result := BMSPrepareDataMoveOperationResultClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return BMSPrepareDataMoveOperationResultClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/bmspreparedatamoveoperationresult_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/bmspreparedatamoveoperationresult_client_example_test.go deleted file mode 100644 index 95d7d4eaa56e..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/bmspreparedatamoveoperationresult_client_example_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/PrepareDataMoveOperationResult_Get.json -func ExampleBMSPrepareDataMoveOperationResultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBMSPrepareDataMoveOperationResultClient().Get(ctx, "source-rsv", "sourceRG", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armrecoveryservicesbackup.BMSPrepareDataMoveOperationResultClientGetResponse{ - // VaultStorageConfigOperationResultResponseClassification: &armrecoveryservicesbackup.PrepareDataMoveResponse{ - // ObjectType: to.Ptr("PrepareDataMoveResponse"), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client.go deleted file mode 100644 index 91511cf49bbf..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client.go +++ /dev/null @@ -1,367 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// Client contains the methods for the RecoveryServicesBackupClient group. -// Don't use this type directly, use NewClient() instead. -type Client struct { - internal *arm.Client - subscriptionID string -} - -// NewClient creates a new instance of Client 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 NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &Client{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginBMSPrepareDataMove - Prepares source vault for Data Move operation -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - Prepare data move request -// - options - ClientBeginBMSPrepareDataMoveOptions contains the optional parameters for the Client.BeginBMSPrepareDataMove -// method. -func (client *Client) BeginBMSPrepareDataMove(ctx context.Context, vaultName string, resourceGroupName string, parameters PrepareDataMoveRequest, options *ClientBeginBMSPrepareDataMoveOptions) (*runtime.Poller[ClientBMSPrepareDataMoveResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.bMSPrepareDataMove(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientBMSPrepareDataMoveResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientBMSPrepareDataMoveResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// BMSPrepareDataMove - Prepares source vault for Data Move operation -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *Client) bMSPrepareDataMove(ctx context.Context, vaultName string, resourceGroupName string, parameters PrepareDataMoveRequest, options *ClientBeginBMSPrepareDataMoveOptions) (*http.Response, error) { - var err error - const operationName = "Client.BeginBMSPrepareDataMove" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.bmsPrepareDataMoveCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// bmsPrepareDataMoveCreateRequest creates the BMSPrepareDataMove request. -func (client *Client) bmsPrepareDataMoveCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters PrepareDataMoveRequest, options *ClientBeginBMSPrepareDataMoveOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginBMSTriggerDataMove - Triggers Data Move Operation on target vault -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - Trigger data move request -// - options - ClientBeginBMSTriggerDataMoveOptions contains the optional parameters for the Client.BeginBMSTriggerDataMove -// method. -func (client *Client) BeginBMSTriggerDataMove(ctx context.Context, vaultName string, resourceGroupName string, parameters TriggerDataMoveRequest, options *ClientBeginBMSTriggerDataMoveOptions) (*runtime.Poller[ClientBMSTriggerDataMoveResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.bMSTriggerDataMove(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientBMSTriggerDataMoveResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientBMSTriggerDataMoveResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// BMSTriggerDataMove - Triggers Data Move Operation on target vault -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *Client) bMSTriggerDataMove(ctx context.Context, vaultName string, resourceGroupName string, parameters TriggerDataMoveRequest, options *ClientBeginBMSTriggerDataMoveOptions) (*http.Response, error) { - var err error - const operationName = "Client.BeginBMSTriggerDataMove" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.bmsTriggerDataMoveCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// bmsTriggerDataMoveCreateRequest creates the BMSTriggerDataMove request. -func (client *Client) bmsTriggerDataMoveCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters TriggerDataMoveRequest, options *ClientBeginBMSTriggerDataMoveOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// GetOperationStatus - Fetches operation status for data move operation on vault -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - ClientGetOperationStatusOptions contains the optional parameters for the Client.GetOperationStatus method. -func (client *Client) GetOperationStatus(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ClientGetOperationStatusOptions) (ClientGetOperationStatusResponse, error) { - var err error - const operationName = "Client.GetOperationStatus" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getOperationStatusCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) - if err != nil { - return ClientGetOperationStatusResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClientGetOperationStatusResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ClientGetOperationStatusResponse{}, err - } - resp, err := client.getOperationStatusHandleResponse(httpResp) - return resp, err -} - -// getOperationStatusCreateRequest creates the GetOperationStatus request. -func (client *Client) getOperationStatusCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ClientGetOperationStatusOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getOperationStatusHandleResponse handles the GetOperationStatus response. -func (client *Client) getOperationStatusHandleResponse(resp *http.Response) (ClientGetOperationStatusResponse, error) { - result := ClientGetOperationStatusResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ClientGetOperationStatusResponse{}, err - } - return result, nil -} - -// BeginMoveRecoveryPoint - Move recovery point from one datastore to another store. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - Move Resource Across Tiers Request -// - options - ClientBeginMoveRecoveryPointOptions contains the optional parameters for the Client.BeginMoveRecoveryPoint method. -func (client *Client) BeginMoveRecoveryPoint(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters MoveRPAcrossTiersRequest, options *ClientBeginMoveRecoveryPointOptions) (*runtime.Poller[ClientMoveRecoveryPointResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.moveRecoveryPoint(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientMoveRecoveryPointResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientMoveRecoveryPointResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// MoveRecoveryPoint - Move recovery point from one datastore to another store. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *Client) moveRecoveryPoint(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters MoveRPAcrossTiersRequest, options *ClientBeginMoveRecoveryPointOptions) (*http.Response, error) { - var err error - const operationName = "Client.BeginMoveRecoveryPoint" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.moveRecoveryPointCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// moveRecoveryPointCreateRequest creates the MoveRecoveryPoint request. -func (client *Client) moveRecoveryPointCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters MoveRPAcrossTiersRequest, options *ClientBeginMoveRecoveryPointOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - if recoveryPointID == "" { - return nil, errors.New("parameter recoveryPointID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{recoveryPointId}", url.PathEscape(recoveryPointID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client_example_test.go deleted file mode 100644 index 9dcc11449398..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client_example_test.go +++ /dev/null @@ -1,122 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/BackupDataMoveOperationStatus_Get.json -func ExampleClient_GetOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().GetOperationStatus(ctx, "source-rsv", "sourceRG", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armrecoveryservicesbackup.OperationStatus{ - // Name: to.Ptr("0f48183b-0a44-4dca-aec1-bba5daab888a"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T11:59:47.590Z"); return t}()), - // ID: to.Ptr("0f48183b-0a44-4dca-aec1-bba5daab888a"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T11:59:47.590Z"); return t}()), - // Status: to.Ptr(armrecoveryservicesbackup.OperationStatusValuesSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/PrepareDataMove_Post.json -func ExampleClient_BeginBMSPrepareDataMove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginBMSPrepareDataMove(ctx, "source-rsv", "sourceRG", armrecoveryservicesbackup.PrepareDataMoveRequest{ - DataMoveLevel: to.Ptr(armrecoveryservicesbackup.DataMoveLevelVault), - TargetRegion: to.Ptr("USGov Virginia"), - TargetResourceID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/targetRG/providers/Microsoft.RecoveryServices/vaults/target-rsv"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/TriggerDataMove_Post.json -func ExampleClient_BeginBMSTriggerDataMove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginBMSTriggerDataMove(ctx, "target-rsv", "targetRG", armrecoveryservicesbackup.TriggerDataMoveRequest{ - CorrelationID: to.Ptr("MTg2OTcyMzM4NzYyMjc1NDY3Nzs1YmUzYmVmNi04YjJiLTRhOTItOTllYi01NTM0MDllYjk2NjE="), - DataMoveLevel: to.Ptr(armrecoveryservicesbackup.DataMoveLevelVault), - SourceRegion: to.Ptr("USGov Iowa"), - SourceResourceID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/sourceRG/providers/Microsoft.RecoveryServices/vaults/source-rsv"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TriggerRecoveryPointMove_Post.json -func ExampleClient_BeginMoveRecoveryPoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginMoveRecoveryPoint(ctx, "testVault", "netsdktestrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", armrecoveryservicesbackup.MoveRPAcrossTiersRequest{ - ObjectType: to.Ptr("MoveRPAcrossTiersRequest"), - SourceTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - TargetTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeArchivedRP), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client_factory.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client_factory.go index 94c9497feaff..64be871e1e86 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client_factory.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/client_factory.go @@ -36,344 +36,73 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -// NewBMSPrepareDataMoveOperationResultClient creates a new instance of BMSPrepareDataMoveOperationResultClient. -func (c *ClientFactory) NewBMSPrepareDataMoveOperationResultClient() *BMSPrepareDataMoveOperationResultClient { - return &BMSPrepareDataMoveOperationResultClient{ +// NewAADPropertiesClient creates a new instance of AADPropertiesClient. +func (c *ClientFactory) NewAADPropertiesClient() *AADPropertiesClient { + return &AADPropertiesClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupEnginesClient creates a new instance of BackupEnginesClient. -func (c *ClientFactory) NewBackupEnginesClient() *BackupEnginesClient { - return &BackupEnginesClient{ +// NewBackupCrrJobDetailsClient creates a new instance of BackupCrrJobDetailsClient. +func (c *ClientFactory) NewBackupCrrJobDetailsClient() *BackupCrrJobDetailsClient { + return &BackupCrrJobDetailsClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupJobsClient creates a new instance of BackupJobsClient. -func (c *ClientFactory) NewBackupJobsClient() *BackupJobsClient { - return &BackupJobsClient{ +// NewBackupCrrJobsClient creates a new instance of BackupCrrJobsClient. +func (c *ClientFactory) NewBackupCrrJobsClient() *BackupCrrJobsClient { + return &BackupCrrJobsClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupOperationResultsClient creates a new instance of BackupOperationResultsClient. -func (c *ClientFactory) NewBackupOperationResultsClient() *BackupOperationResultsClient { - return &BackupOperationResultsClient{ +// NewBackupProtectedItemsCrrClient creates a new instance of BackupProtectedItemsCrrClient. +func (c *ClientFactory) NewBackupProtectedItemsCrrClient() *BackupProtectedItemsCrrClient { + return &BackupProtectedItemsCrrClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupOperationStatusesClient creates a new instance of BackupOperationStatusesClient. -func (c *ClientFactory) NewBackupOperationStatusesClient() *BackupOperationStatusesClient { - return &BackupOperationStatusesClient{ +// NewBackupResourceStorageConfigsClient creates a new instance of BackupResourceStorageConfigsClient. +func (c *ClientFactory) NewBackupResourceStorageConfigsClient() *BackupResourceStorageConfigsClient { + return &BackupResourceStorageConfigsClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupPoliciesClient creates a new instance of BackupPoliciesClient. -func (c *ClientFactory) NewBackupPoliciesClient() *BackupPoliciesClient { - return &BackupPoliciesClient{ +// NewBackupUsageSummariesCRRClient creates a new instance of BackupUsageSummariesCRRClient. +func (c *ClientFactory) NewBackupUsageSummariesCRRClient() *BackupUsageSummariesCRRClient { + return &BackupUsageSummariesCRRClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupProtectableItemsClient creates a new instance of BackupProtectableItemsClient. -func (c *ClientFactory) NewBackupProtectableItemsClient() *BackupProtectableItemsClient { - return &BackupProtectableItemsClient{ +// NewCrossRegionRestoreClient creates a new instance of CrossRegionRestoreClient. +func (c *ClientFactory) NewCrossRegionRestoreClient() *CrossRegionRestoreClient { + return &CrossRegionRestoreClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupProtectedItemsClient creates a new instance of BackupProtectedItemsClient. -func (c *ClientFactory) NewBackupProtectedItemsClient() *BackupProtectedItemsClient { - return &BackupProtectedItemsClient{ +// NewCrrOperationResultsClient creates a new instance of CrrOperationResultsClient. +func (c *ClientFactory) NewCrrOperationResultsClient() *CrrOperationResultsClient { + return &CrrOperationResultsClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewBackupProtectionContainersClient creates a new instance of BackupProtectionContainersClient. -func (c *ClientFactory) NewBackupProtectionContainersClient() *BackupProtectionContainersClient { - return &BackupProtectionContainersClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupProtectionIntentClient creates a new instance of BackupProtectionIntentClient. -func (c *ClientFactory) NewBackupProtectionIntentClient() *BackupProtectionIntentClient { - return &BackupProtectionIntentClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupResourceEncryptionConfigsClient creates a new instance of BackupResourceEncryptionConfigsClient. -func (c *ClientFactory) NewBackupResourceEncryptionConfigsClient() *BackupResourceEncryptionConfigsClient { - return &BackupResourceEncryptionConfigsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupResourceStorageConfigsNonCRRClient creates a new instance of BackupResourceStorageConfigsNonCRRClient. -func (c *ClientFactory) NewBackupResourceStorageConfigsNonCRRClient() *BackupResourceStorageConfigsNonCRRClient { - return &BackupResourceStorageConfigsNonCRRClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupResourceVaultConfigsClient creates a new instance of BackupResourceVaultConfigsClient. -func (c *ClientFactory) NewBackupResourceVaultConfigsClient() *BackupResourceVaultConfigsClient { - return &BackupResourceVaultConfigsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupStatusClient creates a new instance of BackupStatusClient. -func (c *ClientFactory) NewBackupStatusClient() *BackupStatusClient { - return &BackupStatusClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupUsageSummariesClient creates a new instance of BackupUsageSummariesClient. -func (c *ClientFactory) NewBackupUsageSummariesClient() *BackupUsageSummariesClient { - return &BackupUsageSummariesClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupWorkloadItemsClient creates a new instance of BackupWorkloadItemsClient. -func (c *ClientFactory) NewBackupWorkloadItemsClient() *BackupWorkloadItemsClient { - return &BackupWorkloadItemsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewBackupsClient creates a new instance of BackupsClient. -func (c *ClientFactory) NewBackupsClient() *BackupsClient { - return &BackupsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewClient creates a new instance of Client. -func (c *ClientFactory) NewClient() *Client { - return &Client{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewDeletedProtectionContainersClient creates a new instance of DeletedProtectionContainersClient. -func (c *ClientFactory) NewDeletedProtectionContainersClient() *DeletedProtectionContainersClient { - return &DeletedProtectionContainersClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewExportJobsOperationResultsClient creates a new instance of ExportJobsOperationResultsClient. -func (c *ClientFactory) NewExportJobsOperationResultsClient() *ExportJobsOperationResultsClient { - return &ExportJobsOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewFeatureSupportClient creates a new instance of FeatureSupportClient. -func (c *ClientFactory) NewFeatureSupportClient() *FeatureSupportClient { - return &FeatureSupportClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewFetchTieringCostClient creates a new instance of FetchTieringCostClient. -func (c *ClientFactory) NewFetchTieringCostClient() *FetchTieringCostClient { - return &FetchTieringCostClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewGetTieringCostOperationResultClient creates a new instance of GetTieringCostOperationResultClient. -func (c *ClientFactory) NewGetTieringCostOperationResultClient() *GetTieringCostOperationResultClient { - return &GetTieringCostOperationResultClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewItemLevelRecoveryConnectionsClient creates a new instance of ItemLevelRecoveryConnectionsClient. -func (c *ClientFactory) NewItemLevelRecoveryConnectionsClient() *ItemLevelRecoveryConnectionsClient { - return &ItemLevelRecoveryConnectionsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewJobCancellationsClient creates a new instance of JobCancellationsClient. -func (c *ClientFactory) NewJobCancellationsClient() *JobCancellationsClient { - return &JobCancellationsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewJobDetailsClient creates a new instance of JobDetailsClient. -func (c *ClientFactory) NewJobDetailsClient() *JobDetailsClient { - return &JobDetailsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewJobOperationResultsClient creates a new instance of JobOperationResultsClient. -func (c *ClientFactory) NewJobOperationResultsClient() *JobOperationResultsClient { - return &JobOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewJobsClient creates a new instance of JobsClient. -func (c *ClientFactory) NewJobsClient() *JobsClient { - return &JobsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewOperationClient creates a new instance of OperationClient. -func (c *ClientFactory) NewOperationClient() *OperationClient { - return &OperationClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - return &OperationsClient{ - internal: c.internal, - } -} - -// NewPrivateEndpointClient creates a new instance of PrivateEndpointClient. -func (c *ClientFactory) NewPrivateEndpointClient() *PrivateEndpointClient { - return &PrivateEndpointClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient. -func (c *ClientFactory) NewPrivateEndpointConnectionClient() *PrivateEndpointConnectionClient { - return &PrivateEndpointConnectionClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectableContainersClient creates a new instance of ProtectableContainersClient. -func (c *ClientFactory) NewProtectableContainersClient() *ProtectableContainersClient { - return &ProtectableContainersClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectedItemOperationResultsClient creates a new instance of ProtectedItemOperationResultsClient. -func (c *ClientFactory) NewProtectedItemOperationResultsClient() *ProtectedItemOperationResultsClient { - return &ProtectedItemOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectedItemOperationStatusesClient creates a new instance of ProtectedItemOperationStatusesClient. -func (c *ClientFactory) NewProtectedItemOperationStatusesClient() *ProtectedItemOperationStatusesClient { - return &ProtectedItemOperationStatusesClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectedItemsClient creates a new instance of ProtectedItemsClient. -func (c *ClientFactory) NewProtectedItemsClient() *ProtectedItemsClient { - return &ProtectedItemsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectionContainerOperationResultsClient creates a new instance of ProtectionContainerOperationResultsClient. -func (c *ClientFactory) NewProtectionContainerOperationResultsClient() *ProtectionContainerOperationResultsClient { - return &ProtectionContainerOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectionContainerRefreshOperationResultsClient creates a new instance of ProtectionContainerRefreshOperationResultsClient. -func (c *ClientFactory) NewProtectionContainerRefreshOperationResultsClient() *ProtectionContainerRefreshOperationResultsClient { - return &ProtectionContainerRefreshOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectionContainersClient creates a new instance of ProtectionContainersClient. -func (c *ClientFactory) NewProtectionContainersClient() *ProtectionContainersClient { - return &ProtectionContainersClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectionIntentClient creates a new instance of ProtectionIntentClient. -func (c *ClientFactory) NewProtectionIntentClient() *ProtectionIntentClient { - return &ProtectionIntentClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectionPoliciesClient creates a new instance of ProtectionPoliciesClient. -func (c *ClientFactory) NewProtectionPoliciesClient() *ProtectionPoliciesClient { - return &ProtectionPoliciesClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectionPolicyOperationResultsClient creates a new instance of ProtectionPolicyOperationResultsClient. -func (c *ClientFactory) NewProtectionPolicyOperationResultsClient() *ProtectionPolicyOperationResultsClient { - return &ProtectionPolicyOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewProtectionPolicyOperationStatusesClient creates a new instance of ProtectionPolicyOperationStatusesClient. -func (c *ClientFactory) NewProtectionPolicyOperationStatusesClient() *ProtectionPolicyOperationStatusesClient { - return &ProtectionPolicyOperationStatusesClient{ +// NewCrrOperationStatusClient creates a new instance of CrrOperationStatusClient. +func (c *ClientFactory) NewCrrOperationStatusClient() *CrrOperationStatusClient { + return &CrrOperationStatusClient{ subscriptionID: c.subscriptionID, internal: c.internal, } @@ -387,73 +116,9 @@ func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { } } -// NewRecoveryPointsRecommendedForMoveClient creates a new instance of RecoveryPointsRecommendedForMoveClient. -func (c *ClientFactory) NewRecoveryPointsRecommendedForMoveClient() *RecoveryPointsRecommendedForMoveClient { - return &RecoveryPointsRecommendedForMoveClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewResourceGuardProxiesClient creates a new instance of ResourceGuardProxiesClient. -func (c *ClientFactory) NewResourceGuardProxiesClient() *ResourceGuardProxiesClient { - return &ResourceGuardProxiesClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewResourceGuardProxyClient creates a new instance of ResourceGuardProxyClient. -func (c *ClientFactory) NewResourceGuardProxyClient() *ResourceGuardProxyClient { - return &ResourceGuardProxyClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewRestoresClient creates a new instance of RestoresClient. -func (c *ClientFactory) NewRestoresClient() *RestoresClient { - return &RestoresClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewSecurityPINsClient creates a new instance of SecurityPINsClient. -func (c *ClientFactory) NewSecurityPINsClient() *SecurityPINsClient { - return &SecurityPINsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewTieringCostOperationStatusClient creates a new instance of TieringCostOperationStatusClient. -func (c *ClientFactory) NewTieringCostOperationStatusClient() *TieringCostOperationStatusClient { - return &TieringCostOperationStatusClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewValidateOperationClient creates a new instance of ValidateOperationClient. -func (c *ClientFactory) NewValidateOperationClient() *ValidateOperationClient { - return &ValidateOperationClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewValidateOperationResultsClient creates a new instance of ValidateOperationResultsClient. -func (c *ClientFactory) NewValidateOperationResultsClient() *ValidateOperationResultsClient { - return &ValidateOperationResultsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewValidateOperationStatusesClient creates a new instance of ValidateOperationStatusesClient. -func (c *ClientFactory) NewValidateOperationStatusesClient() *ValidateOperationStatusesClient { - return &ValidateOperationStatusesClient{ +// NewRecoveryPointsCrrClient creates a new instance of RecoveryPointsCrrClient. +func (c *ClientFactory) NewRecoveryPointsCrrClient() *RecoveryPointsCrrClient { + return &RecoveryPointsCrrClient{ subscriptionID: c.subscriptionID, internal: c.internal, } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/constants.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/constants.go index 51e972eb27c0..27bc74a20b34 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/constants.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/constants.go @@ -10,105 +10,9 @@ package armrecoveryservicesbackup const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup" - moduleVersion = "v4.1.0" + moduleVersion = "v5.0.0" ) -// AcquireStorageAccountLock - Whether storage account lock is to be acquired for this container or not. -type AcquireStorageAccountLock string - -const ( - AcquireStorageAccountLockAcquire AcquireStorageAccountLock = "Acquire" - AcquireStorageAccountLockNotAcquire AcquireStorageAccountLock = "NotAcquire" -) - -// PossibleAcquireStorageAccountLockValues returns the possible values for the AcquireStorageAccountLock const type. -func PossibleAcquireStorageAccountLockValues() []AcquireStorageAccountLock { - return []AcquireStorageAccountLock{ - AcquireStorageAccountLockAcquire, - AcquireStorageAccountLockNotAcquire, - } -} - -// AzureFileShareType - File Share type XSync or XSMB. -type AzureFileShareType string - -const ( - AzureFileShareTypeInvalid AzureFileShareType = "Invalid" - AzureFileShareTypeXSMB AzureFileShareType = "XSMB" - AzureFileShareTypeXSync AzureFileShareType = "XSync" -) - -// PossibleAzureFileShareTypeValues returns the possible values for the AzureFileShareType const type. -func PossibleAzureFileShareTypeValues() []AzureFileShareType { - return []AzureFileShareType{ - AzureFileShareTypeInvalid, - AzureFileShareTypeXSMB, - AzureFileShareTypeXSync, - } -} - -// BackupEngineType - Type of the backup engine. -type BackupEngineType string - -const ( - BackupEngineTypeAzureBackupServerEngine BackupEngineType = "AzureBackupServerEngine" - BackupEngineTypeDpmBackupEngine BackupEngineType = "DpmBackupEngine" - BackupEngineTypeInvalid BackupEngineType = "Invalid" -) - -// PossibleBackupEngineTypeValues returns the possible values for the BackupEngineType const type. -func PossibleBackupEngineTypeValues() []BackupEngineType { - return []BackupEngineType{ - BackupEngineTypeAzureBackupServerEngine, - BackupEngineTypeDpmBackupEngine, - BackupEngineTypeInvalid, - } -} - -// BackupItemType - Type of backup items associated with this container. -type BackupItemType string - -const ( - BackupItemTypeAzureFileShare BackupItemType = "AzureFileShare" - BackupItemTypeAzureSQLDb BackupItemType = "AzureSqlDb" - BackupItemTypeClient BackupItemType = "Client" - BackupItemTypeExchange BackupItemType = "Exchange" - BackupItemTypeFileFolder BackupItemType = "FileFolder" - BackupItemTypeGenericDataSource BackupItemType = "GenericDataSource" - BackupItemTypeInvalid BackupItemType = "Invalid" - BackupItemTypeSAPAseDatabase BackupItemType = "SAPAseDatabase" - BackupItemTypeSAPHanaDBInstance BackupItemType = "SAPHanaDBInstance" - BackupItemTypeSAPHanaDatabase BackupItemType = "SAPHanaDatabase" - BackupItemTypeSQLDB BackupItemType = "SQLDB" - BackupItemTypeSQLDataBase BackupItemType = "SQLDataBase" - BackupItemTypeSharepoint BackupItemType = "Sharepoint" - BackupItemTypeSystemState BackupItemType = "SystemState" - BackupItemTypeVM BackupItemType = "VM" - BackupItemTypeVMwareVM BackupItemType = "VMwareVM" -) - -// PossibleBackupItemTypeValues returns the possible values for the BackupItemType const type. -func PossibleBackupItemTypeValues() []BackupItemType { - return []BackupItemType{ - BackupItemTypeAzureFileShare, - BackupItemTypeAzureSQLDb, - BackupItemTypeClient, - BackupItemTypeExchange, - BackupItemTypeFileFolder, - BackupItemTypeGenericDataSource, - BackupItemTypeInvalid, - BackupItemTypeSAPAseDatabase, - BackupItemTypeSAPHanaDBInstance, - BackupItemTypeSAPHanaDatabase, - BackupItemTypeSQLDB, - BackupItemTypeSQLDataBase, - BackupItemTypeSharepoint, - BackupItemTypeSystemState, - BackupItemTypeVM, - BackupItemTypeVMwareVM, - } -} - // BackupManagementType - Backup management type to execute the current job. type BackupManagementType string @@ -139,78 +43,6 @@ func PossibleBackupManagementTypeValues() []BackupManagementType { } } -// BackupType - Type of backup, viz. Full, Differential, Log or CopyOnlyFull -type BackupType string - -const ( - BackupTypeCopyOnlyFull BackupType = "CopyOnlyFull" - BackupTypeDifferential BackupType = "Differential" - BackupTypeFull BackupType = "Full" - BackupTypeIncremental BackupType = "Incremental" - BackupTypeInvalid BackupType = "Invalid" - BackupTypeLog BackupType = "Log" - BackupTypeSnapshotCopyOnlyFull BackupType = "SnapshotCopyOnlyFull" - BackupTypeSnapshotFull BackupType = "SnapshotFull" -) - -// PossibleBackupTypeValues returns the possible values for the BackupType const type. -func PossibleBackupTypeValues() []BackupType { - return []BackupType{ - BackupTypeCopyOnlyFull, - BackupTypeDifferential, - BackupTypeFull, - BackupTypeIncremental, - BackupTypeInvalid, - BackupTypeLog, - BackupTypeSnapshotCopyOnlyFull, - BackupTypeSnapshotFull, - } -} - -// ContainerType - Type of container for filter -type ContainerType string - -const ( - ContainerTypeAzureBackupServerContainer ContainerType = "AzureBackupServerContainer" - ContainerTypeAzureSQLContainer ContainerType = "AzureSqlContainer" - ContainerTypeCluster ContainerType = "Cluster" - ContainerTypeDPMContainer ContainerType = "DPMContainer" - ContainerTypeGenericContainer ContainerType = "GenericContainer" - ContainerTypeHanaHSRContainer ContainerType = "HanaHSRContainer" - ContainerTypeIaasVMContainer ContainerType = "IaasVMContainer" - ContainerTypeIaasVMServiceContainer ContainerType = "IaasVMServiceContainer" - ContainerTypeInvalid ContainerType = "Invalid" - ContainerTypeMABContainer ContainerType = "MABContainer" - ContainerTypeSQLAGWorkLoadContainer ContainerType = "SQLAGWorkLoadContainer" - ContainerTypeStorageContainer ContainerType = "StorageContainer" - ContainerTypeUnknown ContainerType = "Unknown" - ContainerTypeVCenter ContainerType = "VCenter" - ContainerTypeVMAppContainer ContainerType = "VMAppContainer" - ContainerTypeWindows ContainerType = "Windows" -) - -// PossibleContainerTypeValues returns the possible values for the ContainerType const type. -func PossibleContainerTypeValues() []ContainerType { - return []ContainerType{ - ContainerTypeAzureBackupServerContainer, - ContainerTypeAzureSQLContainer, - ContainerTypeCluster, - ContainerTypeDPMContainer, - ContainerTypeGenericContainer, - ContainerTypeHanaHSRContainer, - ContainerTypeIaasVMContainer, - ContainerTypeIaasVMServiceContainer, - ContainerTypeInvalid, - ContainerTypeMABContainer, - ContainerTypeSQLAGWorkLoadContainer, - ContainerTypeStorageContainer, - ContainerTypeUnknown, - ContainerTypeVCenter, - ContainerTypeVMAppContainer, - ContainerTypeWindows, - } -} - // CopyOptions - Options to resolve copy conflicts. type CopyOptions string @@ -251,24 +83,6 @@ func PossibleCreateModeValues() []CreateMode { } } -// DataMoveLevel - DataMove Level -type DataMoveLevel string - -const ( - DataMoveLevelContainer DataMoveLevel = "Container" - DataMoveLevelInvalid DataMoveLevel = "Invalid" - DataMoveLevelVault DataMoveLevel = "Vault" -) - -// PossibleDataMoveLevelValues returns the possible values for the DataMoveLevel const type. -func PossibleDataMoveLevelValues() []DataMoveLevel { - return []DataMoveLevel{ - DataMoveLevelContainer, - DataMoveLevelInvalid, - DataMoveLevelVault, - } -} - // DataSourceType - Type of workload this item represents. type DataSourceType string @@ -281,7 +95,6 @@ const ( DataSourceTypeGenericDataSource DataSourceType = "GenericDataSource" DataSourceTypeInvalid DataSourceType = "Invalid" DataSourceTypeSAPAseDatabase DataSourceType = "SAPAseDatabase" - DataSourceTypeSAPHanaDBInstance DataSourceType = "SAPHanaDBInstance" DataSourceTypeSAPHanaDatabase DataSourceType = "SAPHanaDatabase" DataSourceTypeSQLDB DataSourceType = "SQLDB" DataSourceTypeSQLDataBase DataSourceType = "SQLDataBase" @@ -302,7 +115,6 @@ func PossibleDataSourceTypeValues() []DataSourceType { DataSourceTypeGenericDataSource, DataSourceTypeInvalid, DataSourceTypeSAPAseDatabase, - DataSourceTypeSAPHanaDBInstance, DataSourceTypeSAPHanaDatabase, DataSourceTypeSQLDB, DataSourceTypeSQLDataBase, @@ -313,207 +125,6 @@ func PossibleDataSourceTypeValues() []DataSourceType { } } -type DayOfWeek string - -const ( - DayOfWeekFriday DayOfWeek = "Friday" - DayOfWeekMonday DayOfWeek = "Monday" - DayOfWeekSaturday DayOfWeek = "Saturday" - DayOfWeekSunday DayOfWeek = "Sunday" - DayOfWeekThursday DayOfWeek = "Thursday" - DayOfWeekTuesday DayOfWeek = "Tuesday" - DayOfWeekWednesday DayOfWeek = "Wednesday" -) - -// PossibleDayOfWeekValues returns the possible values for the DayOfWeek const type. -func PossibleDayOfWeekValues() []DayOfWeek { - return []DayOfWeek{ - DayOfWeekFriday, - DayOfWeekMonday, - DayOfWeekSaturday, - DayOfWeekSunday, - DayOfWeekThursday, - DayOfWeekTuesday, - DayOfWeekWednesday, - } -} - -// DedupState - Vault Dedup state -type DedupState string - -const ( - DedupStateDisabled DedupState = "Disabled" - DedupStateEnabled DedupState = "Enabled" - DedupStateInvalid DedupState = "Invalid" -) - -// PossibleDedupStateValues returns the possible values for the DedupState const type. -func PossibleDedupStateValues() []DedupState { - return []DedupState{ - DedupStateDisabled, - DedupStateEnabled, - DedupStateInvalid, - } -} - -// EncryptionAtRestType - Encryption At Rest Type -type EncryptionAtRestType string - -const ( - EncryptionAtRestTypeCustomerManaged EncryptionAtRestType = "CustomerManaged" - EncryptionAtRestTypeInvalid EncryptionAtRestType = "Invalid" - EncryptionAtRestTypeMicrosoftManaged EncryptionAtRestType = "MicrosoftManaged" -) - -// PossibleEncryptionAtRestTypeValues returns the possible values for the EncryptionAtRestType const type. -func PossibleEncryptionAtRestTypeValues() []EncryptionAtRestType { - return []EncryptionAtRestType{ - EncryptionAtRestTypeCustomerManaged, - EncryptionAtRestTypeInvalid, - EncryptionAtRestTypeMicrosoftManaged, - } -} - -// EnhancedSecurityState - Enabled or Disabled. -type EnhancedSecurityState string - -const ( - EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled" - EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled" - EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid" -) - -// PossibleEnhancedSecurityStateValues returns the possible values for the EnhancedSecurityState const type. -func PossibleEnhancedSecurityStateValues() []EnhancedSecurityState { - return []EnhancedSecurityState{ - EnhancedSecurityStateDisabled, - EnhancedSecurityStateEnabled, - EnhancedSecurityStateInvalid, - } -} - -// FabricName - Specifies the fabric name - Azure or AD -type FabricName string - -const ( - FabricNameAzure FabricName = "Azure" - FabricNameInvalid FabricName = "Invalid" -) - -// PossibleFabricNameValues returns the possible values for the FabricName const type. -func PossibleFabricNameValues() []FabricName { - return []FabricName{ - FabricNameAzure, - FabricNameInvalid, - } -} - -// HTTPStatusCode - HTTP Status Code of the operation. -type HTTPStatusCode string - -const ( - HTTPStatusCodeAccepted HTTPStatusCode = "Accepted" - HTTPStatusCodeAmbiguous HTTPStatusCode = "Ambiguous" - HTTPStatusCodeBadGateway HTTPStatusCode = "BadGateway" - HTTPStatusCodeBadRequest HTTPStatusCode = "BadRequest" - HTTPStatusCodeConflict HTTPStatusCode = "Conflict" - HTTPStatusCodeContinue HTTPStatusCode = "Continue" - HTTPStatusCodeCreated HTTPStatusCode = "Created" - HTTPStatusCodeExpectationFailed HTTPStatusCode = "ExpectationFailed" - HTTPStatusCodeForbidden HTTPStatusCode = "Forbidden" - HTTPStatusCodeFound HTTPStatusCode = "Found" - HTTPStatusCodeGatewayTimeout HTTPStatusCode = "GatewayTimeout" - HTTPStatusCodeGone HTTPStatusCode = "Gone" - HTTPStatusCodeHTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - HTTPStatusCodeInternalServerError HTTPStatusCode = "InternalServerError" - HTTPStatusCodeLengthRequired HTTPStatusCode = "LengthRequired" - HTTPStatusCodeMethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - HTTPStatusCodeMoved HTTPStatusCode = "Moved" - HTTPStatusCodeMovedPermanently HTTPStatusCode = "MovedPermanently" - HTTPStatusCodeMultipleChoices HTTPStatusCode = "MultipleChoices" - HTTPStatusCodeNoContent HTTPStatusCode = "NoContent" - HTTPStatusCodeNonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - HTTPStatusCodeNotAcceptable HTTPStatusCode = "NotAcceptable" - HTTPStatusCodeNotFound HTTPStatusCode = "NotFound" - HTTPStatusCodeNotImplemented HTTPStatusCode = "NotImplemented" - HTTPStatusCodeNotModified HTTPStatusCode = "NotModified" - HTTPStatusCodeOK HTTPStatusCode = "OK" - HTTPStatusCodePartialContent HTTPStatusCode = "PartialContent" - HTTPStatusCodePaymentRequired HTTPStatusCode = "PaymentRequired" - HTTPStatusCodePreconditionFailed HTTPStatusCode = "PreconditionFailed" - HTTPStatusCodeProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - HTTPStatusCodeRedirect HTTPStatusCode = "Redirect" - HTTPStatusCodeRedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" - HTTPStatusCodeRedirectMethod HTTPStatusCode = "RedirectMethod" - HTTPStatusCodeRequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - HTTPStatusCodeRequestTimeout HTTPStatusCode = "RequestTimeout" - HTTPStatusCodeRequestURITooLong HTTPStatusCode = "RequestUriTooLong" - HTTPStatusCodeRequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - HTTPStatusCodeResetContent HTTPStatusCode = "ResetContent" - HTTPStatusCodeSeeOther HTTPStatusCode = "SeeOther" - HTTPStatusCodeServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - HTTPStatusCodeSwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - HTTPStatusCodeTemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - HTTPStatusCodeUnauthorized HTTPStatusCode = "Unauthorized" - HTTPStatusCodeUnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - HTTPStatusCodeUnused HTTPStatusCode = "Unused" - HTTPStatusCodeUpgradeRequired HTTPStatusCode = "UpgradeRequired" - HTTPStatusCodeUseProxy HTTPStatusCode = "UseProxy" -) - -// PossibleHTTPStatusCodeValues returns the possible values for the HTTPStatusCode const type. -func PossibleHTTPStatusCodeValues() []HTTPStatusCode { - return []HTTPStatusCode{ - HTTPStatusCodeAccepted, - HTTPStatusCodeAmbiguous, - HTTPStatusCodeBadGateway, - HTTPStatusCodeBadRequest, - HTTPStatusCodeConflict, - HTTPStatusCodeContinue, - HTTPStatusCodeCreated, - HTTPStatusCodeExpectationFailed, - HTTPStatusCodeForbidden, - HTTPStatusCodeFound, - HTTPStatusCodeGatewayTimeout, - HTTPStatusCodeGone, - HTTPStatusCodeHTTPVersionNotSupported, - HTTPStatusCodeInternalServerError, - HTTPStatusCodeLengthRequired, - HTTPStatusCodeMethodNotAllowed, - HTTPStatusCodeMoved, - HTTPStatusCodeMovedPermanently, - HTTPStatusCodeMultipleChoices, - HTTPStatusCodeNoContent, - HTTPStatusCodeNonAuthoritativeInformation, - HTTPStatusCodeNotAcceptable, - HTTPStatusCodeNotFound, - HTTPStatusCodeNotImplemented, - HTTPStatusCodeNotModified, - HTTPStatusCodeOK, - HTTPStatusCodePartialContent, - HTTPStatusCodePaymentRequired, - HTTPStatusCodePreconditionFailed, - HTTPStatusCodeProxyAuthenticationRequired, - HTTPStatusCodeRedirect, - HTTPStatusCodeRedirectKeepVerb, - HTTPStatusCodeRedirectMethod, - HTTPStatusCodeRequestEntityTooLarge, - HTTPStatusCodeRequestTimeout, - HTTPStatusCodeRequestURITooLong, - HTTPStatusCodeRequestedRangeNotSatisfiable, - HTTPStatusCodeResetContent, - HTTPStatusCodeSeeOther, - HTTPStatusCodeServiceUnavailable, - HTTPStatusCodeSwitchingProtocols, - HTTPStatusCodeTemporaryRedirect, - HTTPStatusCodeUnauthorized, - HTTPStatusCodeUnsupportedMediaType, - HTTPStatusCodeUnused, - HTTPStatusCodeUpgradeRequired, - HTTPStatusCodeUseProxy, - } -} - // HealthState - Health State for the backed up item. type HealthState string @@ -534,7 +145,7 @@ func PossibleHealthStateValues() []HealthState { } } -// HealthStatus - Health status of protected item. +// HealthStatus - backups running status for this backup item. type HealthStatus string const ( @@ -554,89 +165,6 @@ func PossibleHealthStatusValues() []HealthStatus { } } -type IAASVMPolicyType string - -const ( - IAASVMPolicyTypeInvalid IAASVMPolicyType = "Invalid" - IAASVMPolicyTypeV1 IAASVMPolicyType = "V1" - IAASVMPolicyTypeV2 IAASVMPolicyType = "V2" -) - -// PossibleIAASVMPolicyTypeValues returns the possible values for the IAASVMPolicyType const type. -func PossibleIAASVMPolicyTypeValues() []IAASVMPolicyType { - return []IAASVMPolicyType{ - IAASVMPolicyTypeInvalid, - IAASVMPolicyTypeV1, - IAASVMPolicyTypeV2, - } -} - -type IaasVMSnapshotConsistencyType string - -const ( - IaasVMSnapshotConsistencyTypeOnlyCrashConsistent IaasVMSnapshotConsistencyType = "OnlyCrashConsistent" -) - -// PossibleIaasVMSnapshotConsistencyTypeValues returns the possible values for the IaasVMSnapshotConsistencyType const type. -func PossibleIaasVMSnapshotConsistencyTypeValues() []IaasVMSnapshotConsistencyType { - return []IaasVMSnapshotConsistencyType{ - IaasVMSnapshotConsistencyTypeOnlyCrashConsistent, - } -} - -type InfrastructureEncryptionState string - -const ( - InfrastructureEncryptionStateDisabled InfrastructureEncryptionState = "Disabled" - InfrastructureEncryptionStateEnabled InfrastructureEncryptionState = "Enabled" - InfrastructureEncryptionStateInvalid InfrastructureEncryptionState = "Invalid" -) - -// PossibleInfrastructureEncryptionStateValues returns the possible values for the InfrastructureEncryptionState const type. -func PossibleInfrastructureEncryptionStateValues() []InfrastructureEncryptionState { - return []InfrastructureEncryptionState{ - InfrastructureEncryptionStateDisabled, - InfrastructureEncryptionStateEnabled, - InfrastructureEncryptionStateInvalid, - } -} - -// InquiryStatus - Status of protectable item, i.e. InProgress,Succeeded,Failed -type InquiryStatus string - -const ( - InquiryStatusFailed InquiryStatus = "Failed" - InquiryStatusInvalid InquiryStatus = "Invalid" - InquiryStatusSuccess InquiryStatus = "Success" -) - -// PossibleInquiryStatusValues returns the possible values for the InquiryStatus const type. -func PossibleInquiryStatusValues() []InquiryStatus { - return []InquiryStatus{ - InquiryStatusFailed, - InquiryStatusInvalid, - InquiryStatusSuccess, - } -} - -// IntentItemType - Type of workload this item represents -type IntentItemType string - -const ( - IntentItemTypeInvalid IntentItemType = "Invalid" - IntentItemTypeSQLAvailabilityGroupContainer IntentItemType = "SQLAvailabilityGroupContainer" - IntentItemTypeSQLInstance IntentItemType = "SQLInstance" -) - -// PossibleIntentItemTypeValues returns the possible values for the IntentItemType const type. -func PossibleIntentItemTypeValues() []IntentItemType { - return []IntentItemType{ - IntentItemTypeInvalid, - IntentItemTypeSQLAvailabilityGroupContainer, - IntentItemTypeSQLInstance, - } -} - // JobOperationType - Type of operation. type JobOperationType string @@ -734,33 +262,6 @@ func PossibleLastBackupStatusValues() []LastBackupStatus { } } -type LastUpdateStatus string - -const ( - LastUpdateStatusFailed LastUpdateStatus = "Failed" - LastUpdateStatusFirstInitialization LastUpdateStatus = "FirstInitialization" - LastUpdateStatusInitialized LastUpdateStatus = "Initialized" - LastUpdateStatusInvalid LastUpdateStatus = "Invalid" - LastUpdateStatusNotEnabled LastUpdateStatus = "NotEnabled" - LastUpdateStatusPartiallyFailed LastUpdateStatus = "PartiallyFailed" - LastUpdateStatusPartiallySucceeded LastUpdateStatus = "PartiallySucceeded" - LastUpdateStatusSucceeded LastUpdateStatus = "Succeeded" -) - -// PossibleLastUpdateStatusValues returns the possible values for the LastUpdateStatus const type. -func PossibleLastUpdateStatusValues() []LastUpdateStatus { - return []LastUpdateStatus{ - LastUpdateStatusFailed, - LastUpdateStatusFirstInitialization, - LastUpdateStatusInitialized, - LastUpdateStatusInvalid, - LastUpdateStatusNotEnabled, - LastUpdateStatusPartiallyFailed, - LastUpdateStatusPartiallySucceeded, - LastUpdateStatusSucceeded, - } -} - // MabServerType - Server type of MAB container. type MabServerType string @@ -803,43 +304,6 @@ func PossibleMabServerTypeValues() []MabServerType { } } -type MonthOfYear string - -const ( - MonthOfYearApril MonthOfYear = "April" - MonthOfYearAugust MonthOfYear = "August" - MonthOfYearDecember MonthOfYear = "December" - MonthOfYearFebruary MonthOfYear = "February" - MonthOfYearInvalid MonthOfYear = "Invalid" - MonthOfYearJanuary MonthOfYear = "January" - MonthOfYearJuly MonthOfYear = "July" - MonthOfYearJune MonthOfYear = "June" - MonthOfYearMarch MonthOfYear = "March" - MonthOfYearMay MonthOfYear = "May" - MonthOfYearNovember MonthOfYear = "November" - MonthOfYearOctober MonthOfYear = "October" - MonthOfYearSeptember MonthOfYear = "September" -) - -// PossibleMonthOfYearValues returns the possible values for the MonthOfYear const type. -func PossibleMonthOfYearValues() []MonthOfYear { - return []MonthOfYear{ - MonthOfYearApril, - MonthOfYearAugust, - MonthOfYearDecember, - MonthOfYearFebruary, - MonthOfYearInvalid, - MonthOfYearJanuary, - MonthOfYearJuly, - MonthOfYearJune, - MonthOfYearMarch, - MonthOfYearMay, - MonthOfYearNovember, - MonthOfYearOctober, - MonthOfYearSeptember, - } -} - // OperationStatusValues - Operation status. type OperationStatusValues string @@ -862,24 +326,6 @@ func PossibleOperationStatusValuesValues() []OperationStatusValues { } } -// OperationType - Re-Do Operation -type OperationType string - -const ( - OperationTypeInvalid OperationType = "Invalid" - OperationTypeRegister OperationType = "Register" - OperationTypeReregister OperationType = "Reregister" -) - -// PossibleOperationTypeValues returns the possible values for the OperationType const type. -func PossibleOperationTypeValues() []OperationType { - return []OperationType{ - OperationTypeInvalid, - OperationTypeRegister, - OperationTypeReregister, - } -} - // OverwriteOptions - Can Overwrite if Target DataBase already exists type OverwriteOptions string @@ -898,104 +344,6 @@ func PossibleOverwriteOptionsValues() []OverwriteOptions { } } -// PolicyType - Type of backup policy type -type PolicyType string - -const ( - PolicyTypeCopyOnlyFull PolicyType = "CopyOnlyFull" - PolicyTypeDifferential PolicyType = "Differential" - PolicyTypeFull PolicyType = "Full" - PolicyTypeIncremental PolicyType = "Incremental" - PolicyTypeInvalid PolicyType = "Invalid" - PolicyTypeLog PolicyType = "Log" - PolicyTypeSnapshotCopyOnlyFull PolicyType = "SnapshotCopyOnlyFull" - PolicyTypeSnapshotFull PolicyType = "SnapshotFull" -) - -// PossiblePolicyTypeValues returns the possible values for the PolicyType const type. -func PossiblePolicyTypeValues() []PolicyType { - return []PolicyType{ - PolicyTypeCopyOnlyFull, - PolicyTypeDifferential, - PolicyTypeFull, - PolicyTypeIncremental, - PolicyTypeInvalid, - PolicyTypeLog, - PolicyTypeSnapshotCopyOnlyFull, - PolicyTypeSnapshotFull, - } -} - -// PrivateEndpointConnectionStatus - Gets or sets the status -type PrivateEndpointConnectionStatus string - -const ( - PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" - PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" - PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" - PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointConnectionStatusValues returns the possible values for the PrivateEndpointConnectionStatus const type. -func PossiblePrivateEndpointConnectionStatusValues() []PrivateEndpointConnectionStatus { - return []PrivateEndpointConnectionStatus{ - PrivateEndpointConnectionStatusApproved, - PrivateEndpointConnectionStatusDisconnected, - PrivateEndpointConnectionStatusPending, - PrivateEndpointConnectionStatusRejected, - } -} - -// ProtectableContainerType - Type of the container. The value of this property for -// 1. Compute Azure VM is Microsoft.Compute/virtualMachines -// 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines -type ProtectableContainerType string - -const ( - ProtectableContainerTypeAzureBackupServerContainer ProtectableContainerType = "AzureBackupServerContainer" - ProtectableContainerTypeAzureSQLContainer ProtectableContainerType = "AzureSqlContainer" - ProtectableContainerTypeAzureWorkloadContainer ProtectableContainerType = "AzureWorkloadContainer" - ProtectableContainerTypeCluster ProtectableContainerType = "Cluster" - ProtectableContainerTypeDPMContainer ProtectableContainerType = "DPMContainer" - ProtectableContainerTypeGenericContainer ProtectableContainerType = "GenericContainer" - ProtectableContainerTypeIaasVMContainer ProtectableContainerType = "IaasVMContainer" - ProtectableContainerTypeIaasVMServiceContainer ProtectableContainerType = "IaasVMServiceContainer" - ProtectableContainerTypeInvalid ProtectableContainerType = "Invalid" - ProtectableContainerTypeMABContainer ProtectableContainerType = "MABContainer" - ProtectableContainerTypeMicrosoftClassicComputeVirtualMachines ProtectableContainerType = "Microsoft.ClassicCompute/virtualMachines" - ProtectableContainerTypeMicrosoftComputeVirtualMachines ProtectableContainerType = "Microsoft.Compute/virtualMachines" - ProtectableContainerTypeSQLAGWorkLoadContainer ProtectableContainerType = "SQLAGWorkLoadContainer" - ProtectableContainerTypeStorageContainer ProtectableContainerType = "StorageContainer" - ProtectableContainerTypeUnknown ProtectableContainerType = "Unknown" - ProtectableContainerTypeVCenter ProtectableContainerType = "VCenter" - ProtectableContainerTypeVMAppContainer ProtectableContainerType = "VMAppContainer" - ProtectableContainerTypeWindows ProtectableContainerType = "Windows" -) - -// PossibleProtectableContainerTypeValues returns the possible values for the ProtectableContainerType const type. -func PossibleProtectableContainerTypeValues() []ProtectableContainerType { - return []ProtectableContainerType{ - ProtectableContainerTypeAzureBackupServerContainer, - ProtectableContainerTypeAzureSQLContainer, - ProtectableContainerTypeAzureWorkloadContainer, - ProtectableContainerTypeCluster, - ProtectableContainerTypeDPMContainer, - ProtectableContainerTypeGenericContainer, - ProtectableContainerTypeIaasVMContainer, - ProtectableContainerTypeIaasVMServiceContainer, - ProtectableContainerTypeInvalid, - ProtectableContainerTypeMABContainer, - ProtectableContainerTypeMicrosoftClassicComputeVirtualMachines, - ProtectableContainerTypeMicrosoftComputeVirtualMachines, - ProtectableContainerTypeSQLAGWorkLoadContainer, - ProtectableContainerTypeStorageContainer, - ProtectableContainerTypeUnknown, - ProtectableContainerTypeVCenter, - ProtectableContainerTypeVMAppContainer, - ProtectableContainerTypeWindows, - } -} - // ProtectedItemHealthStatus - Health status of the backup item, evaluated based on last heartbeat received type ProtectedItemHealthStatus string @@ -1022,7 +370,6 @@ func PossibleProtectedItemHealthStatusValues() []ProtectedItemHealthStatus { type ProtectedItemState string const ( - ProtectedItemStateBackupsSuspended ProtectedItemState = "BackupsSuspended" ProtectedItemStateIRPending ProtectedItemState = "IRPending" ProtectedItemStateInvalid ProtectedItemState = "Invalid" ProtectedItemStateProtected ProtectedItemState = "Protected" @@ -1034,7 +381,6 @@ const ( // PossibleProtectedItemStateValues returns the possible values for the ProtectedItemState const type. func PossibleProtectedItemStateValues() []ProtectedItemState { return []ProtectedItemState{ - ProtectedItemStateBackupsSuspended, ProtectedItemStateIRPending, ProtectedItemStateInvalid, ProtectedItemStateProtected, @@ -1044,35 +390,10 @@ func PossibleProtectedItemStateValues() []ProtectedItemState { } } -// ProtectionIntentItemType - backup protectionIntent type. -type ProtectionIntentItemType string - -const ( - ProtectionIntentItemTypeAzureResourceItem ProtectionIntentItemType = "AzureResourceItem" - ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadAutoProtectionIntent" - ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadContainerAutoProtectionIntent" - ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadSQLAutoProtectionIntent" - ProtectionIntentItemTypeInvalid ProtectionIntentItemType = "Invalid" - ProtectionIntentItemTypeRecoveryServiceVaultItem ProtectionIntentItemType = "RecoveryServiceVaultItem" -) - -// PossibleProtectionIntentItemTypeValues returns the possible values for the ProtectionIntentItemType const type. -func PossibleProtectionIntentItemTypeValues() []ProtectionIntentItemType { - return []ProtectionIntentItemType{ - ProtectionIntentItemTypeAzureResourceItem, - ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent, - ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent, - ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent, - ProtectionIntentItemTypeInvalid, - ProtectionIntentItemTypeRecoveryServiceVaultItem, - } -} - // ProtectionState - Backup state of this backup item. type ProtectionState string const ( - ProtectionStateBackupsSuspended ProtectionState = "BackupsSuspended" ProtectionStateIRPending ProtectionState = "IRPending" ProtectionStateInvalid ProtectionState = "Invalid" ProtectionStateProtected ProtectionState = "Protected" @@ -1084,7 +405,6 @@ const ( // PossibleProtectionStateValues returns the possible values for the ProtectionState const type. func PossibleProtectionStateValues() []ProtectionState { return []ProtectionState{ - ProtectionStateBackupsSuspended, ProtectionStateIRPending, ProtectionStateInvalid, ProtectionStateProtected, @@ -1094,58 +414,13 @@ func PossibleProtectionStateValues() []ProtectionState { } } -// ProtectionStatus - Specifies whether the container is registered or not -type ProtectionStatus string - -const ( - ProtectionStatusInvalid ProtectionStatus = "Invalid" - ProtectionStatusNotProtected ProtectionStatus = "NotProtected" - ProtectionStatusProtected ProtectionStatus = "Protected" - ProtectionStatusProtecting ProtectionStatus = "Protecting" - ProtectionStatusProtectionFailed ProtectionStatus = "ProtectionFailed" -) - -// PossibleProtectionStatusValues returns the possible values for the ProtectionStatus const type. -func PossibleProtectionStatusValues() []ProtectionStatus { - return []ProtectionStatus{ - ProtectionStatusInvalid, - ProtectionStatusNotProtected, - ProtectionStatusProtected, - ProtectionStatusProtecting, - ProtectionStatusProtectionFailed, - } -} - -// ProvisioningState - Gets or sets provisioning state of the private endpoint connection -type ProvisioningState string - -const ( - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStatePending ProvisioningState = "Pending" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateDeleting, - ProvisioningStateFailed, - ProvisioningStatePending, - ProvisioningStateSucceeded, - } -} - // RecoveryMode - Defines whether the current recovery mode is file restore or database restore type RecoveryMode string const ( - RecoveryModeFileRecovery RecoveryMode = "FileRecovery" - RecoveryModeInvalid RecoveryMode = "Invalid" - RecoveryModeRecoveryUsingSnapshot RecoveryMode = "RecoveryUsingSnapshot" - RecoveryModeSnapshotAttach RecoveryMode = "SnapshotAttach" - RecoveryModeSnapshotAttachAndRecover RecoveryMode = "SnapshotAttachAndRecover" - RecoveryModeWorkloadRecovery RecoveryMode = "WorkloadRecovery" + RecoveryModeFileRecovery RecoveryMode = "FileRecovery" + RecoveryModeInvalid RecoveryMode = "Invalid" + RecoveryModeWorkloadRecovery RecoveryMode = "WorkloadRecovery" ) // PossibleRecoveryModeValues returns the possible values for the RecoveryMode const type. @@ -1153,9 +428,6 @@ func PossibleRecoveryModeValues() []RecoveryMode { return []RecoveryMode{ RecoveryModeFileRecovery, RecoveryModeInvalid, - RecoveryModeRecoveryUsingSnapshot, - RecoveryModeSnapshotAttach, - RecoveryModeSnapshotAttachAndRecover, RecoveryModeWorkloadRecovery, } } @@ -1224,22 +496,6 @@ func PossibleRecoveryTypeValues() []RecoveryType { } } -// RehydrationPriority - Rehydration Priority -type RehydrationPriority string - -const ( - RehydrationPriorityHigh RehydrationPriority = "High" - RehydrationPriorityStandard RehydrationPriority = "Standard" -) - -// PossibleRehydrationPriorityValues returns the possible values for the RehydrationPriority const type. -func PossibleRehydrationPriorityValues() []RehydrationPriority { - return []RehydrationPriority{ - RehydrationPriorityHigh, - RehydrationPriorityStandard, - } -} - // ResourceHealthStatus - Resource Health Status type ResourceHealthStatus string @@ -1268,15 +524,13 @@ func PossibleResourceHealthStatusValues() []ResourceHealthStatus { type RestorePointQueryType string const ( - RestorePointQueryTypeAll RestorePointQueryType = "All" - RestorePointQueryTypeDifferential RestorePointQueryType = "Differential" - RestorePointQueryTypeFull RestorePointQueryType = "Full" - RestorePointQueryTypeFullAndDifferential RestorePointQueryType = "FullAndDifferential" - RestorePointQueryTypeIncremental RestorePointQueryType = "Incremental" - RestorePointQueryTypeInvalid RestorePointQueryType = "Invalid" - RestorePointQueryTypeLog RestorePointQueryType = "Log" - RestorePointQueryTypeSnapshotCopyOnlyFull RestorePointQueryType = "SnapshotCopyOnlyFull" - RestorePointQueryTypeSnapshotFull RestorePointQueryType = "SnapshotFull" + RestorePointQueryTypeAll RestorePointQueryType = "All" + RestorePointQueryTypeDifferential RestorePointQueryType = "Differential" + RestorePointQueryTypeFull RestorePointQueryType = "Full" + RestorePointQueryTypeFullAndDifferential RestorePointQueryType = "FullAndDifferential" + RestorePointQueryTypeIncremental RestorePointQueryType = "Incremental" + RestorePointQueryTypeInvalid RestorePointQueryType = "Invalid" + RestorePointQueryTypeLog RestorePointQueryType = "Log" ) // PossibleRestorePointQueryTypeValues returns the possible values for the RestorePointQueryType const type. @@ -1289,8 +543,6 @@ func PossibleRestorePointQueryTypeValues() []RestorePointQueryType { RestorePointQueryTypeIncremental, RestorePointQueryTypeInvalid, RestorePointQueryTypeLog, - RestorePointQueryTypeSnapshotCopyOnlyFull, - RestorePointQueryTypeSnapshotFull, } } @@ -1298,13 +550,11 @@ func PossibleRestorePointQueryTypeValues() []RestorePointQueryType { type RestorePointType string const ( - RestorePointTypeDifferential RestorePointType = "Differential" - RestorePointTypeFull RestorePointType = "Full" - RestorePointTypeIncremental RestorePointType = "Incremental" - RestorePointTypeInvalid RestorePointType = "Invalid" - RestorePointTypeLog RestorePointType = "Log" - RestorePointTypeSnapshotCopyOnlyFull RestorePointType = "SnapshotCopyOnlyFull" - RestorePointTypeSnapshotFull RestorePointType = "SnapshotFull" + RestorePointTypeDifferential RestorePointType = "Differential" + RestorePointTypeFull RestorePointType = "Full" + RestorePointTypeIncremental RestorePointType = "Incremental" + RestorePointTypeInvalid RestorePointType = "Invalid" + RestorePointTypeLog RestorePointType = "Log" ) // PossibleRestorePointTypeValues returns the possible values for the RestorePointType const type. @@ -1315,8 +565,6 @@ func PossibleRestorePointTypeValues() []RestorePointType { RestorePointTypeIncremental, RestorePointTypeInvalid, RestorePointTypeLog, - RestorePointTypeSnapshotCopyOnlyFull, - RestorePointTypeSnapshotFull, } } @@ -1338,46 +586,6 @@ func PossibleRestoreRequestTypeValues() []RestoreRequestType { } } -// RetentionDurationType - Retention duration type of retention policy. -type RetentionDurationType string - -const ( - RetentionDurationTypeDays RetentionDurationType = "Days" - RetentionDurationTypeInvalid RetentionDurationType = "Invalid" - RetentionDurationTypeMonths RetentionDurationType = "Months" - RetentionDurationTypeWeeks RetentionDurationType = "Weeks" - RetentionDurationTypeYears RetentionDurationType = "Years" -) - -// PossibleRetentionDurationTypeValues returns the possible values for the RetentionDurationType const type. -func PossibleRetentionDurationTypeValues() []RetentionDurationType { - return []RetentionDurationType{ - RetentionDurationTypeDays, - RetentionDurationTypeInvalid, - RetentionDurationTypeMonths, - RetentionDurationTypeWeeks, - RetentionDurationTypeYears, - } -} - -// RetentionScheduleFormat - Retention schedule format type for monthly retention policy. -type RetentionScheduleFormat string - -const ( - RetentionScheduleFormatDaily RetentionScheduleFormat = "Daily" - RetentionScheduleFormatInvalid RetentionScheduleFormat = "Invalid" - RetentionScheduleFormatWeekly RetentionScheduleFormat = "Weekly" -) - -// PossibleRetentionScheduleFormatValues returns the possible values for the RetentionScheduleFormat const type. -func PossibleRetentionScheduleFormatValues() []RetentionScheduleFormat { - return []RetentionScheduleFormat{ - RetentionScheduleFormatDaily, - RetentionScheduleFormatInvalid, - RetentionScheduleFormatWeekly, - } -} - // SQLDataDirectoryType - Type of data directory mapping type SQLDataDirectoryType string @@ -1396,46 +604,6 @@ func PossibleSQLDataDirectoryTypeValues() []SQLDataDirectoryType { } } -// ScheduleRunType - Frequency of the schedule operation of this policy. -type ScheduleRunType string - -const ( - ScheduleRunTypeDaily ScheduleRunType = "Daily" - ScheduleRunTypeHourly ScheduleRunType = "Hourly" - ScheduleRunTypeInvalid ScheduleRunType = "Invalid" - ScheduleRunTypeWeekly ScheduleRunType = "Weekly" -) - -// PossibleScheduleRunTypeValues returns the possible values for the ScheduleRunType const type. -func PossibleScheduleRunTypeValues() []ScheduleRunType { - return []ScheduleRunType{ - ScheduleRunTypeDaily, - ScheduleRunTypeHourly, - ScheduleRunTypeInvalid, - ScheduleRunTypeWeekly, - } -} - -// SoftDeleteFeatureState - Soft Delete feature state -type SoftDeleteFeatureState string - -const ( - SoftDeleteFeatureStateAlwaysON SoftDeleteFeatureState = "AlwaysON" - SoftDeleteFeatureStateDisabled SoftDeleteFeatureState = "Disabled" - SoftDeleteFeatureStateEnabled SoftDeleteFeatureState = "Enabled" - SoftDeleteFeatureStateInvalid SoftDeleteFeatureState = "Invalid" -) - -// PossibleSoftDeleteFeatureStateValues returns the possible values for the SoftDeleteFeatureState const type. -func PossibleSoftDeleteFeatureStateValues() []SoftDeleteFeatureState { - return []SoftDeleteFeatureState{ - SoftDeleteFeatureStateAlwaysON, - SoftDeleteFeatureStateDisabled, - SoftDeleteFeatureStateEnabled, - SoftDeleteFeatureStateInvalid, - } -} - // StorageType - Storage type type StorageType string @@ -1477,69 +645,6 @@ func PossibleStorageTypeStateValues() []StorageTypeState { } } -// SupportStatus - Support status of feature -type SupportStatus string - -const ( - SupportStatusDefaultOFF SupportStatus = "DefaultOFF" - SupportStatusDefaultON SupportStatus = "DefaultON" - SupportStatusInvalid SupportStatus = "Invalid" - SupportStatusNotSupported SupportStatus = "NotSupported" - SupportStatusSupported SupportStatus = "Supported" -) - -// PossibleSupportStatusValues returns the possible values for the SupportStatus const type. -func PossibleSupportStatusValues() []SupportStatus { - return []SupportStatus{ - SupportStatusDefaultOFF, - SupportStatusDefaultON, - SupportStatusInvalid, - SupportStatusNotSupported, - SupportStatusSupported, - } -} - -// TargetDiskNetworkAccessOption - Network access settings to be used for restored disks -type TargetDiskNetworkAccessOption string - -const ( - TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePrivateAccessForAllDisks" - TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePublicAccessForAllDisks" - TargetDiskNetworkAccessOptionSameAsOnSourceDisks TargetDiskNetworkAccessOption = "SameAsOnSourceDisks" -) - -// PossibleTargetDiskNetworkAccessOptionValues returns the possible values for the TargetDiskNetworkAccessOption const type. -func PossibleTargetDiskNetworkAccessOptionValues() []TargetDiskNetworkAccessOption { - return []TargetDiskNetworkAccessOption{ - TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks, - TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks, - TargetDiskNetworkAccessOptionSameAsOnSourceDisks, - } -} - -// TieringMode - Tiering Mode to control automatic tiering of recovery points. Supported values are: -// 1. TierRecommended: Tier all recovery points recommended to be tiered -// 2. TierAfter: Tier all recovery points after a fixed period, as specified in duration + durationType below. -// 3. DoNotTier: Do not tier any recovery points -type TieringMode string - -const ( - TieringModeDoNotTier TieringMode = "DoNotTier" - TieringModeInvalid TieringMode = "Invalid" - TieringModeTierAfter TieringMode = "TierAfter" - TieringModeTierRecommended TieringMode = "TierRecommended" -) - -// PossibleTieringModeValues returns the possible values for the TieringMode const type. -func PossibleTieringModeValues() []TieringMode { - return []TieringMode{ - TieringModeDoNotTier, - TieringModeInvalid, - TieringModeTierAfter, - TieringModeTierRecommended, - } -} - // Type - Backup management type for this container. type Type string @@ -1582,94 +687,7 @@ func PossibleUsagesUnitValues() []UsagesUnit { } } -// ValidationStatus - Validation Status -type ValidationStatus string - -const ( - ValidationStatusFailed ValidationStatus = "Failed" - ValidationStatusInvalid ValidationStatus = "Invalid" - ValidationStatusSucceeded ValidationStatus = "Succeeded" -) - -// PossibleValidationStatusValues returns the possible values for the ValidationStatus const type. -func PossibleValidationStatusValues() []ValidationStatus { - return []ValidationStatus{ - ValidationStatusFailed, - ValidationStatusInvalid, - ValidationStatusSucceeded, - } -} - -// VaultSubResourceType - GroupId for the PrivateEndpointConnection - AzureBackup, AzureBackup_secondary or AzureSiteRecovery -type VaultSubResourceType string - -const ( - VaultSubResourceTypeAzureBackup VaultSubResourceType = "AzureBackup" - VaultSubResourceTypeAzureBackupSecondary VaultSubResourceType = "AzureBackup_secondary" - VaultSubResourceTypeAzureSiteRecovery VaultSubResourceType = "AzureSiteRecovery" -) - -// PossibleVaultSubResourceTypeValues returns the possible values for the VaultSubResourceType const type. -func PossibleVaultSubResourceTypeValues() []VaultSubResourceType { - return []VaultSubResourceType{ - VaultSubResourceTypeAzureBackup, - VaultSubResourceTypeAzureBackupSecondary, - VaultSubResourceTypeAzureSiteRecovery, - } -} - -type WeekOfMonth string - -const ( - WeekOfMonthFirst WeekOfMonth = "First" - WeekOfMonthFourth WeekOfMonth = "Fourth" - WeekOfMonthInvalid WeekOfMonth = "Invalid" - WeekOfMonthLast WeekOfMonth = "Last" - WeekOfMonthSecond WeekOfMonth = "Second" - WeekOfMonthThird WeekOfMonth = "Third" -) - -// PossibleWeekOfMonthValues returns the possible values for the WeekOfMonth const type. -func PossibleWeekOfMonthValues() []WeekOfMonth { - return []WeekOfMonth{ - WeekOfMonthFirst, - WeekOfMonthFourth, - WeekOfMonthInvalid, - WeekOfMonthLast, - WeekOfMonthSecond, - WeekOfMonthThird, - } -} - -// WorkloadItemType - Workload item type of the item for which intent is to be set -type WorkloadItemType string - -const ( - WorkloadItemTypeInvalid WorkloadItemType = "Invalid" - WorkloadItemTypeSAPAseDatabase WorkloadItemType = "SAPAseDatabase" - WorkloadItemTypeSAPAseSystem WorkloadItemType = "SAPAseSystem" - WorkloadItemTypeSAPHanaDBInstance WorkloadItemType = "SAPHanaDBInstance" - WorkloadItemTypeSAPHanaDatabase WorkloadItemType = "SAPHanaDatabase" - WorkloadItemTypeSAPHanaSystem WorkloadItemType = "SAPHanaSystem" - WorkloadItemTypeSQLDataBase WorkloadItemType = "SQLDataBase" - WorkloadItemTypeSQLInstance WorkloadItemType = "SQLInstance" -) - -// PossibleWorkloadItemTypeValues returns the possible values for the WorkloadItemType const type. -func PossibleWorkloadItemTypeValues() []WorkloadItemType { - return []WorkloadItemType{ - WorkloadItemTypeInvalid, - WorkloadItemTypeSAPAseDatabase, - WorkloadItemTypeSAPAseSystem, - WorkloadItemTypeSAPHanaDBInstance, - WorkloadItemTypeSAPHanaDatabase, - WorkloadItemTypeSAPHanaSystem, - WorkloadItemTypeSQLDataBase, - WorkloadItemTypeSQLInstance, - } -} - -// WorkloadType - Type of workload for the backup management +// WorkloadType - Workload type of backup item. type WorkloadType string const ( @@ -1681,7 +699,6 @@ const ( WorkloadTypeGenericDataSource WorkloadType = "GenericDataSource" WorkloadTypeInvalid WorkloadType = "Invalid" WorkloadTypeSAPAseDatabase WorkloadType = "SAPAseDatabase" - WorkloadTypeSAPHanaDBInstance WorkloadType = "SAPHanaDBInstance" WorkloadTypeSAPHanaDatabase WorkloadType = "SAPHanaDatabase" WorkloadTypeSQLDB WorkloadType = "SQLDB" WorkloadTypeSQLDataBase WorkloadType = "SQLDataBase" @@ -1702,7 +719,6 @@ func PossibleWorkloadTypeValues() []WorkloadType { WorkloadTypeGenericDataSource, WorkloadTypeInvalid, WorkloadTypeSAPAseDatabase, - WorkloadTypeSAPHanaDBInstance, WorkloadTypeSAPHanaDatabase, WorkloadTypeSQLDB, WorkloadTypeSQLDataBase, @@ -1712,21 +728,3 @@ func PossibleWorkloadTypeValues() []WorkloadType { WorkloadTypeVMwareVM, } } - -// XcoolState - Vault x-cool state -type XcoolState string - -const ( - XcoolStateDisabled XcoolState = "Disabled" - XcoolStateEnabled XcoolState = "Enabled" - XcoolStateInvalid XcoolState = "Invalid" -) - -// PossibleXcoolStateValues returns the possible values for the XcoolState const type. -func PossibleXcoolStateValues() []XcoolState { - return []XcoolState{ - XcoolStateDisabled, - XcoolStateEnabled, - XcoolStateInvalid, - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crossregionrestore_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crossregionrestore_client.go new file mode 100644 index 000000000000..e1583696533d --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crossregionrestore_client.go @@ -0,0 +1,120 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armrecoveryservicesbackup + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// CrossRegionRestoreClient contains the methods for the CrossRegionRestore group. +// Don't use this type directly, use NewCrossRegionRestoreClient() instead. +type CrossRegionRestoreClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCrossRegionRestoreClient creates a new instance of CrossRegionRestoreClient 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 NewCrossRegionRestoreClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CrossRegionRestoreClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CrossRegionRestoreClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginTrigger - Restores the specified backed up data in a different region as compared to where the data is backed up. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-15 +// - azureRegion - Azure region to hit Api +// - parameters - resource cross region restore request +// - options - CrossRegionRestoreClientBeginTriggerOptions contains the optional parameters for the CrossRegionRestoreClient.BeginTrigger +// method. +func (client *CrossRegionRestoreClient) BeginTrigger(ctx context.Context, azureRegion string, parameters CrossRegionRestoreRequest, options *CrossRegionRestoreClientBeginTriggerOptions) (*runtime.Poller[CrossRegionRestoreClientTriggerResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.trigger(ctx, azureRegion, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CrossRegionRestoreClientTriggerResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CrossRegionRestoreClientTriggerResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Trigger - Restores the specified backed up data in a different region as compared to where the data is backed up. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-15 +func (client *CrossRegionRestoreClient) trigger(ctx context.Context, azureRegion string, parameters CrossRegionRestoreRequest, options *CrossRegionRestoreClientBeginTriggerOptions) (*http.Response, error) { + var err error + const operationName = "CrossRegionRestoreClient.BeginTrigger" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.triggerCreateRequest(ctx, azureRegion, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// triggerCreateRequest creates the Trigger request. +func (client *CrossRegionRestoreClient) triggerCreateRequest(ctx context.Context, azureRegion string, parameters CrossRegionRestoreRequest, options *CrossRegionRestoreClientBeginTriggerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore" + if azureRegion == "" { + return nil, errors.New("parameter azureRegion cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureRegion}", url.PathEscape(azureRegion)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crroperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crroperationresults_client.go new file mode 100644 index 000000000000..7a4832c72621 --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crroperationresults_client.go @@ -0,0 +1,97 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armrecoveryservicesbackup + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// CrrOperationResultsClient contains the methods for the CrrOperationResults group. +// Don't use this type directly, use NewCrrOperationResultsClient() instead. +type CrrOperationResultsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCrrOperationResultsClient creates a new instance of CrrOperationResultsClient 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 NewCrrOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CrrOperationResultsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CrrOperationResultsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-15 +// - azureRegion - Azure region to hit Api +// - options - CrrOperationResultsClientGetOptions contains the optional parameters for the CrrOperationResultsClient.Get method. +func (client *CrrOperationResultsClient) Get(ctx context.Context, azureRegion string, operationID string, options *CrrOperationResultsClientGetOptions) (CrrOperationResultsClientGetResponse, error) { + var err error + const operationName = "CrrOperationResultsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, azureRegion, operationID, options) + if err != nil { + return CrrOperationResultsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CrrOperationResultsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return CrrOperationResultsClientGetResponse{}, err + } + return CrrOperationResultsClientGetResponse{}, nil +} + +// getCreateRequest creates the Get request. +func (client *CrrOperationResultsClient) getCreateRequest(ctx context.Context, azureRegion string, operationID string, options *CrrOperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}" + if azureRegion == "" { + return nil, errors.New("parameter azureRegion cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureRegion}", url.PathEscape(azureRegion)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crroperationstatus_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crroperationstatus_client.go new file mode 100644 index 000000000000..3c499b91d9e0 --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/crroperationstatus_client.go @@ -0,0 +1,107 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armrecoveryservicesbackup + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// CrrOperationStatusClient contains the methods for the CrrOperationStatus group. +// Don't use this type directly, use NewCrrOperationStatusClient() instead. +type CrrOperationStatusClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCrrOperationStatusClient creates a new instance of CrrOperationStatusClient 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 NewCrrOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CrrOperationStatusClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CrrOperationStatusClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-15 +// - azureRegion - Azure region to hit Api +// - options - CrrOperationStatusClientGetOptions contains the optional parameters for the CrrOperationStatusClient.Get method. +func (client *CrrOperationStatusClient) Get(ctx context.Context, azureRegion string, operationID string, options *CrrOperationStatusClientGetOptions) (CrrOperationStatusClientGetResponse, error) { + var err error + const operationName = "CrrOperationStatusClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, azureRegion, operationID, options) + if err != nil { + return CrrOperationStatusClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CrrOperationStatusClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CrrOperationStatusClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CrrOperationStatusClient) getCreateRequest(ctx context.Context, azureRegion string, operationID string, options *CrrOperationStatusClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}" + if azureRegion == "" { + return nil, errors.New("parameter azureRegion cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureRegion}", url.PathEscape(azureRegion)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CrrOperationStatusClient) getHandleResponse(resp *http.Response) (CrrOperationStatusClientGetResponse, error) { + result := CrrOperationStatusClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + return CrrOperationStatusClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/deletedprotectioncontainers_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/deletedprotectioncontainers_client.go deleted file mode 100644 index 8611d4f9dc6f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/deletedprotectioncontainers_client.go +++ /dev/null @@ -1,112 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// DeletedProtectionContainersClient contains the methods for the DeletedProtectionContainers group. -// Don't use this type directly, use NewDeletedProtectionContainersClient() instead. -type DeletedProtectionContainersClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDeletedProtectionContainersClient creates a new instance of DeletedProtectionContainersClient 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 NewDeletedProtectionContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedProtectionContainersClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DeletedProtectionContainersClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the soft deleted containers registered to Recovery Services Vault. -// -// Generated from API version 2024-04-01 -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - vaultName - The name of the recovery services vault. -// - options - DeletedProtectionContainersClientListOptions contains the optional parameters for the DeletedProtectionContainersClient.NewListPager -// method. -func (client *DeletedProtectionContainersClient) NewListPager(resourceGroupName string, vaultName string, options *DeletedProtectionContainersClientListOptions) *runtime.Pager[DeletedProtectionContainersClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DeletedProtectionContainersClientListResponse]{ - More: func(page DeletedProtectionContainersClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DeletedProtectionContainersClientListResponse) (DeletedProtectionContainersClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeletedProtectionContainersClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) - }, nil) - if err != nil { - return DeletedProtectionContainersClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DeletedProtectionContainersClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *DeletedProtectionContainersClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers" - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DeletedProtectionContainersClient) listHandleResponse(resp *http.Response) (DeletedProtectionContainersClientListResponse, error) { - result := DeletedProtectionContainersClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionContainerResourceList); err != nil { - return DeletedProtectionContainersClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/deletedprotectioncontainers_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/deletedprotectioncontainers_client_example_test.go deleted file mode 100644 index cd79130e82df..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/deletedprotectioncontainers_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/SoftDeletedContainers_List.json -func ExampleDeletedProtectionContainersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeletedProtectionContainersClient().NewListPager("testRg", "testVault", &armrecoveryservicesbackup.DeletedProtectionContainersClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureWorkload'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectionContainerResourceList = armrecoveryservicesbackup.ProtectionContainerResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectionContainerResource{ - // { - // Name: to.Ptr("StorageContainer;Storage;testrg;suchandrtestsa125"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers"), - // ID: to.Ptr("/subscriptions/172424a4-d65f-421e-a8de-197d98aabeba/resourcegroups/testrg/providers/microsoft.recoveryservices/vaults/suchandr-test-vault-wcus/backupFabrics/Azure/protectionContainers/StorageContainer;Storage;testrg;suchandrtestsa125"), - // Properties: &armrecoveryservicesbackup.AzureStorageContainer{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureStorage), - // ContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeStorageContainer), - // FriendlyName: to.Ptr("suchandrtestsa125"), - // HealthStatus: to.Ptr("Healthy"), - // RegistrationStatus: to.Ptr("SoftDeleted"), - // ProtectedItemCount: to.Ptr[int64](2), - // SourceResourceID: to.Ptr("/subscriptions/172424a4-d65f-421e-a8de-197d98aabeba/resourceGroups/testrg/providers/Microsoft.Storage/storageAccounts/suchandrtestsa125"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/exportjobsoperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/exportjobsoperationresults_client.go deleted file mode 100644 index fd388f9e64bf..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/exportjobsoperationresults_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ExportJobsOperationResultsClient contains the methods for the ExportJobsOperationResults group. -// Don't use this type directly, use NewExportJobsOperationResultsClient() instead. -type ExportJobsOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewExportJobsOperationResultsClient creates a new instance of ExportJobsOperationResultsClient 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 NewExportJobsOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportJobsOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ExportJobsOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also -// contains URL of a Blob and a SAS key to access the same. The blob contains exported -// jobs in JSON serialized format. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - operationID - OperationID which represents the export job. -// - options - ExportJobsOperationResultsClientGetOptions contains the optional parameters for the ExportJobsOperationResultsClient.Get -// method. -func (client *ExportJobsOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ExportJobsOperationResultsClientGetOptions) (ExportJobsOperationResultsClientGetResponse, error) { - var err error - const operationName = "ExportJobsOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) - if err != nil { - return ExportJobsOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExportJobsOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ExportJobsOperationResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ExportJobsOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ExportJobsOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ExportJobsOperationResultsClient) getHandleResponse(resp *http.Response) (ExportJobsOperationResultsClientGetResponse, error) { - result := ExportJobsOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationResultInfoBaseResource); err != nil { - return ExportJobsOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/exportjobsoperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/exportjobsoperationresults_client_example_test.go deleted file mode 100644 index ffd6ce16e3e4..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/exportjobsoperationresults_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ExportJobsOperationResult.json -func ExampleExportJobsOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportJobsOperationResultsClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationResultInfoBaseResource = armrecoveryservicesbackup.OperationResultInfoBaseResource{ - // Headers: map[string][]*string{ - // }, - // Operation: &armrecoveryservicesbackup.ExportJobsOperationResultInfo{ - // ObjectType: to.Ptr("ExportJobsOperationResultInfo"), - // BlobSasKey: to.Ptr("?sv=2014-02-14&sr=b&sig=&st=2017-11-29T07%3A53%3A34Z&se=2017-11-29T08%3A03%3A34Z&sp=r"), - // BlobURL: to.Ptr("https://azureblob.blob.core.windows.net/reportcontainer/exportjobsreportc00000000-0000-0000-0000-000000000000"), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/aadproperties_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/aadproperties_server.go new file mode 100644 index 000000000000..6218287a248b --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/aadproperties_server.go @@ -0,0 +1,108 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" + "net/http" + "net/url" + "regexp" +) + +// AADPropertiesServer is a fake server for instances of the armrecoveryservicesbackup.AADPropertiesClient type. +type AADPropertiesServer struct { + // Get is the fake for method AADPropertiesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, azureRegion string, options *armrecoveryservicesbackup.AADPropertiesClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.AADPropertiesClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewAADPropertiesServerTransport creates a new instance of AADPropertiesServerTransport with the provided implementation. +// The returned AADPropertiesServerTransport instance is connected to an instance of armrecoveryservicesbackup.AADPropertiesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAADPropertiesServerTransport(srv *AADPropertiesServer) *AADPropertiesServerTransport { + return &AADPropertiesServerTransport{srv: srv} +} + +// AADPropertiesServerTransport connects instances of armrecoveryservicesbackup.AADPropertiesClient to instances of AADPropertiesServer. +// Don't use this type directly, use NewAADPropertiesServerTransport instead. +type AADPropertiesServerTransport struct { + srv *AADPropertiesServer +} + +// Do implements the policy.Transporter interface for AADPropertiesServerTransport. +func (a *AADPropertiesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AADPropertiesClient.Get": + resp, err = a.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AADPropertiesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupAadProperties` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + azureRegionParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureRegion")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armrecoveryservicesbackup.AADPropertiesClientGetOptions + if filterParam != nil { + options = &armrecoveryservicesbackup.AADPropertiesClientGetOptions{ + Filter: filterParam, + } + } + respr, errRespr := a.srv.Get(req.Context(), azureRegionParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AADPropertiesResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupstatus_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupcrrjobdetails_server.go similarity index 57% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupstatus_server.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupcrrjobdetails_server.go index 12920af6877f..53731c5def3b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupstatus_server.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupcrrjobdetails_server.go @@ -15,34 +15,34 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" "net/http" "net/url" "regexp" ) -// BackupStatusServer is a fake server for instances of the armrecoveryservicesbackup.BackupStatusClient type. -type BackupStatusServer struct { - // Get is the fake for method BackupStatusClient.Get +// BackupCrrJobDetailsServer is a fake server for instances of the armrecoveryservicesbackup.BackupCrrJobDetailsClient type. +type BackupCrrJobDetailsServer struct { + // Get is the fake for method BackupCrrJobDetailsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, azureRegion string, parameters armrecoveryservicesbackup.BackupStatusRequest, options *armrecoveryservicesbackup.BackupStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupStatusClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, azureRegion string, parameters armrecoveryservicesbackup.CrrJobRequest, options *armrecoveryservicesbackup.BackupCrrJobDetailsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupCrrJobDetailsClientGetResponse], errResp azfake.ErrorResponder) } -// NewBackupStatusServerTransport creates a new instance of BackupStatusServerTransport with the provided implementation. -// The returned BackupStatusServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupStatusClient via the +// NewBackupCrrJobDetailsServerTransport creates a new instance of BackupCrrJobDetailsServerTransport with the provided implementation. +// The returned BackupCrrJobDetailsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupCrrJobDetailsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupStatusServerTransport(srv *BackupStatusServer) *BackupStatusServerTransport { - return &BackupStatusServerTransport{srv: srv} +func NewBackupCrrJobDetailsServerTransport(srv *BackupCrrJobDetailsServer) *BackupCrrJobDetailsServerTransport { + return &BackupCrrJobDetailsServerTransport{srv: srv} } -// BackupStatusServerTransport connects instances of armrecoveryservicesbackup.BackupStatusClient to instances of BackupStatusServer. -// Don't use this type directly, use NewBackupStatusServerTransport instead. -type BackupStatusServerTransport struct { - srv *BackupStatusServer +// BackupCrrJobDetailsServerTransport connects instances of armrecoveryservicesbackup.BackupCrrJobDetailsClient to instances of BackupCrrJobDetailsServer. +// Don't use this type directly, use NewBackupCrrJobDetailsServerTransport instead. +type BackupCrrJobDetailsServerTransport struct { + srv *BackupCrrJobDetailsServer } -// Do implements the policy.Transporter interface for BackupStatusServerTransport. -func (b *BackupStatusServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for BackupCrrJobDetailsServerTransport. +func (b *BackupCrrJobDetailsServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -53,7 +53,7 @@ func (b *BackupStatusServerTransport) Do(req *http.Request) (*http.Response, err var err error switch method { - case "BackupStatusClient.Get": + case "BackupCrrJobDetailsClient.Get": resp, err = b.dispatchGet(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -66,17 +66,17 @@ func (b *BackupStatusServerTransport) Do(req *http.Request) (*http.Response, err return resp, nil } -func (b *BackupStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (b *BackupCrrJobDetailsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if b.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupStatus` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupCrrJob` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.BackupStatusRequest](req) + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.CrrJobRequest](req) if err != nil { return nil, err } @@ -92,7 +92,7 @@ func (b *BackupStatusServerTransport) dispatchGet(req *http.Request) (*http.Resp if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupStatusResponse, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JobResource, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupjobs_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupcrrjobs_server.go similarity index 57% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupjobs_server.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupcrrjobs_server.go index 65698105c39d..550885501829 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupjobs_server.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupcrrjobs_server.go @@ -15,38 +15,38 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" "net/http" "net/url" "regexp" ) -// BackupJobsServer is a fake server for instances of the armrecoveryservicesbackup.BackupJobsClient type. -type BackupJobsServer struct { - // NewListPager is the fake for method BackupJobsClient.NewListPager +// BackupCrrJobsServer is a fake server for instances of the armrecoveryservicesbackup.BackupCrrJobsClient type. +type BackupCrrJobsServer struct { + // NewListPager is the fake for method BackupCrrJobsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupJobsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupJobsClientListResponse]) + NewListPager func(azureRegion string, parameters armrecoveryservicesbackup.CrrJobRequest, options *armrecoveryservicesbackup.BackupCrrJobsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupCrrJobsClientListResponse]) } -// NewBackupJobsServerTransport creates a new instance of BackupJobsServerTransport with the provided implementation. -// The returned BackupJobsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupJobsClient via the +// NewBackupCrrJobsServerTransport creates a new instance of BackupCrrJobsServerTransport with the provided implementation. +// The returned BackupCrrJobsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupCrrJobsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupJobsServerTransport(srv *BackupJobsServer) *BackupJobsServerTransport { - return &BackupJobsServerTransport{ +func NewBackupCrrJobsServerTransport(srv *BackupCrrJobsServer) *BackupCrrJobsServerTransport { + return &BackupCrrJobsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupJobsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupCrrJobsClientListResponse]](), } } -// BackupJobsServerTransport connects instances of armrecoveryservicesbackup.BackupJobsClient to instances of BackupJobsServer. -// Don't use this type directly, use NewBackupJobsServerTransport instead. -type BackupJobsServerTransport struct { - srv *BackupJobsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupJobsClientListResponse]] +// BackupCrrJobsServerTransport connects instances of armrecoveryservicesbackup.BackupCrrJobsClient to instances of BackupCrrJobsServer. +// Don't use this type directly, use NewBackupCrrJobsServerTransport instead. +type BackupCrrJobsServerTransport struct { + srv *BackupCrrJobsServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupCrrJobsClientListResponse]] } -// Do implements the policy.Transporter interface for BackupJobsServerTransport. -func (b *BackupJobsServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for BackupCrrJobsServerTransport. +func (b *BackupCrrJobsServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -57,7 +57,7 @@ func (b *BackupJobsServerTransport) Do(req *http.Request) (*http.Response, error var err error switch method { - case "BackupJobsClient.NewListPager": + case "BackupCrrJobsClient.NewListPager": resp, err = b.dispatchNewListPager(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -70,24 +70,24 @@ func (b *BackupJobsServerTransport) Do(req *http.Request) (*http.Response, error return resp, nil } -func (b *BackupJobsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (b *BackupCrrJobsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if b.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } newListPager := b.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupJobs` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupCrrJobs` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if matches == nil || len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.CrrJobRequest](req) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + azureRegionParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureRegion")]) if err != nil { return nil, err } @@ -101,17 +101,17 @@ func (b *BackupJobsServerTransport) dispatchNewListPager(req *http.Request) (*ht return nil, err } skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupJobsClientListOptions + var options *armrecoveryservicesbackup.BackupCrrJobsClientListOptions if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupJobsClientListOptions{ + options = &armrecoveryservicesbackup.BackupCrrJobsClientListOptions{ Filter: filterParam, SkipToken: skipTokenParam, } } - resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, options) + resp := b.srv.NewListPager(azureRegionParam, body, options) newListPager = &resp b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupJobsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupCrrJobsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupengines_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupengines_server.go deleted file mode 100644 index e11db8dea6e7..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupengines_server.go +++ /dev/null @@ -1,192 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupEnginesServer is a fake server for instances of the armrecoveryservicesbackup.BackupEnginesClient type. -type BackupEnginesServer struct { - // Get is the fake for method BackupEnginesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, backupEngineName string, options *armrecoveryservicesbackup.BackupEnginesClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupEnginesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method BackupEnginesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupEnginesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupEnginesClientListResponse]) -} - -// NewBackupEnginesServerTransport creates a new instance of BackupEnginesServerTransport with the provided implementation. -// The returned BackupEnginesServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupEnginesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupEnginesServerTransport(srv *BackupEnginesServer) *BackupEnginesServerTransport { - return &BackupEnginesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupEnginesClientListResponse]](), - } -} - -// BackupEnginesServerTransport connects instances of armrecoveryservicesbackup.BackupEnginesClient to instances of BackupEnginesServer. -// Don't use this type directly, use NewBackupEnginesServerTransport instead. -type BackupEnginesServerTransport struct { - srv *BackupEnginesServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupEnginesClientListResponse]] -} - -// Do implements the policy.Transporter interface for BackupEnginesServerTransport. -func (b *BackupEnginesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupEnginesClient.Get": - resp, err = b.dispatchGet(req) - case "BackupEnginesClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupEnginesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupEngines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - backupEngineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupEngineName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupEnginesClientGetOptions - if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupEnginesClientGetOptions{ - Filter: filterParam, - SkipToken: skipTokenParam, - } - } - respr, errRespr := b.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, backupEngineNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupEngineBaseResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BackupEnginesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupEngines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupEnginesClientListOptions - if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupEnginesClientListOptions{ - Filter: filterParam, - SkipToken: skipTokenParam, - } - } - resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupEnginesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupoperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupoperationresults_server.go deleted file mode 100644 index cbd4601dfe8d..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupoperationresults_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.BackupOperationResultsClient type. -type BackupOperationResultsServer struct { - // Get is the fake for method BackupOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - Get func(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *armrecoveryservicesbackup.BackupOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewBackupOperationResultsServerTransport creates a new instance of BackupOperationResultsServerTransport with the provided implementation. -// The returned BackupOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupOperationResultsServerTransport(srv *BackupOperationResultsServer) *BackupOperationResultsServerTransport { - return &BackupOperationResultsServerTransport{srv: srv} -} - -// BackupOperationResultsServerTransport connects instances of armrecoveryservicesbackup.BackupOperationResultsClient to instances of BackupOperationResultsServer. -// Don't use this type directly, use NewBackupOperationResultsServerTransport instead. -type BackupOperationResultsServerTransport struct { - srv *BackupOperationResultsServer -} - -// Do implements the policy.Transporter interface for BackupOperationResultsServerTransport. -func (b *BackupOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupOperationResultsClient.Get": - resp, err = b.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupOperationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupoperationstatuses_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupoperationstatuses_server.go deleted file mode 100644 index 6ab39a20ce84..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupoperationstatuses_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupOperationStatusesServer is a fake server for instances of the armrecoveryservicesbackup.BackupOperationStatusesClient type. -type BackupOperationStatusesServer struct { - // Get is the fake for method BackupOperationStatusesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *armrecoveryservicesbackup.BackupOperationStatusesClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupOperationStatusesClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewBackupOperationStatusesServerTransport creates a new instance of BackupOperationStatusesServerTransport with the provided implementation. -// The returned BackupOperationStatusesServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupOperationStatusesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupOperationStatusesServerTransport(srv *BackupOperationStatusesServer) *BackupOperationStatusesServerTransport { - return &BackupOperationStatusesServerTransport{srv: srv} -} - -// BackupOperationStatusesServerTransport connects instances of armrecoveryservicesbackup.BackupOperationStatusesClient to instances of BackupOperationStatusesServer. -// Don't use this type directly, use NewBackupOperationStatusesServerTransport instead. -type BackupOperationStatusesServerTransport struct { - srv *BackupOperationStatusesServer -} - -// Do implements the policy.Transporter interface for BackupOperationStatusesServerTransport. -func (b *BackupOperationStatusesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupOperationStatusesClient.Get": - resp, err = b.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupOperationStatusesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupOperations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backuppolicies_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backuppolicies_server.go deleted file mode 100644 index 8bca04a489fe..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backuppolicies_server.go +++ /dev/null @@ -1,124 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupPoliciesServer is a fake server for instances of the armrecoveryservicesbackup.BackupPoliciesClient type. -type BackupPoliciesServer struct { - // NewListPager is the fake for method BackupPoliciesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupPoliciesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupPoliciesClientListResponse]) -} - -// NewBackupPoliciesServerTransport creates a new instance of BackupPoliciesServerTransport with the provided implementation. -// The returned BackupPoliciesServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupPoliciesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupPoliciesServerTransport(srv *BackupPoliciesServer) *BackupPoliciesServerTransport { - return &BackupPoliciesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupPoliciesClientListResponse]](), - } -} - -// BackupPoliciesServerTransport connects instances of armrecoveryservicesbackup.BackupPoliciesClient to instances of BackupPoliciesServer. -// Don't use this type directly, use NewBackupPoliciesServerTransport instead. -type BackupPoliciesServerTransport struct { - srv *BackupPoliciesServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupPoliciesClientListResponse]] -} - -// Do implements the policy.Transporter interface for BackupPoliciesServerTransport. -func (b *BackupPoliciesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupPoliciesClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupPolicies` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.BackupPoliciesClientListOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.BackupPoliciesClientListOptions{ - Filter: filterParam, - } - } - resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupPoliciesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectableitems_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectableitems_server.go deleted file mode 100644 index 736b0fa3e512..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectableitems_server.go +++ /dev/null @@ -1,130 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupProtectableItemsServer is a fake server for instances of the armrecoveryservicesbackup.BackupProtectableItemsClient type. -type BackupProtectableItemsServer struct { - // NewListPager is the fake for method BackupProtectableItemsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupProtectableItemsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectableItemsClientListResponse]) -} - -// NewBackupProtectableItemsServerTransport creates a new instance of BackupProtectableItemsServerTransport with the provided implementation. -// The returned BackupProtectableItemsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupProtectableItemsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupProtectableItemsServerTransport(srv *BackupProtectableItemsServer) *BackupProtectableItemsServerTransport { - return &BackupProtectableItemsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectableItemsClientListResponse]](), - } -} - -// BackupProtectableItemsServerTransport connects instances of armrecoveryservicesbackup.BackupProtectableItemsClient to instances of BackupProtectableItemsServer. -// Don't use this type directly, use NewBackupProtectableItemsServerTransport instead. -type BackupProtectableItemsServerTransport struct { - srv *BackupProtectableItemsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectableItemsClientListResponse]] -} - -// Do implements the policy.Transporter interface for BackupProtectableItemsServerTransport. -func (b *BackupProtectableItemsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupProtectableItemsClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupProtectableItemsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectableItems` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupProtectableItemsClientListOptions - if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupProtectableItemsClientListOptions{ - Filter: filterParam, - SkipToken: skipTokenParam, - } - } - resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupProtectableItemsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotecteditems_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotecteditemscrr_server.go similarity index 64% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotecteditems_server.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotecteditemscrr_server.go index 8371095ae9f5..d0540fe3e894 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotecteditems_server.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotecteditemscrr_server.go @@ -15,38 +15,38 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" "net/http" "net/url" "regexp" ) -// BackupProtectedItemsServer is a fake server for instances of the armrecoveryservicesbackup.BackupProtectedItemsClient type. -type BackupProtectedItemsServer struct { - // NewListPager is the fake for method BackupProtectedItemsClient.NewListPager +// BackupProtectedItemsCrrServer is a fake server for instances of the armrecoveryservicesbackup.BackupProtectedItemsCrrClient type. +type BackupProtectedItemsCrrServer struct { + // NewListPager is the fake for method BackupProtectedItemsCrrClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupProtectedItemsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectedItemsClientListResponse]) + NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupProtectedItemsCrrClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectedItemsCrrClientListResponse]) } -// NewBackupProtectedItemsServerTransport creates a new instance of BackupProtectedItemsServerTransport with the provided implementation. -// The returned BackupProtectedItemsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupProtectedItemsClient via the +// NewBackupProtectedItemsCrrServerTransport creates a new instance of BackupProtectedItemsCrrServerTransport with the provided implementation. +// The returned BackupProtectedItemsCrrServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupProtectedItemsCrrClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupProtectedItemsServerTransport(srv *BackupProtectedItemsServer) *BackupProtectedItemsServerTransport { - return &BackupProtectedItemsServerTransport{ +func NewBackupProtectedItemsCrrServerTransport(srv *BackupProtectedItemsCrrServer) *BackupProtectedItemsCrrServerTransport { + return &BackupProtectedItemsCrrServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectedItemsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectedItemsCrrClientListResponse]](), } } -// BackupProtectedItemsServerTransport connects instances of armrecoveryservicesbackup.BackupProtectedItemsClient to instances of BackupProtectedItemsServer. -// Don't use this type directly, use NewBackupProtectedItemsServerTransport instead. -type BackupProtectedItemsServerTransport struct { - srv *BackupProtectedItemsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectedItemsClientListResponse]] +// BackupProtectedItemsCrrServerTransport connects instances of armrecoveryservicesbackup.BackupProtectedItemsCrrClient to instances of BackupProtectedItemsCrrServer. +// Don't use this type directly, use NewBackupProtectedItemsCrrServerTransport instead. +type BackupProtectedItemsCrrServerTransport struct { + srv *BackupProtectedItemsCrrServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectedItemsCrrClientListResponse]] } -// Do implements the policy.Transporter interface for BackupProtectedItemsServerTransport. -func (b *BackupProtectedItemsServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for BackupProtectedItemsCrrServerTransport. +func (b *BackupProtectedItemsCrrServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -57,7 +57,7 @@ func (b *BackupProtectedItemsServerTransport) Do(req *http.Request) (*http.Respo var err error switch method { - case "BackupProtectedItemsClient.NewListPager": + case "BackupProtectedItemsCrrClient.NewListPager": resp, err = b.dispatchNewListPager(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -70,13 +70,13 @@ func (b *BackupProtectedItemsServerTransport) Do(req *http.Request) (*http.Respo return resp, nil } -func (b *BackupProtectedItemsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (b *BackupProtectedItemsCrrServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if b.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } newListPager := b.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectedItems` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectedItems/` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -101,9 +101,9 @@ func (b *BackupProtectedItemsServerTransport) dispatchNewListPager(req *http.Req return nil, err } skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupProtectedItemsClientListOptions + var options *armrecoveryservicesbackup.BackupProtectedItemsCrrClientListOptions if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupProtectedItemsClientListOptions{ + options = &armrecoveryservicesbackup.BackupProtectedItemsCrrClientListOptions{ Filter: filterParam, SkipToken: skipTokenParam, } @@ -111,7 +111,7 @@ func (b *BackupProtectedItemsServerTransport) dispatchNewListPager(req *http.Req resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, options) newListPager = &resp b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupProtectedItemsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupProtectedItemsCrrClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectioncontainers_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectioncontainers_server.go deleted file mode 100644 index 5d2ac27b13cc..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectioncontainers_server.go +++ /dev/null @@ -1,124 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupProtectionContainersServer is a fake server for instances of the armrecoveryservicesbackup.BackupProtectionContainersClient type. -type BackupProtectionContainersServer struct { - // NewListPager is the fake for method BackupProtectionContainersClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupProtectionContainersClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectionContainersClientListResponse]) -} - -// NewBackupProtectionContainersServerTransport creates a new instance of BackupProtectionContainersServerTransport with the provided implementation. -// The returned BackupProtectionContainersServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupProtectionContainersClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupProtectionContainersServerTransport(srv *BackupProtectionContainersServer) *BackupProtectionContainersServerTransport { - return &BackupProtectionContainersServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectionContainersClientListResponse]](), - } -} - -// BackupProtectionContainersServerTransport connects instances of armrecoveryservicesbackup.BackupProtectionContainersClient to instances of BackupProtectionContainersServer. -// Don't use this type directly, use NewBackupProtectionContainersServerTransport instead. -type BackupProtectionContainersServerTransport struct { - srv *BackupProtectionContainersServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectionContainersClientListResponse]] -} - -// Do implements the policy.Transporter interface for BackupProtectionContainersServerTransport. -func (b *BackupProtectionContainersServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupProtectionContainersClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupProtectionContainersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectionContainers` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.BackupProtectionContainersClientListOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.BackupProtectionContainersClientListOptions{ - Filter: filterParam, - } - } - resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupProtectionContainersClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectionintent_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectionintent_server.go deleted file mode 100644 index 7264e55d3c31..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupprotectionintent_server.go +++ /dev/null @@ -1,130 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupProtectionIntentServer is a fake server for instances of the armrecoveryservicesbackup.BackupProtectionIntentClient type. -type BackupProtectionIntentServer struct { - // NewListPager is the fake for method BackupProtectionIntentClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupProtectionIntentClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectionIntentClientListResponse]) -} - -// NewBackupProtectionIntentServerTransport creates a new instance of BackupProtectionIntentServerTransport with the provided implementation. -// The returned BackupProtectionIntentServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupProtectionIntentClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupProtectionIntentServerTransport(srv *BackupProtectionIntentServer) *BackupProtectionIntentServerTransport { - return &BackupProtectionIntentServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectionIntentClientListResponse]](), - } -} - -// BackupProtectionIntentServerTransport connects instances of armrecoveryservicesbackup.BackupProtectionIntentClient to instances of BackupProtectionIntentServer. -// Don't use this type directly, use NewBackupProtectionIntentServerTransport instead. -type BackupProtectionIntentServerTransport struct { - srv *BackupProtectionIntentServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupProtectionIntentClientListResponse]] -} - -// Do implements the policy.Transporter interface for BackupProtectionIntentServerTransport. -func (b *BackupProtectionIntentServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupProtectionIntentClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupProtectionIntentServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectionIntents` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupProtectionIntentClientListOptions - if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupProtectionIntentClientListOptions{ - Filter: filterParam, - SkipToken: skipTokenParam, - } - } - resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupProtectionIntentClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourceencryptionconfigs_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourceencryptionconfigs_server.go deleted file mode 100644 index 0728de5e689e..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourceencryptionconfigs_server.go +++ /dev/null @@ -1,143 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupResourceEncryptionConfigsServer is a fake server for instances of the armrecoveryservicesbackup.BackupResourceEncryptionConfigsClient type. -type BackupResourceEncryptionConfigsServer struct { - // Get is the fake for method BackupResourceEncryptionConfigsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupResourceEncryptionConfigsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceEncryptionConfigsClientGetResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method BackupResourceEncryptionConfigsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.BackupResourceEncryptionConfigResource, options *armrecoveryservicesbackup.BackupResourceEncryptionConfigsClientUpdateOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceEncryptionConfigsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewBackupResourceEncryptionConfigsServerTransport creates a new instance of BackupResourceEncryptionConfigsServerTransport with the provided implementation. -// The returned BackupResourceEncryptionConfigsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupResourceEncryptionConfigsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupResourceEncryptionConfigsServerTransport(srv *BackupResourceEncryptionConfigsServer) *BackupResourceEncryptionConfigsServerTransport { - return &BackupResourceEncryptionConfigsServerTransport{srv: srv} -} - -// BackupResourceEncryptionConfigsServerTransport connects instances of armrecoveryservicesbackup.BackupResourceEncryptionConfigsClient to instances of BackupResourceEncryptionConfigsServer. -// Don't use this type directly, use NewBackupResourceEncryptionConfigsServerTransport instead. -type BackupResourceEncryptionConfigsServerTransport struct { - srv *BackupResourceEncryptionConfigsServer -} - -// Do implements the policy.Transporter interface for BackupResourceEncryptionConfigsServerTransport. -func (b *BackupResourceEncryptionConfigsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupResourceEncryptionConfigsClient.Get": - resp, err = b.dispatchGet(req) - case "BackupResourceEncryptionConfigsClient.Update": - resp, err = b.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupResourceEncryptionConfigsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupEncryptionConfigs/backupResourceEncryptionConfig` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupResourceEncryptionConfigExtendedResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BackupResourceEncryptionConfigsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if b.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupEncryptionConfigs/backupResourceEncryptionConfig` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.BackupResourceEncryptionConfigResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Update(req.Context(), vaultNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcestorageconfigsnoncrr_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcestorageconfigs_server.go similarity index 70% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcestorageconfigsnoncrr_server.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcestorageconfigs_server.go index 087d13325176..554eb5daa66f 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcestorageconfigsnoncrr_server.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcestorageconfigs_server.go @@ -15,42 +15,42 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" "net/http" "net/url" "regexp" ) -// BackupResourceStorageConfigsNonCRRServer is a fake server for instances of the armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClient type. -type BackupResourceStorageConfigsNonCRRServer struct { - // Get is the fake for method BackupResourceStorageConfigsNonCRRClient.Get +// BackupResourceStorageConfigsServer is a fake server for instances of the armrecoveryservicesbackup.BackupResourceStorageConfigsClient type. +type BackupResourceStorageConfigsServer struct { + // Get is the fake for method BackupResourceStorageConfigsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupResourceStorageConfigsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceStorageConfigsClientGetResponse], errResp azfake.ErrorResponder) - // Patch is the fake for method BackupResourceStorageConfigsNonCRRClient.Patch + // Patch is the fake for method BackupResourceStorageConfigsClient.Patch // HTTP status codes to indicate success: http.StatusNoContent - Patch func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.BackupResourceConfigResource, options *armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClientPatchOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClientPatchResponse], errResp azfake.ErrorResponder) + Patch func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.BackupResourceConfigResource, options *armrecoveryservicesbackup.BackupResourceStorageConfigsClientPatchOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceStorageConfigsClientPatchResponse], errResp azfake.ErrorResponder) - // Update is the fake for method BackupResourceStorageConfigsNonCRRClient.Update + // Update is the fake for method BackupResourceStorageConfigsClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.BackupResourceConfigResource, options *armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClientUpdateOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.BackupResourceConfigResource, options *armrecoveryservicesbackup.BackupResourceStorageConfigsClientUpdateOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceStorageConfigsClientUpdateResponse], errResp azfake.ErrorResponder) } -// NewBackupResourceStorageConfigsNonCRRServerTransport creates a new instance of BackupResourceStorageConfigsNonCRRServerTransport with the provided implementation. -// The returned BackupResourceStorageConfigsNonCRRServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClient via the +// NewBackupResourceStorageConfigsServerTransport creates a new instance of BackupResourceStorageConfigsServerTransport with the provided implementation. +// The returned BackupResourceStorageConfigsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupResourceStorageConfigsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupResourceStorageConfigsNonCRRServerTransport(srv *BackupResourceStorageConfigsNonCRRServer) *BackupResourceStorageConfigsNonCRRServerTransport { - return &BackupResourceStorageConfigsNonCRRServerTransport{srv: srv} +func NewBackupResourceStorageConfigsServerTransport(srv *BackupResourceStorageConfigsServer) *BackupResourceStorageConfigsServerTransport { + return &BackupResourceStorageConfigsServerTransport{srv: srv} } -// BackupResourceStorageConfigsNonCRRServerTransport connects instances of armrecoveryservicesbackup.BackupResourceStorageConfigsNonCRRClient to instances of BackupResourceStorageConfigsNonCRRServer. -// Don't use this type directly, use NewBackupResourceStorageConfigsNonCRRServerTransport instead. -type BackupResourceStorageConfigsNonCRRServerTransport struct { - srv *BackupResourceStorageConfigsNonCRRServer +// BackupResourceStorageConfigsServerTransport connects instances of armrecoveryservicesbackup.BackupResourceStorageConfigsClient to instances of BackupResourceStorageConfigsServer. +// Don't use this type directly, use NewBackupResourceStorageConfigsServerTransport instead. +type BackupResourceStorageConfigsServerTransport struct { + srv *BackupResourceStorageConfigsServer } -// Do implements the policy.Transporter interface for BackupResourceStorageConfigsNonCRRServerTransport. -func (b *BackupResourceStorageConfigsNonCRRServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for BackupResourceStorageConfigsServerTransport. +func (b *BackupResourceStorageConfigsServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -61,11 +61,11 @@ func (b *BackupResourceStorageConfigsNonCRRServerTransport) Do(req *http.Request var err error switch method { - case "BackupResourceStorageConfigsNonCRRClient.Get": + case "BackupResourceStorageConfigsClient.Get": resp, err = b.dispatchGet(req) - case "BackupResourceStorageConfigsNonCRRClient.Patch": + case "BackupResourceStorageConfigsClient.Patch": resp, err = b.dispatchPatch(req) - case "BackupResourceStorageConfigsNonCRRClient.Update": + case "BackupResourceStorageConfigsClient.Update": resp, err = b.dispatchUpdate(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -78,11 +78,11 @@ func (b *BackupResourceStorageConfigsNonCRRServerTransport) Do(req *http.Request return resp, nil } -func (b *BackupResourceStorageConfigsNonCRRServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (b *BackupResourceStorageConfigsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if b.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -111,11 +111,11 @@ func (b *BackupResourceStorageConfigsNonCRRServerTransport) dispatchGet(req *htt return resp, nil } -func (b *BackupResourceStorageConfigsNonCRRServerTransport) dispatchPatch(req *http.Request) (*http.Response, error) { +func (b *BackupResourceStorageConfigsServerTransport) dispatchPatch(req *http.Request) (*http.Response, error) { if b.srv.Patch == nil { return nil, &nonRetriableError{errors.New("fake for method Patch not implemented")} } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -148,11 +148,11 @@ func (b *BackupResourceStorageConfigsNonCRRServerTransport) dispatchPatch(req *h return resp, nil } -func (b *BackupResourceStorageConfigsNonCRRServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { +func (b *BackupResourceStorageConfigsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if b.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcevaultconfigs_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcevaultconfigs_server.go deleted file mode 100644 index 6e5426932dc6..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupresourcevaultconfigs_server.go +++ /dev/null @@ -1,200 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupResourceVaultConfigsServer is a fake server for instances of the armrecoveryservicesbackup.BackupResourceVaultConfigsClient type. -type BackupResourceVaultConfigsServer struct { - // Get is the fake for method BackupResourceVaultConfigsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupResourceVaultConfigsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceVaultConfigsClientGetResponse], errResp azfake.ErrorResponder) - - // Put is the fake for method BackupResourceVaultConfigsClient.Put - // HTTP status codes to indicate success: http.StatusOK - Put func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.BackupResourceVaultConfigResource, options *armrecoveryservicesbackup.BackupResourceVaultConfigsClientPutOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceVaultConfigsClientPutResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method BackupResourceVaultConfigsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.BackupResourceVaultConfigResource, options *armrecoveryservicesbackup.BackupResourceVaultConfigsClientUpdateOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupResourceVaultConfigsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewBackupResourceVaultConfigsServerTransport creates a new instance of BackupResourceVaultConfigsServerTransport with the provided implementation. -// The returned BackupResourceVaultConfigsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupResourceVaultConfigsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupResourceVaultConfigsServerTransport(srv *BackupResourceVaultConfigsServer) *BackupResourceVaultConfigsServerTransport { - return &BackupResourceVaultConfigsServerTransport{srv: srv} -} - -// BackupResourceVaultConfigsServerTransport connects instances of armrecoveryservicesbackup.BackupResourceVaultConfigsClient to instances of BackupResourceVaultConfigsServer. -// Don't use this type directly, use NewBackupResourceVaultConfigsServerTransport instead. -type BackupResourceVaultConfigsServerTransport struct { - srv *BackupResourceVaultConfigsServer -} - -// Do implements the policy.Transporter interface for BackupResourceVaultConfigsServerTransport. -func (b *BackupResourceVaultConfigsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupResourceVaultConfigsClient.Get": - resp, err = b.dispatchGet(req) - case "BackupResourceVaultConfigsClient.Put": - resp, err = b.dispatchPut(req) - case "BackupResourceVaultConfigsClient.Update": - resp, err = b.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupResourceVaultConfigsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupconfig/vaultconfig` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupResourceVaultConfigResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BackupResourceVaultConfigsServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { - if b.srv.Put == nil { - return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupconfig/vaultconfig` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.BackupResourceVaultConfigResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - xMSAuthorizationAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-authorization-auxiliary")) - var options *armrecoveryservicesbackup.BackupResourceVaultConfigsClientPutOptions - if xMSAuthorizationAuxiliaryParam != nil { - options = &armrecoveryservicesbackup.BackupResourceVaultConfigsClientPutOptions{ - XMSAuthorizationAuxiliary: xMSAuthorizationAuxiliaryParam, - } - } - respr, errRespr := b.srv.Put(req.Context(), vaultNameParam, resourceGroupNameParam, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupResourceVaultConfigResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BackupResourceVaultConfigsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if b.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupconfig/vaultconfig` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.BackupResourceVaultConfigResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - xMSAuthorizationAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-authorization-auxiliary")) - var options *armrecoveryservicesbackup.BackupResourceVaultConfigsClientUpdateOptions - if xMSAuthorizationAuxiliaryParam != nil { - options = &armrecoveryservicesbackup.BackupResourceVaultConfigsClientUpdateOptions{ - XMSAuthorizationAuxiliary: xMSAuthorizationAuxiliaryParam, - } - } - respr, errRespr := b.srv.Update(req.Context(), vaultNameParam, resourceGroupNameParam, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupResourceVaultConfigResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backups_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backups_server.go deleted file mode 100644 index 4fbf14a894e0..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backups_server.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupsServer is a fake server for instances of the armrecoveryservicesbackup.BackupsClient type. -type BackupsServer struct { - // Trigger is the fake for method BackupsClient.Trigger - // HTTP status codes to indicate success: http.StatusAccepted - Trigger func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters armrecoveryservicesbackup.BackupRequestResource, options *armrecoveryservicesbackup.BackupsClientTriggerOptions) (resp azfake.Responder[armrecoveryservicesbackup.BackupsClientTriggerResponse], errResp azfake.ErrorResponder) -} - -// NewBackupsServerTransport creates a new instance of BackupsServerTransport with the provided implementation. -// The returned BackupsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupsServerTransport(srv *BackupsServer) *BackupsServerTransport { - return &BackupsServerTransport{srv: srv} -} - -// BackupsServerTransport connects instances of armrecoveryservicesbackup.BackupsClient to instances of BackupsServer. -// Don't use this type directly, use NewBackupsServerTransport instead. -type BackupsServerTransport struct { - srv *BackupsServer -} - -// Do implements the policy.Transporter interface for BackupsServerTransport. -func (b *BackupsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupsClient.Trigger": - resp, err = b.dispatchTrigger(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupsServerTransport) dispatchTrigger(req *http.Request) (*http.Response, error) { - if b.srv.Trigger == nil { - return nil, &nonRetriableError{errors.New("fake for method Trigger not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backup` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.BackupRequestResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Trigger(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupusagesummaries_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupusagesummariescrr_server.go similarity index 63% rename from sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupusagesummaries_server.go rename to sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupusagesummariescrr_server.go index edfdae34db60..27b0791edf1b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupusagesummaries_server.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupusagesummariescrr_server.go @@ -14,38 +14,38 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" "net/http" "net/url" "regexp" ) -// BackupUsageSummariesServer is a fake server for instances of the armrecoveryservicesbackup.BackupUsageSummariesClient type. -type BackupUsageSummariesServer struct { - // NewListPager is the fake for method BackupUsageSummariesClient.NewListPager +// BackupUsageSummariesCRRServer is a fake server for instances of the armrecoveryservicesbackup.BackupUsageSummariesCRRClient type. +type BackupUsageSummariesCRRServer struct { + // NewListPager is the fake for method BackupUsageSummariesCRRClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupUsageSummariesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupUsageSummariesClientListResponse]) + NewListPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.BackupUsageSummariesCRRClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupUsageSummariesCRRClientListResponse]) } -// NewBackupUsageSummariesServerTransport creates a new instance of BackupUsageSummariesServerTransport with the provided implementation. -// The returned BackupUsageSummariesServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupUsageSummariesClient via the +// NewBackupUsageSummariesCRRServerTransport creates a new instance of BackupUsageSummariesCRRServerTransport with the provided implementation. +// The returned BackupUsageSummariesCRRServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupUsageSummariesCRRClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupUsageSummariesServerTransport(srv *BackupUsageSummariesServer) *BackupUsageSummariesServerTransport { - return &BackupUsageSummariesServerTransport{ +func NewBackupUsageSummariesCRRServerTransport(srv *BackupUsageSummariesCRRServer) *BackupUsageSummariesCRRServerTransport { + return &BackupUsageSummariesCRRServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupUsageSummariesClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupUsageSummariesCRRClientListResponse]](), } } -// BackupUsageSummariesServerTransport connects instances of armrecoveryservicesbackup.BackupUsageSummariesClient to instances of BackupUsageSummariesServer. -// Don't use this type directly, use NewBackupUsageSummariesServerTransport instead. -type BackupUsageSummariesServerTransport struct { - srv *BackupUsageSummariesServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupUsageSummariesClientListResponse]] +// BackupUsageSummariesCRRServerTransport connects instances of armrecoveryservicesbackup.BackupUsageSummariesCRRClient to instances of BackupUsageSummariesCRRServer. +// Don't use this type directly, use NewBackupUsageSummariesCRRServerTransport instead. +type BackupUsageSummariesCRRServerTransport struct { + srv *BackupUsageSummariesCRRServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupUsageSummariesCRRClientListResponse]] } -// Do implements the policy.Transporter interface for BackupUsageSummariesServerTransport. -func (b *BackupUsageSummariesServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for BackupUsageSummariesCRRServerTransport. +func (b *BackupUsageSummariesCRRServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -56,7 +56,7 @@ func (b *BackupUsageSummariesServerTransport) Do(req *http.Request) (*http.Respo var err error switch method { - case "BackupUsageSummariesClient.NewListPager": + case "BackupUsageSummariesCRRClient.NewListPager": resp, err = b.dispatchNewListPager(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -69,13 +69,13 @@ func (b *BackupUsageSummariesServerTransport) Do(req *http.Request) (*http.Respo return resp, nil } -func (b *BackupUsageSummariesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (b *BackupUsageSummariesCRRServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if b.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } newListPager := b.newListPager.get(req) if newListPager == nil { - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupUsageSummaries` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupUsageSummaries` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -100,9 +100,9 @@ func (b *BackupUsageSummariesServerTransport) dispatchNewListPager(req *http.Req return nil, err } skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupUsageSummariesClientListOptions + var options *armrecoveryservicesbackup.BackupUsageSummariesCRRClientListOptions if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupUsageSummariesClientListOptions{ + options = &armrecoveryservicesbackup.BackupUsageSummariesCRRClientListOptions{ Filter: filterParam, SkipToken: skipTokenParam, } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupworkloaditems_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupworkloaditems_server.go deleted file mode 100644 index faf181c1d1d1..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/backupworkloaditems_server.go +++ /dev/null @@ -1,138 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BackupWorkloadItemsServer is a fake server for instances of the armrecoveryservicesbackup.BackupWorkloadItemsClient type. -type BackupWorkloadItemsServer struct { - // NewListPager is the fake for method BackupWorkloadItemsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, fabricName string, containerName string, options *armrecoveryservicesbackup.BackupWorkloadItemsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.BackupWorkloadItemsClientListResponse]) -} - -// NewBackupWorkloadItemsServerTransport creates a new instance of BackupWorkloadItemsServerTransport with the provided implementation. -// The returned BackupWorkloadItemsServerTransport instance is connected to an instance of armrecoveryservicesbackup.BackupWorkloadItemsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBackupWorkloadItemsServerTransport(srv *BackupWorkloadItemsServer) *BackupWorkloadItemsServerTransport { - return &BackupWorkloadItemsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupWorkloadItemsClientListResponse]](), - } -} - -// BackupWorkloadItemsServerTransport connects instances of armrecoveryservicesbackup.BackupWorkloadItemsClient to instances of BackupWorkloadItemsServer. -// Don't use this type directly, use NewBackupWorkloadItemsServerTransport instead. -type BackupWorkloadItemsServerTransport struct { - srv *BackupWorkloadItemsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.BackupWorkloadItemsClientListResponse]] -} - -// Do implements the policy.Transporter interface for BackupWorkloadItemsServerTransport. -func (b *BackupWorkloadItemsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BackupWorkloadItemsClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BackupWorkloadItemsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/items` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - var options *armrecoveryservicesbackup.BackupWorkloadItemsClientListOptions - if filterParam != nil || skipTokenParam != nil { - options = &armrecoveryservicesbackup.BackupWorkloadItemsClientListOptions{ - Filter: filterParam, - SkipToken: skipTokenParam, - } - } - resp := b.srv.NewListPager(vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.BackupWorkloadItemsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/bmspreparedatamoveoperationresult_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/bmspreparedatamoveoperationresult_server.go deleted file mode 100644 index b2036d9a8469..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/bmspreparedatamoveoperationresult_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// BMSPrepareDataMoveOperationResultServer is a fake server for instances of the armrecoveryservicesbackup.BMSPrepareDataMoveOperationResultClient type. -type BMSPrepareDataMoveOperationResultServer struct { - // Get is the fake for method BMSPrepareDataMoveOperationResultClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - Get func(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *armrecoveryservicesbackup.BMSPrepareDataMoveOperationResultClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.BMSPrepareDataMoveOperationResultClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewBMSPrepareDataMoveOperationResultServerTransport creates a new instance of BMSPrepareDataMoveOperationResultServerTransport with the provided implementation. -// The returned BMSPrepareDataMoveOperationResultServerTransport instance is connected to an instance of armrecoveryservicesbackup.BMSPrepareDataMoveOperationResultClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBMSPrepareDataMoveOperationResultServerTransport(srv *BMSPrepareDataMoveOperationResultServer) *BMSPrepareDataMoveOperationResultServerTransport { - return &BMSPrepareDataMoveOperationResultServerTransport{srv: srv} -} - -// BMSPrepareDataMoveOperationResultServerTransport connects instances of armrecoveryservicesbackup.BMSPrepareDataMoveOperationResultClient to instances of BMSPrepareDataMoveOperationResultServer. -// Don't use this type directly, use NewBMSPrepareDataMoveOperationResultServerTransport instead. -type BMSPrepareDataMoveOperationResultServerTransport struct { - srv *BMSPrepareDataMoveOperationResultServer -} - -// Do implements the policy.Transporter interface for BMSPrepareDataMoveOperationResultServerTransport. -func (b *BMSPrepareDataMoveOperationResultServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BMSPrepareDataMoveOperationResultClient.Get": - resp, err = b.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BMSPrepareDataMoveOperationResultServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VaultStorageConfigOperationResultResponseClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crossregionrestore_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crossregionrestore_server.go new file mode 100644 index 000000000000..de0aca49de85 --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crossregionrestore_server.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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" + "net/http" + "net/url" + "regexp" +) + +// CrossRegionRestoreServer is a fake server for instances of the armrecoveryservicesbackup.CrossRegionRestoreClient type. +type CrossRegionRestoreServer struct { + // BeginTrigger is the fake for method CrossRegionRestoreClient.BeginTrigger + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginTrigger func(ctx context.Context, azureRegion string, parameters armrecoveryservicesbackup.CrossRegionRestoreRequest, options *armrecoveryservicesbackup.CrossRegionRestoreClientBeginTriggerOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.CrossRegionRestoreClientTriggerResponse], errResp azfake.ErrorResponder) +} + +// NewCrossRegionRestoreServerTransport creates a new instance of CrossRegionRestoreServerTransport with the provided implementation. +// The returned CrossRegionRestoreServerTransport instance is connected to an instance of armrecoveryservicesbackup.CrossRegionRestoreClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCrossRegionRestoreServerTransport(srv *CrossRegionRestoreServer) *CrossRegionRestoreServerTransport { + return &CrossRegionRestoreServerTransport{ + srv: srv, + beginTrigger: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.CrossRegionRestoreClientTriggerResponse]](), + } +} + +// CrossRegionRestoreServerTransport connects instances of armrecoveryservicesbackup.CrossRegionRestoreClient to instances of CrossRegionRestoreServer. +// Don't use this type directly, use NewCrossRegionRestoreServerTransport instead. +type CrossRegionRestoreServerTransport struct { + srv *CrossRegionRestoreServer + beginTrigger *tracker[azfake.PollerResponder[armrecoveryservicesbackup.CrossRegionRestoreClientTriggerResponse]] +} + +// Do implements the policy.Transporter interface for CrossRegionRestoreServerTransport. +func (c *CrossRegionRestoreServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CrossRegionRestoreClient.BeginTrigger": + resp, err = c.dispatchBeginTrigger(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CrossRegionRestoreServerTransport) dispatchBeginTrigger(req *http.Request) (*http.Response, error) { + if c.srv.BeginTrigger == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginTrigger not implemented")} + } + beginTrigger := c.beginTrigger.get(req) + if beginTrigger == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupCrossRegionRestore` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.CrossRegionRestoreRequest](req) + if err != nil { + return nil, err + } + azureRegionParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureRegion")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginTrigger(req.Context(), azureRegionParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginTrigger = &respr + c.beginTrigger.add(req, beginTrigger) + } + + resp, err := server.PollerResponderNext(beginTrigger, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginTrigger.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginTrigger) { + c.beginTrigger.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crroperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crroperationresults_server.go new file mode 100644 index 000000000000..eaddd17eef82 --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crroperationresults_server.go @@ -0,0 +1,100 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" + "net/http" + "net/url" + "regexp" +) + +// CrrOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.CrrOperationResultsClient type. +type CrrOperationResultsServer struct { + // Get is the fake for method CrrOperationResultsClient.Get + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + Get func(ctx context.Context, azureRegion string, operationID string, options *armrecoveryservicesbackup.CrrOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.CrrOperationResultsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewCrrOperationResultsServerTransport creates a new instance of CrrOperationResultsServerTransport with the provided implementation. +// The returned CrrOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.CrrOperationResultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCrrOperationResultsServerTransport(srv *CrrOperationResultsServer) *CrrOperationResultsServerTransport { + return &CrrOperationResultsServerTransport{srv: srv} +} + +// CrrOperationResultsServerTransport connects instances of armrecoveryservicesbackup.CrrOperationResultsClient to instances of CrrOperationResultsServer. +// Don't use this type directly, use NewCrrOperationResultsServerTransport instead. +type CrrOperationResultsServerTransport struct { + srv *CrrOperationResultsServer +} + +// Do implements the policy.Transporter interface for CrrOperationResultsServerTransport. +func (c *CrrOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CrrOperationResultsClient.Get": + resp, err = c.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CrrOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupCrrOperationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + azureRegionParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureRegion")]) + if err != nil { + return nil, err + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), azureRegionParam, operationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crroperationstatus_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crroperationstatus_server.go new file mode 100644 index 000000000000..3b3f13d7373b --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/crroperationstatus_server.go @@ -0,0 +1,100 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" + "net/http" + "net/url" + "regexp" +) + +// CrrOperationStatusServer is a fake server for instances of the armrecoveryservicesbackup.CrrOperationStatusClient type. +type CrrOperationStatusServer struct { + // Get is the fake for method CrrOperationStatusClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, azureRegion string, operationID string, options *armrecoveryservicesbackup.CrrOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.CrrOperationStatusClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewCrrOperationStatusServerTransport creates a new instance of CrrOperationStatusServerTransport with the provided implementation. +// The returned CrrOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesbackup.CrrOperationStatusClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCrrOperationStatusServerTransport(srv *CrrOperationStatusServer) *CrrOperationStatusServerTransport { + return &CrrOperationStatusServerTransport{srv: srv} +} + +// CrrOperationStatusServerTransport connects instances of armrecoveryservicesbackup.CrrOperationStatusClient to instances of CrrOperationStatusServer. +// Don't use this type directly, use NewCrrOperationStatusServerTransport instead. +type CrrOperationStatusServerTransport struct { + srv *CrrOperationStatusServer +} + +// Do implements the policy.Transporter interface for CrrOperationStatusServerTransport. +func (c *CrrOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CrrOperationStatusClient.Get": + resp, err = c.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CrrOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupCrrOperationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + azureRegionParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureRegion")]) + if err != nil { + return nil, err + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), azureRegionParam, operationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/deletedprotectioncontainers_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/deletedprotectioncontainers_server.go deleted file mode 100644 index 6e54c22d505f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/deletedprotectioncontainers_server.go +++ /dev/null @@ -1,124 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// DeletedProtectionContainersServer is a fake server for instances of the armrecoveryservicesbackup.DeletedProtectionContainersClient type. -type DeletedProtectionContainersServer struct { - // NewListPager is the fake for method DeletedProtectionContainersClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesbackup.DeletedProtectionContainersClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.DeletedProtectionContainersClientListResponse]) -} - -// NewDeletedProtectionContainersServerTransport creates a new instance of DeletedProtectionContainersServerTransport with the provided implementation. -// The returned DeletedProtectionContainersServerTransport instance is connected to an instance of armrecoveryservicesbackup.DeletedProtectionContainersClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDeletedProtectionContainersServerTransport(srv *DeletedProtectionContainersServer) *DeletedProtectionContainersServerTransport { - return &DeletedProtectionContainersServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.DeletedProtectionContainersClientListResponse]](), - } -} - -// DeletedProtectionContainersServerTransport connects instances of armrecoveryservicesbackup.DeletedProtectionContainersClient to instances of DeletedProtectionContainersServer. -// Don't use this type directly, use NewDeletedProtectionContainersServerTransport instead. -type DeletedProtectionContainersServerTransport struct { - srv *DeletedProtectionContainersServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.DeletedProtectionContainersClientListResponse]] -} - -// Do implements the policy.Transporter interface for DeletedProtectionContainersServerTransport. -func (d *DeletedProtectionContainersServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DeletedProtectionContainersClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DeletedProtectionContainersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := d.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupDeletedProtectionContainers` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.DeletedProtectionContainersClientListOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.DeletedProtectionContainersClientListOptions{ - Filter: filterParam, - } - } - resp := d.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) - newListPager = &resp - d.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.DeletedProtectionContainersClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/exportjobsoperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/exportjobsoperationresults_server.go deleted file mode 100644 index e2d348801974..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/exportjobsoperationresults_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ExportJobsOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.ExportJobsOperationResultsClient type. -type ExportJobsOperationResultsServer struct { - // Get is the fake for method ExportJobsOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - Get func(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *armrecoveryservicesbackup.ExportJobsOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ExportJobsOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewExportJobsOperationResultsServerTransport creates a new instance of ExportJobsOperationResultsServerTransport with the provided implementation. -// The returned ExportJobsOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ExportJobsOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewExportJobsOperationResultsServerTransport(srv *ExportJobsOperationResultsServer) *ExportJobsOperationResultsServerTransport { - return &ExportJobsOperationResultsServerTransport{srv: srv} -} - -// ExportJobsOperationResultsServerTransport connects instances of armrecoveryservicesbackup.ExportJobsOperationResultsClient to instances of ExportJobsOperationResultsServer. -// Don't use this type directly, use NewExportJobsOperationResultsServerTransport instead. -type ExportJobsOperationResultsServerTransport struct { - srv *ExportJobsOperationResultsServer -} - -// Do implements the policy.Transporter interface for ExportJobsOperationResultsServerTransport. -func (e *ExportJobsOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ExportJobsOperationResultsClient.Get": - resp, err = e.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *ExportJobsOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupJobs/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationResultInfoBaseResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/featuresupport_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/featuresupport_server.go deleted file mode 100644 index 65bd80ced37e..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/featuresupport_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// FeatureSupportServer is a fake server for instances of the armrecoveryservicesbackup.FeatureSupportClient type. -type FeatureSupportServer struct { - // Validate is the fake for method FeatureSupportClient.Validate - // HTTP status codes to indicate success: http.StatusOK - Validate func(ctx context.Context, azureRegion string, parameters armrecoveryservicesbackup.FeatureSupportRequestClassification, options *armrecoveryservicesbackup.FeatureSupportClientValidateOptions) (resp azfake.Responder[armrecoveryservicesbackup.FeatureSupportClientValidateResponse], errResp azfake.ErrorResponder) -} - -// NewFeatureSupportServerTransport creates a new instance of FeatureSupportServerTransport with the provided implementation. -// The returned FeatureSupportServerTransport instance is connected to an instance of armrecoveryservicesbackup.FeatureSupportClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewFeatureSupportServerTransport(srv *FeatureSupportServer) *FeatureSupportServerTransport { - return &FeatureSupportServerTransport{srv: srv} -} - -// FeatureSupportServerTransport connects instances of armrecoveryservicesbackup.FeatureSupportClient to instances of FeatureSupportServer. -// Don't use this type directly, use NewFeatureSupportServerTransport instead. -type FeatureSupportServerTransport struct { - srv *FeatureSupportServer -} - -// Do implements the policy.Transporter interface for FeatureSupportServerTransport. -func (f *FeatureSupportServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "FeatureSupportClient.Validate": - resp, err = f.dispatchValidate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (f *FeatureSupportServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { - if f.srv.Validate == nil { - return nil, &nonRetriableError{errors.New("fake for method Validate not implemented")} - } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupValidateFeatures` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - raw, err := readRequestBody(req) - if err != nil { - return nil, err - } - body, err := unmarshalFeatureSupportRequestClassification(raw) - if err != nil { - return nil, err - } - azureRegionParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureRegion")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.Validate(req.Context(), azureRegionParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureVMResourceFeatureSupportResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/fetchtieringcost_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/fetchtieringcost_server.go deleted file mode 100644 index 04a63cf03706..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/fetchtieringcost_server.go +++ /dev/null @@ -1,123 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// FetchTieringCostServer is a fake server for instances of the armrecoveryservicesbackup.FetchTieringCostClient type. -type FetchTieringCostServer struct { - // BeginPost is the fake for method FetchTieringCostClient.BeginPost - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginPost func(ctx context.Context, resourceGroupName string, vaultName string, parameters armrecoveryservicesbackup.FetchTieringCostInfoRequestClassification, options *armrecoveryservicesbackup.FetchTieringCostClientBeginPostOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.FetchTieringCostClientPostResponse], errResp azfake.ErrorResponder) -} - -// NewFetchTieringCostServerTransport creates a new instance of FetchTieringCostServerTransport with the provided implementation. -// The returned FetchTieringCostServerTransport instance is connected to an instance of armrecoveryservicesbackup.FetchTieringCostClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewFetchTieringCostServerTransport(srv *FetchTieringCostServer) *FetchTieringCostServerTransport { - return &FetchTieringCostServerTransport{ - srv: srv, - beginPost: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.FetchTieringCostClientPostResponse]](), - } -} - -// FetchTieringCostServerTransport connects instances of armrecoveryservicesbackup.FetchTieringCostClient to instances of FetchTieringCostServer. -// Don't use this type directly, use NewFetchTieringCostServerTransport instead. -type FetchTieringCostServerTransport struct { - srv *FetchTieringCostServer - beginPost *tracker[azfake.PollerResponder[armrecoveryservicesbackup.FetchTieringCostClientPostResponse]] -} - -// Do implements the policy.Transporter interface for FetchTieringCostServerTransport. -func (f *FetchTieringCostServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "FetchTieringCostClient.BeginPost": - resp, err = f.dispatchBeginPost(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (f *FetchTieringCostServerTransport) dispatchBeginPost(req *http.Request) (*http.Response, error) { - if f.srv.BeginPost == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginPost not implemented")} - } - beginPost := f.beginPost.get(req) - if beginPost == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupTieringCost/default/fetchTieringCost` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - raw, err := readRequestBody(req) - if err != nil { - return nil, err - } - body, err := unmarshalFetchTieringCostInfoRequestClassification(raw) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.BeginPost(req.Context(), resourceGroupNameParam, vaultNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginPost = &respr - f.beginPost.add(req, beginPost) - } - - resp, err := server.PollerResponderNext(beginPost, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - f.beginPost.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginPost) { - f.beginPost.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/gettieringcostoperationresult_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/gettieringcostoperationresult_server.go deleted file mode 100644 index aa7ed663ee53..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/gettieringcostoperationresult_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// GetTieringCostOperationResultServer is a fake server for instances of the armrecoveryservicesbackup.GetTieringCostOperationResultClient type. -type GetTieringCostOperationResultServer struct { - // Get is the fake for method GetTieringCostOperationResultClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *armrecoveryservicesbackup.GetTieringCostOperationResultClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.GetTieringCostOperationResultClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewGetTieringCostOperationResultServerTransport creates a new instance of GetTieringCostOperationResultServerTransport with the provided implementation. -// The returned GetTieringCostOperationResultServerTransport instance is connected to an instance of armrecoveryservicesbackup.GetTieringCostOperationResultClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGetTieringCostOperationResultServerTransport(srv *GetTieringCostOperationResultServer) *GetTieringCostOperationResultServerTransport { - return &GetTieringCostOperationResultServerTransport{srv: srv} -} - -// GetTieringCostOperationResultServerTransport connects instances of armrecoveryservicesbackup.GetTieringCostOperationResultClient to instances of GetTieringCostOperationResultServer. -// Don't use this type directly, use NewGetTieringCostOperationResultServerTransport instead. -type GetTieringCostOperationResultServerTransport struct { - srv *GetTieringCostOperationResultServer -} - -// Do implements the policy.Transporter interface for GetTieringCostOperationResultServerTransport. -func (g *GetTieringCostOperationResultServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "GetTieringCostOperationResultClient.Get": - resp, err = g.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GetTieringCostOperationResultServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupTieringCost/default/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TieringCostInfoClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/internal.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/internal.go index 6ff9fd3a57d2..94e060e89dbd 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/internal.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/internal.go @@ -10,7 +10,6 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "io" "net/http" "reflect" "sync" @@ -33,14 +32,6 @@ func contains[T comparable](s []T, v T) bool { return false } -func getHeaderValue(h http.Header, k string) string { - v := h[k] - if len(v) == 0 { - return "" - } - return v[0] -} - func getOptional[T any](v T) *T { if reflect.ValueOf(v).IsZero() { return nil @@ -48,18 +39,6 @@ func getOptional[T any](v T) *T { return &v } -func readRequestBody(req *http.Request) ([]byte, error) { - if req.Body == nil { - return nil, nil - } - body, err := io.ReadAll(req.Body) - if err != nil { - return nil, err - } - req.Body.Close() - return body, nil -} - func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/itemlevelrecoveryconnections_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/itemlevelrecoveryconnections_server.go deleted file mode 100644 index 248a4ad6775a..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/itemlevelrecoveryconnections_server.go +++ /dev/null @@ -1,175 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ItemLevelRecoveryConnectionsServer is a fake server for instances of the armrecoveryservicesbackup.ItemLevelRecoveryConnectionsClient type. -type ItemLevelRecoveryConnectionsServer struct { - // Provision is the fake for method ItemLevelRecoveryConnectionsClient.Provision - // HTTP status codes to indicate success: http.StatusAccepted - Provision func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters armrecoveryservicesbackup.ILRRequestResource, options *armrecoveryservicesbackup.ItemLevelRecoveryConnectionsClientProvisionOptions) (resp azfake.Responder[armrecoveryservicesbackup.ItemLevelRecoveryConnectionsClientProvisionResponse], errResp azfake.ErrorResponder) - - // Revoke is the fake for method ItemLevelRecoveryConnectionsClient.Revoke - // HTTP status codes to indicate success: http.StatusAccepted - Revoke func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *armrecoveryservicesbackup.ItemLevelRecoveryConnectionsClientRevokeOptions) (resp azfake.Responder[armrecoveryservicesbackup.ItemLevelRecoveryConnectionsClientRevokeResponse], errResp azfake.ErrorResponder) -} - -// NewItemLevelRecoveryConnectionsServerTransport creates a new instance of ItemLevelRecoveryConnectionsServerTransport with the provided implementation. -// The returned ItemLevelRecoveryConnectionsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ItemLevelRecoveryConnectionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewItemLevelRecoveryConnectionsServerTransport(srv *ItemLevelRecoveryConnectionsServer) *ItemLevelRecoveryConnectionsServerTransport { - return &ItemLevelRecoveryConnectionsServerTransport{srv: srv} -} - -// ItemLevelRecoveryConnectionsServerTransport connects instances of armrecoveryservicesbackup.ItemLevelRecoveryConnectionsClient to instances of ItemLevelRecoveryConnectionsServer. -// Don't use this type directly, use NewItemLevelRecoveryConnectionsServerTransport instead. -type ItemLevelRecoveryConnectionsServerTransport struct { - srv *ItemLevelRecoveryConnectionsServer -} - -// Do implements the policy.Transporter interface for ItemLevelRecoveryConnectionsServerTransport. -func (i *ItemLevelRecoveryConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ItemLevelRecoveryConnectionsClient.Provision": - resp, err = i.dispatchProvision(req) - case "ItemLevelRecoveryConnectionsClient.Revoke": - resp, err = i.dispatchRevoke(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *ItemLevelRecoveryConnectionsServerTransport) dispatchProvision(req *http.Request) (*http.Response, error) { - if i.srv.Provision == nil { - return nil, &nonRetriableError{errors.New("fake for method Provision not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/provisionInstantItemRecovery` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ILRRequestResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - recoveryPointIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPointId")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Provision(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, recoveryPointIDParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *ItemLevelRecoveryConnectionsServerTransport) dispatchRevoke(req *http.Request) (*http.Response, error) { - if i.srv.Revoke == nil { - return nil, &nonRetriableError{errors.New("fake for method Revoke not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revokeInstantItemRecovery` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - recoveryPointIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPointId")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Revoke(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, recoveryPointIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobcancellations_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobcancellations_server.go deleted file mode 100644 index c883b285a963..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobcancellations_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// JobCancellationsServer is a fake server for instances of the armrecoveryservicesbackup.JobCancellationsClient type. -type JobCancellationsServer struct { - // Trigger is the fake for method JobCancellationsClient.Trigger - // HTTP status codes to indicate success: http.StatusAccepted - Trigger func(ctx context.Context, vaultName string, resourceGroupName string, jobName string, options *armrecoveryservicesbackup.JobCancellationsClientTriggerOptions) (resp azfake.Responder[armrecoveryservicesbackup.JobCancellationsClientTriggerResponse], errResp azfake.ErrorResponder) -} - -// NewJobCancellationsServerTransport creates a new instance of JobCancellationsServerTransport with the provided implementation. -// The returned JobCancellationsServerTransport instance is connected to an instance of armrecoveryservicesbackup.JobCancellationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewJobCancellationsServerTransport(srv *JobCancellationsServer) *JobCancellationsServerTransport { - return &JobCancellationsServerTransport{srv: srv} -} - -// JobCancellationsServerTransport connects instances of armrecoveryservicesbackup.JobCancellationsClient to instances of JobCancellationsServer. -// Don't use this type directly, use NewJobCancellationsServerTransport instead. -type JobCancellationsServerTransport struct { - srv *JobCancellationsServer -} - -// Do implements the policy.Transporter interface for JobCancellationsServerTransport. -func (j *JobCancellationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "JobCancellationsClient.Trigger": - resp, err = j.dispatchTrigger(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (j *JobCancellationsServerTransport) dispatchTrigger(req *http.Request) (*http.Response, error) { - if j.srv.Trigger == nil { - return nil, &nonRetriableError{errors.New("fake for method Trigger not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) - if err != nil { - return nil, err - } - respr, errRespr := j.srv.Trigger(req.Context(), vaultNameParam, resourceGroupNameParam, jobNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobdetails_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobdetails_server.go deleted file mode 100644 index 59059dc43d15..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobdetails_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// JobDetailsServer is a fake server for instances of the armrecoveryservicesbackup.JobDetailsClient type. -type JobDetailsServer struct { - // Get is the fake for method JobDetailsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, jobName string, options *armrecoveryservicesbackup.JobDetailsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.JobDetailsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewJobDetailsServerTransport creates a new instance of JobDetailsServerTransport with the provided implementation. -// The returned JobDetailsServerTransport instance is connected to an instance of armrecoveryservicesbackup.JobDetailsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewJobDetailsServerTransport(srv *JobDetailsServer) *JobDetailsServerTransport { - return &JobDetailsServerTransport{srv: srv} -} - -// JobDetailsServerTransport connects instances of armrecoveryservicesbackup.JobDetailsClient to instances of JobDetailsServer. -// Don't use this type directly, use NewJobDetailsServerTransport instead. -type JobDetailsServerTransport struct { - srv *JobDetailsServer -} - -// Do implements the policy.Transporter interface for JobDetailsServerTransport. -func (j *JobDetailsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "JobDetailsClient.Get": - resp, err = j.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (j *JobDetailsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if j.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) - if err != nil { - return nil, err - } - respr, errRespr := j.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, jobNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JobResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/joboperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/joboperationresults_server.go deleted file mode 100644 index b1288348d7cf..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/joboperationresults_server.go +++ /dev/null @@ -1,108 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// JobOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.JobOperationResultsClient type. -type JobOperationResultsServer struct { - // Get is the fake for method JobOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - Get func(ctx context.Context, vaultName string, resourceGroupName string, jobName string, operationID string, options *armrecoveryservicesbackup.JobOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.JobOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewJobOperationResultsServerTransport creates a new instance of JobOperationResultsServerTransport with the provided implementation. -// The returned JobOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.JobOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewJobOperationResultsServerTransport(srv *JobOperationResultsServer) *JobOperationResultsServerTransport { - return &JobOperationResultsServerTransport{srv: srv} -} - -// JobOperationResultsServerTransport connects instances of armrecoveryservicesbackup.JobOperationResultsClient to instances of JobOperationResultsServer. -// Don't use this type directly, use NewJobOperationResultsServerTransport instead. -type JobOperationResultsServerTransport struct { - srv *JobOperationResultsServer -} - -// Do implements the policy.Transporter interface for JobOperationResultsServerTransport. -func (j *JobOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "JobOperationResultsClient.Get": - resp, err = j.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (j *JobOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if j.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := j.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, jobNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobs_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobs_server.go deleted file mode 100644 index 7133ec372863..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/jobs_server.go +++ /dev/null @@ -1,112 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// JobsServer is a fake server for instances of the armrecoveryservicesbackup.JobsClient type. -type JobsServer struct { - // Export is the fake for method JobsClient.Export - // HTTP status codes to indicate success: http.StatusAccepted - Export func(ctx context.Context, vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.JobsClientExportOptions) (resp azfake.Responder[armrecoveryservicesbackup.JobsClientExportResponse], errResp azfake.ErrorResponder) -} - -// NewJobsServerTransport creates a new instance of JobsServerTransport with the provided implementation. -// The returned JobsServerTransport instance is connected to an instance of armrecoveryservicesbackup.JobsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewJobsServerTransport(srv *JobsServer) *JobsServerTransport { - return &JobsServerTransport{srv: srv} -} - -// JobsServerTransport connects instances of armrecoveryservicesbackup.JobsClient to instances of JobsServer. -// Don't use this type directly, use NewJobsServerTransport instead. -type JobsServerTransport struct { - srv *JobsServer -} - -// Do implements the policy.Transporter interface for JobsServerTransport. -func (j *JobsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "JobsClient.Export": - resp, err = j.dispatchExport(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (j *JobsServerTransport) dispatchExport(req *http.Request) (*http.Response, error) { - if j.srv.Export == nil { - return nil, &nonRetriableError{errors.New("fake for method Export not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupJobsExport` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.JobsClientExportOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.JobsClientExportOptions{ - Filter: filterParam, - } - } - respr, errRespr := j.srv.Export(req.Context(), vaultNameParam, resourceGroupNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/operation_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/operation_server.go deleted file mode 100644 index 84650f908870..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/operation_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// OperationServer is a fake server for instances of the armrecoveryservicesbackup.OperationClient type. -type OperationServer struct { - // Validate is the fake for method OperationClient.Validate - // HTTP status codes to indicate success: http.StatusOK - Validate func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.ValidateOperationRequestResource, options *armrecoveryservicesbackup.OperationClientValidateOptions) (resp azfake.Responder[armrecoveryservicesbackup.OperationClientValidateResponse], errResp azfake.ErrorResponder) -} - -// NewOperationServerTransport creates a new instance of OperationServerTransport with the provided implementation. -// The returned OperationServerTransport instance is connected to an instance of armrecoveryservicesbackup.OperationClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationServerTransport(srv *OperationServer) *OperationServerTransport { - return &OperationServerTransport{srv: srv} -} - -// OperationServerTransport connects instances of armrecoveryservicesbackup.OperationClient to instances of OperationServer. -// Don't use this type directly, use NewOperationServerTransport instead. -type OperationServerTransport struct { - srv *OperationServer -} - -// Do implements the policy.Transporter interface for OperationServerTransport. -func (o *OperationServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationClient.Validate": - resp, err = o.dispatchValidate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { - if o.srv.Validate == nil { - return nil, &nonRetriableError{errors.New("fake for method Validate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupValidateOperation` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ValidateOperationRequestResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.Validate(req.Context(), vaultNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ValidateOperationsResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/operations_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/operations_server.go deleted file mode 100644 index bfa500bdf62a..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/operations_server.go +++ /dev/null @@ -1,96 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" -) - -// OperationsServer is a fake server for instances of the armrecoveryservicesbackup.OperationsClient type. -type OperationsServer struct { - // NewListPager is the fake for method OperationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armrecoveryservicesbackup.OperationsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.OperationsClientListResponse]) -} - -// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armrecoveryservicesbackup.OperationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { - return &OperationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.OperationsClientListResponse]](), - } -} - -// OperationsServerTransport connects instances of armrecoveryservicesbackup.OperationsClient to instances of OperationsServer. -// Don't use this type directly, use NewOperationsServerTransport instead. -type OperationsServerTransport struct { - srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.OperationsClientListResponse]] -} - -// Do implements the policy.Transporter interface for OperationsServerTransport. -func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := o.newListPager.get(req) - if newListPager == nil { - resp := o.srv.NewListPager(nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.OperationsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/polymorphic_helpers.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/polymorphic_helpers.go deleted file mode 100644 index 38f64374a383..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/polymorphic_helpers.go +++ /dev/null @@ -1,64 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -func unmarshalFeatureSupportRequestClassification(rawMsg json.RawMessage) (armrecoveryservicesbackup.FeatureSupportRequestClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armrecoveryservicesbackup.FeatureSupportRequestClassification - switch m["featureType"] { - case "AzureBackupGoals": - b = &armrecoveryservicesbackup.AzureBackupGoalFeatureSupportRequest{} - case "AzureVMResourceBackup": - b = &armrecoveryservicesbackup.AzureVMResourceFeatureSupportRequest{} - default: - b = &armrecoveryservicesbackup.FeatureSupportRequest{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalFetchTieringCostInfoRequestClassification(rawMsg json.RawMessage) (armrecoveryservicesbackup.FetchTieringCostInfoRequestClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armrecoveryservicesbackup.FetchTieringCostInfoRequestClassification - switch m["objectType"] { - case "FetchTieringCostInfoForRehydrationRequest": - b = &armrecoveryservicesbackup.FetchTieringCostInfoForRehydrationRequest{} - case "FetchTieringCostSavingsInfoForPolicyRequest": - b = &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForPolicyRequest{} - case "FetchTieringCostSavingsInfoForProtectedItemRequest": - b = &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForProtectedItemRequest{} - case "FetchTieringCostSavingsInfoForVaultRequest": - b = &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForVaultRequest{} - default: - b = &armrecoveryservicesbackup.FetchTieringCostInfoRequest{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/privateendpoint_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/privateendpoint_server.go deleted file mode 100644 index dfe61bce3b1a..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/privateendpoint_server.go +++ /dev/null @@ -1,108 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// PrivateEndpointServer is a fake server for instances of the armrecoveryservicesbackup.PrivateEndpointClient type. -type PrivateEndpointServer struct { - // GetOperationStatus is the fake for method PrivateEndpointClient.GetOperationStatus - // HTTP status codes to indicate success: http.StatusOK - GetOperationStatus func(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, operationID string, options *armrecoveryservicesbackup.PrivateEndpointClientGetOperationStatusOptions) (resp azfake.Responder[armrecoveryservicesbackup.PrivateEndpointClientGetOperationStatusResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateEndpointServerTransport creates a new instance of PrivateEndpointServerTransport with the provided implementation. -// The returned PrivateEndpointServerTransport instance is connected to an instance of armrecoveryservicesbackup.PrivateEndpointClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointServerTransport(srv *PrivateEndpointServer) *PrivateEndpointServerTransport { - return &PrivateEndpointServerTransport{srv: srv} -} - -// PrivateEndpointServerTransport connects instances of armrecoveryservicesbackup.PrivateEndpointClient to instances of PrivateEndpointServer. -// Don't use this type directly, use NewPrivateEndpointServerTransport instead. -type PrivateEndpointServerTransport struct { - srv *PrivateEndpointServer -} - -// Do implements the policy.Transporter interface for PrivateEndpointServerTransport. -func (p *PrivateEndpointServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointClient.GetOperationStatus": - resp, err = p.dispatchGetOperationStatus(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointServerTransport) dispatchGetOperationStatus(req *http.Request) (*http.Response, error) { - if p.srv.GetOperationStatus == nil { - return nil, &nonRetriableError{errors.New("fake for method GetOperationStatus not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.GetOperationStatus(req.Context(), vaultNameParam, resourceGroupNameParam, privateEndpointConnectionNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/privateendpointconnection_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/privateendpointconnection_server.go deleted file mode 100644 index 5355d12c99db..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/privateendpointconnection_server.go +++ /dev/null @@ -1,222 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// PrivateEndpointConnectionServer is a fake server for instances of the armrecoveryservicesbackup.PrivateEndpointConnectionClient type. -type PrivateEndpointConnectionServer struct { - // BeginDelete is the fake for method PrivateEndpointConnectionClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, options *armrecoveryservicesbackup.PrivateEndpointConnectionClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.PrivateEndpointConnectionClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateEndpointConnectionClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, options *armrecoveryservicesbackup.PrivateEndpointConnectionClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.PrivateEndpointConnectionClientGetResponse], errResp azfake.ErrorResponder) - - // BeginPut is the fake for method PrivateEndpointConnectionClient.BeginPut - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginPut func(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, parameters armrecoveryservicesbackup.PrivateEndpointConnectionResource, options *armrecoveryservicesbackup.PrivateEndpointConnectionClientBeginPutOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.PrivateEndpointConnectionClientPutResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateEndpointConnectionServerTransport creates a new instance of PrivateEndpointConnectionServerTransport with the provided implementation. -// The returned PrivateEndpointConnectionServerTransport instance is connected to an instance of armrecoveryservicesbackup.PrivateEndpointConnectionClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointConnectionServerTransport(srv *PrivateEndpointConnectionServer) *PrivateEndpointConnectionServerTransport { - return &PrivateEndpointConnectionServerTransport{ - srv: srv, - beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.PrivateEndpointConnectionClientDeleteResponse]](), - beginPut: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.PrivateEndpointConnectionClientPutResponse]](), - } -} - -// PrivateEndpointConnectionServerTransport connects instances of armrecoveryservicesbackup.PrivateEndpointConnectionClient to instances of PrivateEndpointConnectionServer. -// Don't use this type directly, use NewPrivateEndpointConnectionServerTransport instead. -type PrivateEndpointConnectionServerTransport struct { - srv *PrivateEndpointConnectionServer - beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesbackup.PrivateEndpointConnectionClientDeleteResponse]] - beginPut *tracker[azfake.PollerResponder[armrecoveryservicesbackup.PrivateEndpointConnectionClientPutResponse]] -} - -// Do implements the policy.Transporter interface for PrivateEndpointConnectionServerTransport. -func (p *PrivateEndpointConnectionServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointConnectionClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionClient.BeginPut": - resp, err = p.dispatchBeginPut(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), vaultNameParam, resourceGroupNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateEndpointConnectionServerTransport) dispatchBeginPut(req *http.Request) (*http.Response, error) { - if p.srv.BeginPut == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginPut not implemented")} - } - beginPut := p.beginPut.get(req) - if beginPut == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.PrivateEndpointConnectionResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginPut(req.Context(), vaultNameParam, resourceGroupNameParam, privateEndpointConnectionNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginPut = &respr - p.beginPut.add(req, beginPut) - } - - resp, err := server.PollerResponderNext(beginPut, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - p.beginPut.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginPut) { - p.beginPut.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectablecontainers_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectablecontainers_server.go deleted file mode 100644 index efe9036a2285..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectablecontainers_server.go +++ /dev/null @@ -1,128 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectableContainersServer is a fake server for instances of the armrecoveryservicesbackup.ProtectableContainersClient type. -type ProtectableContainersServer struct { - // NewListPager is the fake for method ProtectableContainersClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, fabricName string, options *armrecoveryservicesbackup.ProtectableContainersClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.ProtectableContainersClientListResponse]) -} - -// NewProtectableContainersServerTransport creates a new instance of ProtectableContainersServerTransport with the provided implementation. -// The returned ProtectableContainersServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectableContainersClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectableContainersServerTransport(srv *ProtectableContainersServer) *ProtectableContainersServerTransport { - return &ProtectableContainersServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.ProtectableContainersClientListResponse]](), - } -} - -// ProtectableContainersServerTransport connects instances of armrecoveryservicesbackup.ProtectableContainersClient to instances of ProtectableContainersServer. -// Don't use this type directly, use NewProtectableContainersServerTransport instead. -type ProtectableContainersServerTransport struct { - srv *ProtectableContainersServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.ProtectableContainersClientListResponse]] -} - -// Do implements the policy.Transporter interface for ProtectableContainersServerTransport. -func (p *ProtectableContainersServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectableContainersClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectableContainersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectableContainers` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.ProtectableContainersClientListOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.ProtectableContainersClientListOptions{ - Filter: filterParam, - } - } - resp := p.srv.NewListPager(vaultNameParam, resourceGroupNameParam, fabricNameParam, options) - newListPager = &resp - p.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.ProtectableContainersClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditemoperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditemoperationresults_server.go deleted file mode 100644 index 285943295b57..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditemoperationresults_server.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectedItemOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.ProtectedItemOperationResultsClient type. -type ProtectedItemOperationResultsServer struct { - // Get is the fake for method ProtectedItemOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string, options *armrecoveryservicesbackup.ProtectedItemOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectedItemOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectedItemOperationResultsServerTransport creates a new instance of ProtectedItemOperationResultsServerTransport with the provided implementation. -// The returned ProtectedItemOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectedItemOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectedItemOperationResultsServerTransport(srv *ProtectedItemOperationResultsServer) *ProtectedItemOperationResultsServerTransport { - return &ProtectedItemOperationResultsServerTransport{srv: srv} -} - -// ProtectedItemOperationResultsServerTransport connects instances of armrecoveryservicesbackup.ProtectedItemOperationResultsClient to instances of ProtectedItemOperationResultsServer. -// Don't use this type directly, use NewProtectedItemOperationResultsServerTransport instead. -type ProtectedItemOperationResultsServerTransport struct { - srv *ProtectedItemOperationResultsServer -} - -// Do implements the policy.Transporter interface for ProtectedItemOperationResultsServerTransport. -func (p *ProtectedItemOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectedItemOperationResultsClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectedItemOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectedItemResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditemoperationstatuses_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditemoperationstatuses_server.go deleted file mode 100644 index dea084309496..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditemoperationstatuses_server.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectedItemOperationStatusesServer is a fake server for instances of the armrecoveryservicesbackup.ProtectedItemOperationStatusesClient type. -type ProtectedItemOperationStatusesServer struct { - // Get is the fake for method ProtectedItemOperationStatusesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string, options *armrecoveryservicesbackup.ProtectedItemOperationStatusesClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectedItemOperationStatusesClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectedItemOperationStatusesServerTransport creates a new instance of ProtectedItemOperationStatusesServerTransport with the provided implementation. -// The returned ProtectedItemOperationStatusesServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectedItemOperationStatusesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectedItemOperationStatusesServerTransport(srv *ProtectedItemOperationStatusesServer) *ProtectedItemOperationStatusesServerTransport { - return &ProtectedItemOperationStatusesServerTransport{srv: srv} -} - -// ProtectedItemOperationStatusesServerTransport connects instances of armrecoveryservicesbackup.ProtectedItemOperationStatusesClient to instances of ProtectedItemOperationStatusesServer. -// Don't use this type directly, use NewProtectedItemOperationStatusesServerTransport instead. -type ProtectedItemOperationStatusesServerTransport struct { - srv *ProtectedItemOperationStatusesServer -} - -// Do implements the policy.Transporter interface for ProtectedItemOperationStatusesServerTransport. -func (p *ProtectedItemOperationStatusesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectedItemOperationStatusesClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectedItemOperationStatusesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditems_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditems_server.go deleted file mode 100644 index 2d7761c6ab46..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protecteditems_server.go +++ /dev/null @@ -1,237 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectedItemsServer is a fake server for instances of the armrecoveryservicesbackup.ProtectedItemsClient type. -type ProtectedItemsServer struct { - // CreateOrUpdate is the fake for method ProtectedItemsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - CreateOrUpdate func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters armrecoveryservicesbackup.ProtectedItemResource, options *armrecoveryservicesbackup.ProtectedItemsClientCreateOrUpdateOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectedItemsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ProtectedItemsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - Delete func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *armrecoveryservicesbackup.ProtectedItemsClientDeleteOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectedItemsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ProtectedItemsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *armrecoveryservicesbackup.ProtectedItemsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectedItemsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectedItemsServerTransport creates a new instance of ProtectedItemsServerTransport with the provided implementation. -// The returned ProtectedItemsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectedItemsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectedItemsServerTransport(srv *ProtectedItemsServer) *ProtectedItemsServerTransport { - return &ProtectedItemsServerTransport{srv: srv} -} - -// ProtectedItemsServerTransport connects instances of armrecoveryservicesbackup.ProtectedItemsClient to instances of ProtectedItemsServer. -// Don't use this type directly, use NewProtectedItemsServerTransport instead. -type ProtectedItemsServerTransport struct { - srv *ProtectedItemsServer -} - -// Do implements the policy.Transporter interface for ProtectedItemsServerTransport. -func (p *ProtectedItemsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectedItemsClient.CreateOrUpdate": - resp, err = p.dispatchCreateOrUpdate(req) - case "ProtectedItemsClient.Delete": - resp, err = p.dispatchDelete(req) - case "ProtectedItemsClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectedItemsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ProtectedItemResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - xMSAuthorizationAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-authorization-auxiliary")) - var options *armrecoveryservicesbackup.ProtectedItemsClientCreateOrUpdateOptions - if xMSAuthorizationAuxiliaryParam != nil { - options = &armrecoveryservicesbackup.ProtectedItemsClientCreateOrUpdateOptions{ - XMSAuthorizationAuxiliary: xMSAuthorizationAuxiliaryParam, - } - } - respr, errRespr := p.srv.CreateOrUpdate(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectedItemResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectedItemsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectedItemsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.ProtectedItemsClientGetOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.ProtectedItemsClientGetOptions{ - Filter: filterParam, - } - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectedItemResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontaineroperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontaineroperationresults_server.go deleted file mode 100644 index 5626bf742477..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontaineroperationresults_server.go +++ /dev/null @@ -1,112 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectionContainerOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.ProtectionContainerOperationResultsClient type. -type ProtectionContainerOperationResultsServer struct { - // Get is the fake for method ProtectionContainerOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, operationID string, options *armrecoveryservicesbackup.ProtectionContainerOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionContainerOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectionContainerOperationResultsServerTransport creates a new instance of ProtectionContainerOperationResultsServerTransport with the provided implementation. -// The returned ProtectionContainerOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectionContainerOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectionContainerOperationResultsServerTransport(srv *ProtectionContainerOperationResultsServer) *ProtectionContainerOperationResultsServerTransport { - return &ProtectionContainerOperationResultsServerTransport{srv: srv} -} - -// ProtectionContainerOperationResultsServerTransport connects instances of armrecoveryservicesbackup.ProtectionContainerOperationResultsClient to instances of ProtectionContainerOperationResultsServer. -// Don't use this type directly, use NewProtectionContainerOperationResultsServerTransport instead. -type ProtectionContainerOperationResultsServerTransport struct { - srv *ProtectionContainerOperationResultsServer -} - -// Do implements the policy.Transporter interface for ProtectionContainerOperationResultsServerTransport. -func (p *ProtectionContainerOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectionContainerOperationResultsClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectionContainerOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectionContainerResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontainerrefreshoperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontainerrefreshoperationresults_server.go deleted file mode 100644 index 75796959ad55..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontainerrefreshoperationresults_server.go +++ /dev/null @@ -1,108 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectionContainerRefreshOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient type. -type ProtectionContainerRefreshOperationResultsServer struct { - // Get is the fake for method ProtectionContainerRefreshOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, operationID string, options *armrecoveryservicesbackup.ProtectionContainerRefreshOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionContainerRefreshOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectionContainerRefreshOperationResultsServerTransport creates a new instance of ProtectionContainerRefreshOperationResultsServerTransport with the provided implementation. -// The returned ProtectionContainerRefreshOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectionContainerRefreshOperationResultsServerTransport(srv *ProtectionContainerRefreshOperationResultsServer) *ProtectionContainerRefreshOperationResultsServerTransport { - return &ProtectionContainerRefreshOperationResultsServerTransport{srv: srv} -} - -// ProtectionContainerRefreshOperationResultsServerTransport connects instances of armrecoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient to instances of ProtectionContainerRefreshOperationResultsServer. -// Don't use this type directly, use NewProtectionContainerRefreshOperationResultsServerTransport instead. -type ProtectionContainerRefreshOperationResultsServerTransport struct { - srv *ProtectionContainerRefreshOperationResultsServer -} - -// Do implements the policy.Transporter interface for ProtectionContainerRefreshOperationResultsServerTransport. -func (p *ProtectionContainerRefreshOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectionContainerRefreshOperationResultsClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectionContainerRefreshOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontainers_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontainers_server.go deleted file mode 100644 index 31ddf9241467..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectioncontainers_server.go +++ /dev/null @@ -1,335 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectionContainersServer is a fake server for instances of the armrecoveryservicesbackup.ProtectionContainersClient type. -type ProtectionContainersServer struct { - // Get is the fake for method ProtectionContainersClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *armrecoveryservicesbackup.ProtectionContainersClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionContainersClientGetResponse], errResp azfake.ErrorResponder) - - // Inquire is the fake for method ProtectionContainersClient.Inquire - // HTTP status codes to indicate success: http.StatusAccepted - Inquire func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *armrecoveryservicesbackup.ProtectionContainersClientInquireOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionContainersClientInquireResponse], errResp azfake.ErrorResponder) - - // Refresh is the fake for method ProtectionContainersClient.Refresh - // HTTP status codes to indicate success: http.StatusAccepted - Refresh func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, options *armrecoveryservicesbackup.ProtectionContainersClientRefreshOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionContainersClientRefreshResponse], errResp azfake.ErrorResponder) - - // BeginRegister is the fake for method ProtectionContainersClient.BeginRegister - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginRegister func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, parameters armrecoveryservicesbackup.ProtectionContainerResource, options *armrecoveryservicesbackup.ProtectionContainersClientBeginRegisterOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.ProtectionContainersClientRegisterResponse], errResp azfake.ErrorResponder) - - // Unregister is the fake for method ProtectionContainersClient.Unregister - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - Unregister func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *armrecoveryservicesbackup.ProtectionContainersClientUnregisterOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionContainersClientUnregisterResponse], errResp azfake.ErrorResponder) -} - -// NewProtectionContainersServerTransport creates a new instance of ProtectionContainersServerTransport with the provided implementation. -// The returned ProtectionContainersServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectionContainersClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectionContainersServerTransport(srv *ProtectionContainersServer) *ProtectionContainersServerTransport { - return &ProtectionContainersServerTransport{ - srv: srv, - beginRegister: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.ProtectionContainersClientRegisterResponse]](), - } -} - -// ProtectionContainersServerTransport connects instances of armrecoveryservicesbackup.ProtectionContainersClient to instances of ProtectionContainersServer. -// Don't use this type directly, use NewProtectionContainersServerTransport instead. -type ProtectionContainersServerTransport struct { - srv *ProtectionContainersServer - beginRegister *tracker[azfake.PollerResponder[armrecoveryservicesbackup.ProtectionContainersClientRegisterResponse]] -} - -// Do implements the policy.Transporter interface for ProtectionContainersServerTransport. -func (p *ProtectionContainersServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectionContainersClient.Get": - resp, err = p.dispatchGet(req) - case "ProtectionContainersClient.Inquire": - resp, err = p.dispatchInquire(req) - case "ProtectionContainersClient.Refresh": - resp, err = p.dispatchRefresh(req) - case "ProtectionContainersClient.BeginRegister": - resp, err = p.dispatchBeginRegister(req) - case "ProtectionContainersClient.Unregister": - resp, err = p.dispatchUnregister(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectionContainersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectionContainerResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectionContainersServerTransport) dispatchInquire(req *http.Request) (*http.Response, error) { - if p.srv.Inquire == nil { - return nil, &nonRetriableError{errors.New("fake for method Inquire not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inquire` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.ProtectionContainersClientInquireOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.ProtectionContainersClientInquireOptions{ - Filter: filterParam, - } - } - respr, errRespr := p.srv.Inquire(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectionContainersServerTransport) dispatchRefresh(req *http.Request) (*http.Response, error) { - if p.srv.Refresh == nil { - return nil, &nonRetriableError{errors.New("fake for method Refresh not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/refreshContainers` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.ProtectionContainersClientRefreshOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.ProtectionContainersClientRefreshOptions{ - Filter: filterParam, - } - } - respr, errRespr := p.srv.Refresh(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectionContainersServerTransport) dispatchBeginRegister(req *http.Request) (*http.Response, error) { - if p.srv.BeginRegister == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginRegister not implemented")} - } - beginRegister := p.beginRegister.get(req) - if beginRegister == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ProtectionContainerResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginRegister(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginRegister = &respr - p.beginRegister.add(req, beginRegister) - } - - resp, err := server.PollerResponderNext(beginRegister, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - p.beginRegister.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginRegister) { - p.beginRegister.remove(req) - } - - return resp, nil -} - -func (p *ProtectionContainersServerTransport) dispatchUnregister(req *http.Request) (*http.Response, error) { - if p.srv.Unregister == nil { - return nil, &nonRetriableError{errors.New("fake for method Unregister not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Unregister(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionintent_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionintent_server.go deleted file mode 100644 index f3f3498bc5e2..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionintent_server.go +++ /dev/null @@ -1,245 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectionIntentServer is a fake server for instances of the armrecoveryservicesbackup.ProtectionIntentClient type. -type ProtectionIntentServer struct { - // CreateOrUpdate is the fake for method ProtectionIntentClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, parameters armrecoveryservicesbackup.ProtectionIntentResource, options *armrecoveryservicesbackup.ProtectionIntentClientCreateOrUpdateOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionIntentClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ProtectionIntentClient.Delete - // HTTP status codes to indicate success: http.StatusNoContent - Delete func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, options *armrecoveryservicesbackup.ProtectionIntentClientDeleteOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionIntentClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ProtectionIntentClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, options *armrecoveryservicesbackup.ProtectionIntentClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionIntentClientGetResponse], errResp azfake.ErrorResponder) - - // Validate is the fake for method ProtectionIntentClient.Validate - // HTTP status codes to indicate success: http.StatusOK - Validate func(ctx context.Context, azureRegion string, parameters armrecoveryservicesbackup.PreValidateEnableBackupRequest, options *armrecoveryservicesbackup.ProtectionIntentClientValidateOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionIntentClientValidateResponse], errResp azfake.ErrorResponder) -} - -// NewProtectionIntentServerTransport creates a new instance of ProtectionIntentServerTransport with the provided implementation. -// The returned ProtectionIntentServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectionIntentClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectionIntentServerTransport(srv *ProtectionIntentServer) *ProtectionIntentServerTransport { - return &ProtectionIntentServerTransport{srv: srv} -} - -// ProtectionIntentServerTransport connects instances of armrecoveryservicesbackup.ProtectionIntentClient to instances of ProtectionIntentServer. -// Don't use this type directly, use NewProtectionIntentServerTransport instead. -type ProtectionIntentServerTransport struct { - srv *ProtectionIntentServer -} - -// Do implements the policy.Transporter interface for ProtectionIntentServerTransport. -func (p *ProtectionIntentServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectionIntentClient.CreateOrUpdate": - resp, err = p.dispatchCreateOrUpdate(req) - case "ProtectionIntentClient.Delete": - resp, err = p.dispatchDelete(req) - case "ProtectionIntentClient.Get": - resp, err = p.dispatchGet(req) - case "ProtectionIntentClient.Validate": - resp, err = p.dispatchValidate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectionIntentServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectionIntent/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ProtectionIntentResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - intentObjectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("intentObjectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.CreateOrUpdate(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, intentObjectNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectionIntentResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectionIntentServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectionIntent/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - intentObjectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("intentObjectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, intentObjectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectionIntentServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupProtectionIntent/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - intentObjectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("intentObjectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, intentObjectNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectionIntentResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectionIntentServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { - if p.srv.Validate == nil { - return nil, &nonRetriableError{errors.New("fake for method Validate not implemented")} - } - const regexStr = `/Subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupPreValidateProtection` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.PreValidateEnableBackupRequest](req) - if err != nil { - return nil, err - } - azureRegionParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureRegion")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Validate(req.Context(), azureRegionParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PreValidateEnableBackupResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicies_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicies_server.go deleted file mode 100644 index 08c77b243cf0..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicies_server.go +++ /dev/null @@ -1,216 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectionPoliciesServer is a fake server for instances of the armrecoveryservicesbackup.ProtectionPoliciesClient type. -type ProtectionPoliciesServer struct { - // CreateOrUpdate is the fake for method ProtectionPoliciesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - CreateOrUpdate func(ctx context.Context, vaultName string, resourceGroupName string, policyName string, parameters armrecoveryservicesbackup.ProtectionPolicyResource, options *armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ProtectionPoliciesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - BeginDelete func(ctx context.Context, vaultName string, resourceGroupName string, policyName string, options *armrecoveryservicesbackup.ProtectionPoliciesClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.ProtectionPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ProtectionPoliciesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, policyName string, options *armrecoveryservicesbackup.ProtectionPoliciesClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionPoliciesClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectionPoliciesServerTransport creates a new instance of ProtectionPoliciesServerTransport with the provided implementation. -// The returned ProtectionPoliciesServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectionPoliciesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectionPoliciesServerTransport(srv *ProtectionPoliciesServer) *ProtectionPoliciesServerTransport { - return &ProtectionPoliciesServerTransport{ - srv: srv, - beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.ProtectionPoliciesClientDeleteResponse]](), - } -} - -// ProtectionPoliciesServerTransport connects instances of armrecoveryservicesbackup.ProtectionPoliciesClient to instances of ProtectionPoliciesServer. -// Don't use this type directly, use NewProtectionPoliciesServerTransport instead. -type ProtectionPoliciesServerTransport struct { - srv *ProtectionPoliciesServer - beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesbackup.ProtectionPoliciesClientDeleteResponse]] -} - -// Do implements the policy.Transporter interface for ProtectionPoliciesServerTransport. -func (p *ProtectionPoliciesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectionPoliciesClient.CreateOrUpdate": - resp, err = p.dispatchCreateOrUpdate(req) - case "ProtectionPoliciesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "ProtectionPoliciesClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectionPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ProtectionPolicyResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - xMSAuthorizationAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-authorization-auxiliary")) - var options *armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions - if xMSAuthorizationAuxiliaryParam != nil { - options = &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{ - XMSAuthorizationAuxiliary: xMSAuthorizationAuxiliaryParam, - } - } - respr, errRespr := p.srv.CreateOrUpdate(req.Context(), vaultNameParam, resourceGroupNameParam, policyNameParam, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectionPolicyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *ProtectionPoliciesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), vaultNameParam, resourceGroupNameParam, policyNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *ProtectionPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, policyNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectionPolicyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicyoperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicyoperationresults_server.go deleted file mode 100644 index c72d719e2ef4..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicyoperationresults_server.go +++ /dev/null @@ -1,108 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectionPolicyOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.ProtectionPolicyOperationResultsClient type. -type ProtectionPolicyOperationResultsServer struct { - // Get is the fake for method ProtectionPolicyOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, policyName string, operationID string, options *armrecoveryservicesbackup.ProtectionPolicyOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionPolicyOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectionPolicyOperationResultsServerTransport creates a new instance of ProtectionPolicyOperationResultsServerTransport with the provided implementation. -// The returned ProtectionPolicyOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectionPolicyOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectionPolicyOperationResultsServerTransport(srv *ProtectionPolicyOperationResultsServer) *ProtectionPolicyOperationResultsServerTransport { - return &ProtectionPolicyOperationResultsServerTransport{srv: srv} -} - -// ProtectionPolicyOperationResultsServerTransport connects instances of armrecoveryservicesbackup.ProtectionPolicyOperationResultsClient to instances of ProtectionPolicyOperationResultsServer. -// Don't use this type directly, use NewProtectionPolicyOperationResultsServerTransport instead. -type ProtectionPolicyOperationResultsServerTransport struct { - srv *ProtectionPolicyOperationResultsServer -} - -// Do implements the policy.Transporter interface for ProtectionPolicyOperationResultsServerTransport. -func (p *ProtectionPolicyOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectionPolicyOperationResultsClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectionPolicyOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, policyNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProtectionPolicyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicyoperationstatuses_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicyoperationstatuses_server.go deleted file mode 100644 index 3ba6de3b1353..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/protectionpolicyoperationstatuses_server.go +++ /dev/null @@ -1,108 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ProtectionPolicyOperationStatusesServer is a fake server for instances of the armrecoveryservicesbackup.ProtectionPolicyOperationStatusesClient type. -type ProtectionPolicyOperationStatusesServer struct { - // Get is the fake for method ProtectionPolicyOperationStatusesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, policyName string, operationID string, options *armrecoveryservicesbackup.ProtectionPolicyOperationStatusesClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ProtectionPolicyOperationStatusesClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectionPolicyOperationStatusesServerTransport creates a new instance of ProtectionPolicyOperationStatusesServerTransport with the provided implementation. -// The returned ProtectionPolicyOperationStatusesServerTransport instance is connected to an instance of armrecoveryservicesbackup.ProtectionPolicyOperationStatusesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectionPolicyOperationStatusesServerTransport(srv *ProtectionPolicyOperationStatusesServer) *ProtectionPolicyOperationStatusesServerTransport { - return &ProtectionPolicyOperationStatusesServerTransport{srv: srv} -} - -// ProtectionPolicyOperationStatusesServerTransport connects instances of armrecoveryservicesbackup.ProtectionPolicyOperationStatusesClient to instances of ProtectionPolicyOperationStatusesServer. -// Don't use this type directly, use NewProtectionPolicyOperationStatusesServerTransport instead. -type ProtectionPolicyOperationStatusesServerTransport struct { - srv *ProtectionPolicyOperationStatusesServer -} - -// Do implements the policy.Transporter interface for ProtectionPolicyOperationStatusesServerTransport. -func (p *ProtectionPolicyOperationStatusesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectionPolicyOperationStatusesClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectionPolicyOperationStatusesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, policyNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypoints_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypoints_server.go index 71a94a972cf2..26e0d311016f 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypoints_server.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypoints_server.go @@ -15,8 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" "net/http" "net/url" "regexp" @@ -24,30 +23,22 @@ import ( // RecoveryPointsServer is a fake server for instances of the armrecoveryservicesbackup.RecoveryPointsClient type. type RecoveryPointsServer struct { - // Get is the fake for method RecoveryPointsClient.Get + // GetAccessToken is the fake for method RecoveryPointsClient.GetAccessToken // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *armrecoveryservicesbackup.RecoveryPointsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.RecoveryPointsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method RecoveryPointsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *armrecoveryservicesbackup.RecoveryPointsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsClientListResponse]) + GetAccessToken func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters armrecoveryservicesbackup.AADPropertiesResource, options *armrecoveryservicesbackup.RecoveryPointsClientGetAccessTokenOptions) (resp azfake.Responder[armrecoveryservicesbackup.RecoveryPointsClientGetAccessTokenResponse], errResp azfake.ErrorResponder) } // NewRecoveryPointsServerTransport creates a new instance of RecoveryPointsServerTransport with the provided implementation. // The returned RecoveryPointsServerTransport instance is connected to an instance of armrecoveryservicesbackup.RecoveryPointsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewRecoveryPointsServerTransport(srv *RecoveryPointsServer) *RecoveryPointsServerTransport { - return &RecoveryPointsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsClientListResponse]](), - } + return &RecoveryPointsServerTransport{srv: srv} } // RecoveryPointsServerTransport connects instances of armrecoveryservicesbackup.RecoveryPointsClient to instances of RecoveryPointsServer. // Don't use this type directly, use NewRecoveryPointsServerTransport instead. type RecoveryPointsServerTransport struct { - srv *RecoveryPointsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsClientListResponse]] + srv *RecoveryPointsServer } // Do implements the policy.Transporter interface for RecoveryPointsServerTransport. @@ -62,10 +53,8 @@ func (r *RecoveryPointsServerTransport) Do(req *http.Request) (*http.Response, e var err error switch method { - case "RecoveryPointsClient.Get": - resp, err = r.dispatchGet(req) - case "RecoveryPointsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) + case "RecoveryPointsClient.GetAccessToken": + resp, err = r.dispatchGetAccessToken(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -77,16 +66,20 @@ func (r *RecoveryPointsServerTransport) Do(req *http.Request) (*http.Response, e return resp, nil } -func (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} +func (r *RecoveryPointsServerTransport) dispatchGetAccessToken(req *http.Request) (*http.Response, error) { + if r.srv.GetAccessToken == nil { + return nil, &nonRetriableError{errors.New("fake for method GetAccessToken not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/accessToken` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.AADPropertiesResource](req) + if err != nil { + return nil, err + } vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err @@ -111,7 +104,7 @@ func (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Re if err != nil { return nil, err } - respr, errRespr := r.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, recoveryPointIDParam, nil) + respr, errRespr := r.srv.GetAccessToken(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, recoveryPointIDParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -119,74 +112,9 @@ func (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Re if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RecoveryPointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armrecoveryservicesbackup.RecoveryPointsClientListOptions - if filterParam != nil { - options = &armrecoveryservicesbackup.RecoveryPointsClientListOptions{ - Filter: filterParam, - } - } - resp := r.srv.NewListPager(vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, options) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.RecoveryPointsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CrrAccessTokenResource, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } return resp, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypointscrr_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypointscrr_server.go new file mode 100644 index 000000000000..3c1e9f76be02 --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypointscrr_server.go @@ -0,0 +1,192 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5" + "net/http" + "net/url" + "regexp" +) + +// RecoveryPointsCrrServer is a fake server for instances of the armrecoveryservicesbackup.RecoveryPointsCrrClient type. +type RecoveryPointsCrrServer struct { + // Get is the fake for method RecoveryPointsCrrClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *armrecoveryservicesbackup.RecoveryPointsCrrClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.RecoveryPointsCrrClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method RecoveryPointsCrrClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *armrecoveryservicesbackup.RecoveryPointsCrrClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsCrrClientListResponse]) +} + +// NewRecoveryPointsCrrServerTransport creates a new instance of RecoveryPointsCrrServerTransport with the provided implementation. +// The returned RecoveryPointsCrrServerTransport instance is connected to an instance of armrecoveryservicesbackup.RecoveryPointsCrrClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewRecoveryPointsCrrServerTransport(srv *RecoveryPointsCrrServer) *RecoveryPointsCrrServerTransport { + return &RecoveryPointsCrrServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsCrrClientListResponse]](), + } +} + +// RecoveryPointsCrrServerTransport connects instances of armrecoveryservicesbackup.RecoveryPointsCrrClient to instances of RecoveryPointsCrrServer. +// Don't use this type directly, use NewRecoveryPointsCrrServerTransport instead. +type RecoveryPointsCrrServerTransport struct { + srv *RecoveryPointsCrrServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsCrrClientListResponse]] +} + +// Do implements the policy.Transporter interface for RecoveryPointsCrrServerTransport. +func (r *RecoveryPointsCrrServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "RecoveryPointsCrrClient.Get": + resp, err = r.dispatchGet(req) + case "RecoveryPointsCrrClient.NewListPager": + resp, err = r.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *RecoveryPointsCrrServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 7 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) + if err != nil { + return nil, err + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + if err != nil { + return nil, err + } + recoveryPointIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPointId")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, recoveryPointIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RecoveryPointResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *RecoveryPointsCrrServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) + if err != nil { + return nil, err + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armrecoveryservicesbackup.RecoveryPointsCrrClientListOptions + if filterParam != nil { + options = &armrecoveryservicesbackup.RecoveryPointsCrrClientListOptions{ + Filter: filterParam, + } + } + resp := r.srv.NewListPager(vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, options) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.RecoveryPointsCrrClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypointsrecommendedformove_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypointsrecommendedformove_server.go deleted file mode 100644 index 61d4b70d13b3..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/recoverypointsrecommendedformove_server.go +++ /dev/null @@ -1,128 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// RecoveryPointsRecommendedForMoveServer is a fake server for instances of the armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClient type. -type RecoveryPointsRecommendedForMoveServer struct { - // NewListPager is the fake for method RecoveryPointsRecommendedForMoveClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters armrecoveryservicesbackup.ListRecoveryPointsRecommendedForMoveRequest, options *armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClientListResponse]) -} - -// NewRecoveryPointsRecommendedForMoveServerTransport creates a new instance of RecoveryPointsRecommendedForMoveServerTransport with the provided implementation. -// The returned RecoveryPointsRecommendedForMoveServerTransport instance is connected to an instance of armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRecoveryPointsRecommendedForMoveServerTransport(srv *RecoveryPointsRecommendedForMoveServer) *RecoveryPointsRecommendedForMoveServerTransport { - return &RecoveryPointsRecommendedForMoveServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClientListResponse]](), - } -} - -// RecoveryPointsRecommendedForMoveServerTransport connects instances of armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClient to instances of RecoveryPointsRecommendedForMoveServer. -// Don't use this type directly, use NewRecoveryPointsRecommendedForMoveServerTransport instead. -type RecoveryPointsRecommendedForMoveServerTransport struct { - srv *RecoveryPointsRecommendedForMoveServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClientListResponse]] -} - -// Do implements the policy.Transporter interface for RecoveryPointsRecommendedForMoveServerTransport. -func (r *RecoveryPointsRecommendedForMoveServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "RecoveryPointsRecommendedForMoveClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RecoveryPointsRecommendedForMoveServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPointsRecommendedForMove` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ListRecoveryPointsRecommendedForMoveRequest](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - resp := r.srv.NewListPager(vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, body, nil) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesbackup.RecoveryPointsRecommendedForMoveClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/resourceguardproxies_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/resourceguardproxies_server.go deleted file mode 100644 index fa9056967050..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/resourceguardproxies_server.go +++ /dev/null @@ -1,112 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ResourceGuardProxiesServer is a fake server for instances of the armrecoveryservicesbackup.ResourceGuardProxiesClient type. -type ResourceGuardProxiesServer struct { - // NewGetPager is the fake for method ResourceGuardProxiesClient.NewGetPager - // HTTP status codes to indicate success: http.StatusOK - NewGetPager func(vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.ResourceGuardProxiesClientGetOptions) (resp azfake.PagerResponder[armrecoveryservicesbackup.ResourceGuardProxiesClientGetResponse]) -} - -// NewResourceGuardProxiesServerTransport creates a new instance of ResourceGuardProxiesServerTransport with the provided implementation. -// The returned ResourceGuardProxiesServerTransport instance is connected to an instance of armrecoveryservicesbackup.ResourceGuardProxiesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewResourceGuardProxiesServerTransport(srv *ResourceGuardProxiesServer) *ResourceGuardProxiesServerTransport { - return &ResourceGuardProxiesServerTransport{ - srv: srv, - newGetPager: newTracker[azfake.PagerResponder[armrecoveryservicesbackup.ResourceGuardProxiesClientGetResponse]](), - } -} - -// ResourceGuardProxiesServerTransport connects instances of armrecoveryservicesbackup.ResourceGuardProxiesClient to instances of ResourceGuardProxiesServer. -// Don't use this type directly, use NewResourceGuardProxiesServerTransport instead. -type ResourceGuardProxiesServerTransport struct { - srv *ResourceGuardProxiesServer - newGetPager *tracker[azfake.PagerResponder[armrecoveryservicesbackup.ResourceGuardProxiesClientGetResponse]] -} - -// Do implements the policy.Transporter interface for ResourceGuardProxiesServerTransport. -func (r *ResourceGuardProxiesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ResourceGuardProxiesClient.NewGetPager": - resp, err = r.dispatchNewGetPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *ResourceGuardProxiesServerTransport) dispatchNewGetPager(req *http.Request) (*http.Response, error) { - if r.srv.NewGetPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewGetPager not implemented")} - } - newGetPager := r.newGetPager.get(req) - if newGetPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupResourceGuardProxies` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := r.srv.NewGetPager(vaultNameParam, resourceGroupNameParam, nil) - newGetPager = &resp - r.newGetPager.add(req, newGetPager) - server.PagerResponderInjectNextLinks(newGetPager, req, func(page *armrecoveryservicesbackup.ResourceGuardProxiesClientGetResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newGetPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newGetPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newGetPager) { - r.newGetPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/resourceguardproxy_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/resourceguardproxy_server.go deleted file mode 100644 index 068e2aac4bae..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/resourceguardproxy_server.go +++ /dev/null @@ -1,241 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ResourceGuardProxyServer is a fake server for instances of the armrecoveryservicesbackup.ResourceGuardProxyClient type. -type ResourceGuardProxyServer struct { - // Delete is the fake for method ResourceGuardProxyClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, options *armrecoveryservicesbackup.ResourceGuardProxyClientDeleteOptions) (resp azfake.Responder[armrecoveryservicesbackup.ResourceGuardProxyClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ResourceGuardProxyClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, options *armrecoveryservicesbackup.ResourceGuardProxyClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ResourceGuardProxyClientGetResponse], errResp azfake.ErrorResponder) - - // Put is the fake for method ResourceGuardProxyClient.Put - // HTTP status codes to indicate success: http.StatusOK - Put func(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, parameters armrecoveryservicesbackup.ResourceGuardProxyBaseResource, options *armrecoveryservicesbackup.ResourceGuardProxyClientPutOptions) (resp azfake.Responder[armrecoveryservicesbackup.ResourceGuardProxyClientPutResponse], errResp azfake.ErrorResponder) - - // UnlockDelete is the fake for method ResourceGuardProxyClient.UnlockDelete - // HTTP status codes to indicate success: http.StatusOK - UnlockDelete func(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, parameters armrecoveryservicesbackup.UnlockDeleteRequest, options *armrecoveryservicesbackup.ResourceGuardProxyClientUnlockDeleteOptions) (resp azfake.Responder[armrecoveryservicesbackup.ResourceGuardProxyClientUnlockDeleteResponse], errResp azfake.ErrorResponder) -} - -// NewResourceGuardProxyServerTransport creates a new instance of ResourceGuardProxyServerTransport with the provided implementation. -// The returned ResourceGuardProxyServerTransport instance is connected to an instance of armrecoveryservicesbackup.ResourceGuardProxyClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewResourceGuardProxyServerTransport(srv *ResourceGuardProxyServer) *ResourceGuardProxyServerTransport { - return &ResourceGuardProxyServerTransport{srv: srv} -} - -// ResourceGuardProxyServerTransport connects instances of armrecoveryservicesbackup.ResourceGuardProxyClient to instances of ResourceGuardProxyServer. -// Don't use this type directly, use NewResourceGuardProxyServerTransport instead. -type ResourceGuardProxyServerTransport struct { - srv *ResourceGuardProxyServer -} - -// Do implements the policy.Transporter interface for ResourceGuardProxyServerTransport. -func (r *ResourceGuardProxyServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ResourceGuardProxyClient.Delete": - resp, err = r.dispatchDelete(req) - case "ResourceGuardProxyClient.Get": - resp, err = r.dispatchGet(req) - case "ResourceGuardProxyClient.Put": - resp, err = r.dispatchPut(req) - case "ResourceGuardProxyClient.UnlockDelete": - resp, err = r.dispatchUnlockDelete(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *ResourceGuardProxyServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if r.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupResourceGuardProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceGuardProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGuardProxyName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Delete(req.Context(), vaultNameParam, resourceGroupNameParam, resourceGuardProxyNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *ResourceGuardProxyServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupResourceGuardProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceGuardProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGuardProxyName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, resourceGuardProxyNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceGuardProxyBaseResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *ResourceGuardProxyServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { - if r.srv.Put == nil { - return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupResourceGuardProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ResourceGuardProxyBaseResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceGuardProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGuardProxyName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Put(req.Context(), vaultNameParam, resourceGroupNameParam, resourceGuardProxyNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceGuardProxyBaseResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *ResourceGuardProxyServerTransport) dispatchUnlockDelete(req *http.Request) (*http.Response, error) { - if r.srv.UnlockDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method UnlockDelete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupResourceGuardProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/unlockDelete` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.UnlockDeleteRequest](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceGuardProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGuardProxyName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.UnlockDelete(req.Context(), vaultNameParam, resourceGroupNameParam, resourceGuardProxyNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).UnlockDeleteResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/restores_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/restores_server.go deleted file mode 100644 index b59af3945c57..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/restores_server.go +++ /dev/null @@ -1,142 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// RestoresServer is a fake server for instances of the armrecoveryservicesbackup.RestoresClient type. -type RestoresServer struct { - // BeginTrigger is the fake for method RestoresClient.BeginTrigger - // HTTP status codes to indicate success: http.StatusAccepted - BeginTrigger func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters armrecoveryservicesbackup.RestoreRequestResource, options *armrecoveryservicesbackup.RestoresClientBeginTriggerOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.RestoresClientTriggerResponse], errResp azfake.ErrorResponder) -} - -// NewRestoresServerTransport creates a new instance of RestoresServerTransport with the provided implementation. -// The returned RestoresServerTransport instance is connected to an instance of armrecoveryservicesbackup.RestoresClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRestoresServerTransport(srv *RestoresServer) *RestoresServerTransport { - return &RestoresServerTransport{ - srv: srv, - beginTrigger: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.RestoresClientTriggerResponse]](), - } -} - -// RestoresServerTransport connects instances of armrecoveryservicesbackup.RestoresClient to instances of RestoresServer. -// Don't use this type directly, use NewRestoresServerTransport instead. -type RestoresServerTransport struct { - srv *RestoresServer - beginTrigger *tracker[azfake.PollerResponder[armrecoveryservicesbackup.RestoresClientTriggerResponse]] -} - -// Do implements the policy.Transporter interface for RestoresServerTransport. -func (r *RestoresServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "RestoresClient.BeginTrigger": - resp, err = r.dispatchBeginTrigger(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RestoresServerTransport) dispatchBeginTrigger(req *http.Request) (*http.Response, error) { - if r.srv.BeginTrigger == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginTrigger not implemented")} - } - beginTrigger := r.beginTrigger.get(req) - if beginTrigger == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restore` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.RestoreRequestResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - recoveryPointIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPointId")]) - if err != nil { - return nil, err - } - xMSAuthorizationAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-authorization-auxiliary")) - var options *armrecoveryservicesbackup.RestoresClientBeginTriggerOptions - if xMSAuthorizationAuxiliaryParam != nil { - options = &armrecoveryservicesbackup.RestoresClientBeginTriggerOptions{ - XMSAuthorizationAuxiliary: xMSAuthorizationAuxiliaryParam, - } - } - respr, errRespr := r.srv.BeginTrigger(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, recoveryPointIDParam, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginTrigger = &respr - r.beginTrigger.add(req, beginTrigger) - } - - resp, err := server.PollerResponderNext(beginTrigger, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { - r.beginTrigger.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginTrigger) { - r.beginTrigger.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/securitypins_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/securitypins_server.go deleted file mode 100644 index cf4aad0745f7..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/securitypins_server.go +++ /dev/null @@ -1,113 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// SecurityPINsServer is a fake server for instances of the armrecoveryservicesbackup.SecurityPINsClient type. -type SecurityPINsServer struct { - // Get is the fake for method SecurityPINsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, options *armrecoveryservicesbackup.SecurityPINsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.SecurityPINsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewSecurityPINsServerTransport creates a new instance of SecurityPINsServerTransport with the provided implementation. -// The returned SecurityPINsServerTransport instance is connected to an instance of armrecoveryservicesbackup.SecurityPINsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSecurityPINsServerTransport(srv *SecurityPINsServer) *SecurityPINsServerTransport { - return &SecurityPINsServerTransport{srv: srv} -} - -// SecurityPINsServerTransport connects instances of armrecoveryservicesbackup.SecurityPINsClient to instances of SecurityPINsServer. -// Don't use this type directly, use NewSecurityPINsServerTransport instead. -type SecurityPINsServerTransport struct { - srv *SecurityPINsServer -} - -// Do implements the policy.Transporter interface for SecurityPINsServerTransport. -func (s *SecurityPINsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "SecurityPINsClient.Get": - resp, err = s.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SecurityPINsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if s.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupSecurityPIN` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.SecurityPinBase](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - xMSAuthorizationAuxiliaryParam := getOptional(getHeaderValue(req.Header, "x-ms-authorization-auxiliary")) - var options *armrecoveryservicesbackup.SecurityPINsClientGetOptions - if xMSAuthorizationAuxiliaryParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesbackup.SecurityPINsClientGetOptions{ - XMSAuthorizationAuxiliary: xMSAuthorizationAuxiliaryParam, - Parameters: &body, - } - } - respr, errRespr := s.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TokenInformation, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/server.go deleted file mode 100644 index dcd2d49e0a6b..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/server.go +++ /dev/null @@ -1,290 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// Server is a fake server for instances of the armrecoveryservicesbackup.Client type. -type Server struct { - // BeginBMSPrepareDataMove is the fake for method Client.BeginBMSPrepareDataMove - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginBMSPrepareDataMove func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.PrepareDataMoveRequest, options *armrecoveryservicesbackup.ClientBeginBMSPrepareDataMoveOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.ClientBMSPrepareDataMoveResponse], errResp azfake.ErrorResponder) - - // BeginBMSTriggerDataMove is the fake for method Client.BeginBMSTriggerDataMove - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginBMSTriggerDataMove func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.TriggerDataMoveRequest, options *armrecoveryservicesbackup.ClientBeginBMSTriggerDataMoveOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.ClientBMSTriggerDataMoveResponse], errResp azfake.ErrorResponder) - - // GetOperationStatus is the fake for method Client.GetOperationStatus - // HTTP status codes to indicate success: http.StatusOK - GetOperationStatus func(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *armrecoveryservicesbackup.ClientGetOperationStatusOptions) (resp azfake.Responder[armrecoveryservicesbackup.ClientGetOperationStatusResponse], errResp azfake.ErrorResponder) - - // BeginMoveRecoveryPoint is the fake for method Client.BeginMoveRecoveryPoint - // HTTP status codes to indicate success: http.StatusAccepted - BeginMoveRecoveryPoint func(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters armrecoveryservicesbackup.MoveRPAcrossTiersRequest, options *armrecoveryservicesbackup.ClientBeginMoveRecoveryPointOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.ClientMoveRecoveryPointResponse], errResp azfake.ErrorResponder) -} - -// NewServerTransport creates a new instance of ServerTransport with the provided implementation. -// The returned ServerTransport instance is connected to an instance of armrecoveryservicesbackup.Client via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewServerTransport(srv *Server) *ServerTransport { - return &ServerTransport{ - srv: srv, - beginBMSPrepareDataMove: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.ClientBMSPrepareDataMoveResponse]](), - beginBMSTriggerDataMove: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.ClientBMSTriggerDataMoveResponse]](), - beginMoveRecoveryPoint: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.ClientMoveRecoveryPointResponse]](), - } -} - -// ServerTransport connects instances of armrecoveryservicesbackup.Client to instances of Server. -// Don't use this type directly, use NewServerTransport instead. -type ServerTransport struct { - srv *Server - beginBMSPrepareDataMove *tracker[azfake.PollerResponder[armrecoveryservicesbackup.ClientBMSPrepareDataMoveResponse]] - beginBMSTriggerDataMove *tracker[azfake.PollerResponder[armrecoveryservicesbackup.ClientBMSTriggerDataMoveResponse]] - beginMoveRecoveryPoint *tracker[azfake.PollerResponder[armrecoveryservicesbackup.ClientMoveRecoveryPointResponse]] -} - -// Do implements the policy.Transporter interface for ServerTransport. -func (s *ServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "Client.BeginBMSPrepareDataMove": - resp, err = s.dispatchBeginBMSPrepareDataMove(req) - case "Client.BeginBMSTriggerDataMove": - resp, err = s.dispatchBeginBMSTriggerDataMove(req) - case "Client.GetOperationStatus": - resp, err = s.dispatchGetOperationStatus(req) - case "Client.BeginMoveRecoveryPoint": - resp, err = s.dispatchBeginMoveRecoveryPoint(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *ServerTransport) dispatchBeginBMSPrepareDataMove(req *http.Request) (*http.Response, error) { - if s.srv.BeginBMSPrepareDataMove == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginBMSPrepareDataMove not implemented")} - } - beginBMSPrepareDataMove := s.beginBMSPrepareDataMove.get(req) - if beginBMSPrepareDataMove == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig/prepareDataMove` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.PrepareDataMoveRequest](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.BeginBMSPrepareDataMove(req.Context(), vaultNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginBMSPrepareDataMove = &respr - s.beginBMSPrepareDataMove.add(req, beginBMSPrepareDataMove) - } - - resp, err := server.PollerResponderNext(beginBMSPrepareDataMove, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginBMSPrepareDataMove.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginBMSPrepareDataMove) { - s.beginBMSPrepareDataMove.remove(req) - } - - return resp, nil -} - -func (s *ServerTransport) dispatchBeginBMSTriggerDataMove(req *http.Request) (*http.Response, error) { - if s.srv.BeginBMSTriggerDataMove == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginBMSTriggerDataMove not implemented")} - } - beginBMSTriggerDataMove := s.beginBMSTriggerDataMove.get(req) - if beginBMSTriggerDataMove == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig/triggerDataMove` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.TriggerDataMoveRequest](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.BeginBMSTriggerDataMove(req.Context(), vaultNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginBMSTriggerDataMove = &respr - s.beginBMSTriggerDataMove.add(req, beginBMSTriggerDataMove) - } - - resp, err := server.PollerResponderNext(beginBMSTriggerDataMove, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginBMSTriggerDataMove.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginBMSTriggerDataMove) { - s.beginBMSTriggerDataMove.remove(req) - } - - return resp, nil -} - -func (s *ServerTransport) dispatchGetOperationStatus(req *http.Request) (*http.Response, error) { - if s.srv.GetOperationStatus == nil { - return nil, &nonRetriableError{errors.New("fake for method GetOperationStatus not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupstorageconfig/vaultstorageconfig/operationStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.GetOperationStatus(req.Context(), vaultNameParam, resourceGroupNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServerTransport) dispatchBeginMoveRecoveryPoint(req *http.Request) (*http.Response, error) { - if s.srv.BeginMoveRecoveryPoint == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginMoveRecoveryPoint not implemented")} - } - beginMoveRecoveryPoint := s.beginMoveRecoveryPoint.get(req) - if beginMoveRecoveryPoint == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectionContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/recoveryPoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/move` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.MoveRPAcrossTiersRequest](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - recoveryPointIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("recoveryPointId")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.BeginMoveRecoveryPoint(req.Context(), vaultNameParam, resourceGroupNameParam, fabricNameParam, containerNameParam, protectedItemNameParam, recoveryPointIDParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginMoveRecoveryPoint = &respr - s.beginMoveRecoveryPoint.add(req, beginMoveRecoveryPoint) - } - - resp, err := server.PollerResponderNext(beginMoveRecoveryPoint, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { - s.beginMoveRecoveryPoint.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginMoveRecoveryPoint) { - s.beginMoveRecoveryPoint.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/server_factory.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/server_factory.go index 8e424dd04f29..729aecb9eab6 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/server_factory.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/server_factory.go @@ -19,59 +19,17 @@ import ( // ServerFactory is a fake server for instances of the armrecoveryservicesbackup.ClientFactory type. type ServerFactory struct { - BMSPrepareDataMoveOperationResultServer BMSPrepareDataMoveOperationResultServer - BackupEnginesServer BackupEnginesServer - BackupJobsServer BackupJobsServer - BackupOperationResultsServer BackupOperationResultsServer - BackupOperationStatusesServer BackupOperationStatusesServer - BackupPoliciesServer BackupPoliciesServer - BackupProtectableItemsServer BackupProtectableItemsServer - BackupProtectedItemsServer BackupProtectedItemsServer - BackupProtectionContainersServer BackupProtectionContainersServer - BackupProtectionIntentServer BackupProtectionIntentServer - BackupResourceEncryptionConfigsServer BackupResourceEncryptionConfigsServer - BackupResourceStorageConfigsNonCRRServer BackupResourceStorageConfigsNonCRRServer - BackupResourceVaultConfigsServer BackupResourceVaultConfigsServer - BackupStatusServer BackupStatusServer - BackupUsageSummariesServer BackupUsageSummariesServer - BackupWorkloadItemsServer BackupWorkloadItemsServer - BackupsServer BackupsServer - Server Server - DeletedProtectionContainersServer DeletedProtectionContainersServer - ExportJobsOperationResultsServer ExportJobsOperationResultsServer - FeatureSupportServer FeatureSupportServer - FetchTieringCostServer FetchTieringCostServer - GetTieringCostOperationResultServer GetTieringCostOperationResultServer - ItemLevelRecoveryConnectionsServer ItemLevelRecoveryConnectionsServer - JobCancellationsServer JobCancellationsServer - JobDetailsServer JobDetailsServer - JobOperationResultsServer JobOperationResultsServer - JobsServer JobsServer - OperationServer OperationServer - OperationsServer OperationsServer - PrivateEndpointServer PrivateEndpointServer - PrivateEndpointConnectionServer PrivateEndpointConnectionServer - ProtectableContainersServer ProtectableContainersServer - ProtectedItemOperationResultsServer ProtectedItemOperationResultsServer - ProtectedItemOperationStatusesServer ProtectedItemOperationStatusesServer - ProtectedItemsServer ProtectedItemsServer - ProtectionContainerOperationResultsServer ProtectionContainerOperationResultsServer - ProtectionContainerRefreshOperationResultsServer ProtectionContainerRefreshOperationResultsServer - ProtectionContainersServer ProtectionContainersServer - ProtectionIntentServer ProtectionIntentServer - ProtectionPoliciesServer ProtectionPoliciesServer - ProtectionPolicyOperationResultsServer ProtectionPolicyOperationResultsServer - ProtectionPolicyOperationStatusesServer ProtectionPolicyOperationStatusesServer - RecoveryPointsServer RecoveryPointsServer - RecoveryPointsRecommendedForMoveServer RecoveryPointsRecommendedForMoveServer - ResourceGuardProxiesServer ResourceGuardProxiesServer - ResourceGuardProxyServer ResourceGuardProxyServer - RestoresServer RestoresServer - SecurityPINsServer SecurityPINsServer - TieringCostOperationStatusServer TieringCostOperationStatusServer - ValidateOperationServer ValidateOperationServer - ValidateOperationResultsServer ValidateOperationResultsServer - ValidateOperationStatusesServer ValidateOperationStatusesServer + AADPropertiesServer AADPropertiesServer + BackupCrrJobDetailsServer BackupCrrJobDetailsServer + BackupCrrJobsServer BackupCrrJobsServer + BackupProtectedItemsCrrServer BackupProtectedItemsCrrServer + BackupResourceStorageConfigsServer BackupResourceStorageConfigsServer + BackupUsageSummariesCRRServer BackupUsageSummariesCRRServer + CrossRegionRestoreServer CrossRegionRestoreServer + CrrOperationResultsServer CrrOperationResultsServer + CrrOperationStatusServer CrrOperationStatusServer + RecoveryPointsServer RecoveryPointsServer + RecoveryPointsCrrServer RecoveryPointsCrrServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -86,61 +44,19 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armrecoveryservicesbackup.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trBMSPrepareDataMoveOperationResultServer *BMSPrepareDataMoveOperationResultServerTransport - trBackupEnginesServer *BackupEnginesServerTransport - trBackupJobsServer *BackupJobsServerTransport - trBackupOperationResultsServer *BackupOperationResultsServerTransport - trBackupOperationStatusesServer *BackupOperationStatusesServerTransport - trBackupPoliciesServer *BackupPoliciesServerTransport - trBackupProtectableItemsServer *BackupProtectableItemsServerTransport - trBackupProtectedItemsServer *BackupProtectedItemsServerTransport - trBackupProtectionContainersServer *BackupProtectionContainersServerTransport - trBackupProtectionIntentServer *BackupProtectionIntentServerTransport - trBackupResourceEncryptionConfigsServer *BackupResourceEncryptionConfigsServerTransport - trBackupResourceStorageConfigsNonCRRServer *BackupResourceStorageConfigsNonCRRServerTransport - trBackupResourceVaultConfigsServer *BackupResourceVaultConfigsServerTransport - trBackupStatusServer *BackupStatusServerTransport - trBackupUsageSummariesServer *BackupUsageSummariesServerTransport - trBackupWorkloadItemsServer *BackupWorkloadItemsServerTransport - trBackupsServer *BackupsServerTransport - trServer *ServerTransport - trDeletedProtectionContainersServer *DeletedProtectionContainersServerTransport - trExportJobsOperationResultsServer *ExportJobsOperationResultsServerTransport - trFeatureSupportServer *FeatureSupportServerTransport - trFetchTieringCostServer *FetchTieringCostServerTransport - trGetTieringCostOperationResultServer *GetTieringCostOperationResultServerTransport - trItemLevelRecoveryConnectionsServer *ItemLevelRecoveryConnectionsServerTransport - trJobCancellationsServer *JobCancellationsServerTransport - trJobDetailsServer *JobDetailsServerTransport - trJobOperationResultsServer *JobOperationResultsServerTransport - trJobsServer *JobsServerTransport - trOperationServer *OperationServerTransport - trOperationsServer *OperationsServerTransport - trPrivateEndpointServer *PrivateEndpointServerTransport - trPrivateEndpointConnectionServer *PrivateEndpointConnectionServerTransport - trProtectableContainersServer *ProtectableContainersServerTransport - trProtectedItemOperationResultsServer *ProtectedItemOperationResultsServerTransport - trProtectedItemOperationStatusesServer *ProtectedItemOperationStatusesServerTransport - trProtectedItemsServer *ProtectedItemsServerTransport - trProtectionContainerOperationResultsServer *ProtectionContainerOperationResultsServerTransport - trProtectionContainerRefreshOperationResultsServer *ProtectionContainerRefreshOperationResultsServerTransport - trProtectionContainersServer *ProtectionContainersServerTransport - trProtectionIntentServer *ProtectionIntentServerTransport - trProtectionPoliciesServer *ProtectionPoliciesServerTransport - trProtectionPolicyOperationResultsServer *ProtectionPolicyOperationResultsServerTransport - trProtectionPolicyOperationStatusesServer *ProtectionPolicyOperationStatusesServerTransport - trRecoveryPointsServer *RecoveryPointsServerTransport - trRecoveryPointsRecommendedForMoveServer *RecoveryPointsRecommendedForMoveServerTransport - trResourceGuardProxiesServer *ResourceGuardProxiesServerTransport - trResourceGuardProxyServer *ResourceGuardProxyServerTransport - trRestoresServer *RestoresServerTransport - trSecurityPINsServer *SecurityPINsServerTransport - trTieringCostOperationStatusServer *TieringCostOperationStatusServerTransport - trValidateOperationServer *ValidateOperationServerTransport - trValidateOperationResultsServer *ValidateOperationResultsServerTransport - trValidateOperationStatusesServer *ValidateOperationStatusesServerTransport + srv *ServerFactory + trMu sync.Mutex + trAADPropertiesServer *AADPropertiesServerTransport + trBackupCrrJobDetailsServer *BackupCrrJobDetailsServerTransport + trBackupCrrJobsServer *BackupCrrJobsServerTransport + trBackupProtectedItemsCrrServer *BackupProtectedItemsCrrServerTransport + trBackupResourceStorageConfigsServer *BackupResourceStorageConfigsServerTransport + trBackupUsageSummariesCRRServer *BackupUsageSummariesCRRServerTransport + trCrossRegionRestoreServer *CrossRegionRestoreServerTransport + trCrrOperationResultsServer *CrrOperationResultsServerTransport + trCrrOperationStatusServer *CrrOperationStatusServerTransport + trRecoveryPointsServer *RecoveryPointsServerTransport + trRecoveryPointsCrrServer *RecoveryPointsCrrServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -156,251 +72,61 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "BMSPrepareDataMoveOperationResultClient": - initServer(s, &s.trBMSPrepareDataMoveOperationResultServer, func() *BMSPrepareDataMoveOperationResultServerTransport { - return NewBMSPrepareDataMoveOperationResultServerTransport(&s.srv.BMSPrepareDataMoveOperationResultServer) - }) - resp, err = s.trBMSPrepareDataMoveOperationResultServer.Do(req) - case "BackupEnginesClient": - initServer(s, &s.trBackupEnginesServer, func() *BackupEnginesServerTransport { - return NewBackupEnginesServerTransport(&s.srv.BackupEnginesServer) - }) - resp, err = s.trBackupEnginesServer.Do(req) - case "BackupJobsClient": - initServer(s, &s.trBackupJobsServer, func() *BackupJobsServerTransport { return NewBackupJobsServerTransport(&s.srv.BackupJobsServer) }) - resp, err = s.trBackupJobsServer.Do(req) - case "BackupOperationResultsClient": - initServer(s, &s.trBackupOperationResultsServer, func() *BackupOperationResultsServerTransport { - return NewBackupOperationResultsServerTransport(&s.srv.BackupOperationResultsServer) - }) - resp, err = s.trBackupOperationResultsServer.Do(req) - case "BackupOperationStatusesClient": - initServer(s, &s.trBackupOperationStatusesServer, func() *BackupOperationStatusesServerTransport { - return NewBackupOperationStatusesServerTransport(&s.srv.BackupOperationStatusesServer) - }) - resp, err = s.trBackupOperationStatusesServer.Do(req) - case "BackupPoliciesClient": - initServer(s, &s.trBackupPoliciesServer, func() *BackupPoliciesServerTransport { - return NewBackupPoliciesServerTransport(&s.srv.BackupPoliciesServer) - }) - resp, err = s.trBackupPoliciesServer.Do(req) - case "BackupProtectableItemsClient": - initServer(s, &s.trBackupProtectableItemsServer, func() *BackupProtectableItemsServerTransport { - return NewBackupProtectableItemsServerTransport(&s.srv.BackupProtectableItemsServer) - }) - resp, err = s.trBackupProtectableItemsServer.Do(req) - case "BackupProtectedItemsClient": - initServer(s, &s.trBackupProtectedItemsServer, func() *BackupProtectedItemsServerTransport { - return NewBackupProtectedItemsServerTransport(&s.srv.BackupProtectedItemsServer) - }) - resp, err = s.trBackupProtectedItemsServer.Do(req) - case "BackupProtectionContainersClient": - initServer(s, &s.trBackupProtectionContainersServer, func() *BackupProtectionContainersServerTransport { - return NewBackupProtectionContainersServerTransport(&s.srv.BackupProtectionContainersServer) - }) - resp, err = s.trBackupProtectionContainersServer.Do(req) - case "BackupProtectionIntentClient": - initServer(s, &s.trBackupProtectionIntentServer, func() *BackupProtectionIntentServerTransport { - return NewBackupProtectionIntentServerTransport(&s.srv.BackupProtectionIntentServer) - }) - resp, err = s.trBackupProtectionIntentServer.Do(req) - case "BackupResourceEncryptionConfigsClient": - initServer(s, &s.trBackupResourceEncryptionConfigsServer, func() *BackupResourceEncryptionConfigsServerTransport { - return NewBackupResourceEncryptionConfigsServerTransport(&s.srv.BackupResourceEncryptionConfigsServer) - }) - resp, err = s.trBackupResourceEncryptionConfigsServer.Do(req) - case "BackupResourceStorageConfigsNonCRRClient": - initServer(s, &s.trBackupResourceStorageConfigsNonCRRServer, func() *BackupResourceStorageConfigsNonCRRServerTransport { - return NewBackupResourceStorageConfigsNonCRRServerTransport(&s.srv.BackupResourceStorageConfigsNonCRRServer) - }) - resp, err = s.trBackupResourceStorageConfigsNonCRRServer.Do(req) - case "BackupResourceVaultConfigsClient": - initServer(s, &s.trBackupResourceVaultConfigsServer, func() *BackupResourceVaultConfigsServerTransport { - return NewBackupResourceVaultConfigsServerTransport(&s.srv.BackupResourceVaultConfigsServer) - }) - resp, err = s.trBackupResourceVaultConfigsServer.Do(req) - case "BackupStatusClient": - initServer(s, &s.trBackupStatusServer, func() *BackupStatusServerTransport { return NewBackupStatusServerTransport(&s.srv.BackupStatusServer) }) - resp, err = s.trBackupStatusServer.Do(req) - case "BackupUsageSummariesClient": - initServer(s, &s.trBackupUsageSummariesServer, func() *BackupUsageSummariesServerTransport { - return NewBackupUsageSummariesServerTransport(&s.srv.BackupUsageSummariesServer) - }) - resp, err = s.trBackupUsageSummariesServer.Do(req) - case "BackupWorkloadItemsClient": - initServer(s, &s.trBackupWorkloadItemsServer, func() *BackupWorkloadItemsServerTransport { - return NewBackupWorkloadItemsServerTransport(&s.srv.BackupWorkloadItemsServer) - }) - resp, err = s.trBackupWorkloadItemsServer.Do(req) - case "BackupsClient": - initServer(s, &s.trBackupsServer, func() *BackupsServerTransport { return NewBackupsServerTransport(&s.srv.BackupsServer) }) - resp, err = s.trBackupsServer.Do(req) - case "Client": - initServer(s, &s.trServer, func() *ServerTransport { return NewServerTransport(&s.srv.Server) }) - resp, err = s.trServer.Do(req) - case "DeletedProtectionContainersClient": - initServer(s, &s.trDeletedProtectionContainersServer, func() *DeletedProtectionContainersServerTransport { - return NewDeletedProtectionContainersServerTransport(&s.srv.DeletedProtectionContainersServer) - }) - resp, err = s.trDeletedProtectionContainersServer.Do(req) - case "ExportJobsOperationResultsClient": - initServer(s, &s.trExportJobsOperationResultsServer, func() *ExportJobsOperationResultsServerTransport { - return NewExportJobsOperationResultsServerTransport(&s.srv.ExportJobsOperationResultsServer) - }) - resp, err = s.trExportJobsOperationResultsServer.Do(req) - case "FeatureSupportClient": - initServer(s, &s.trFeatureSupportServer, func() *FeatureSupportServerTransport { - return NewFeatureSupportServerTransport(&s.srv.FeatureSupportServer) - }) - resp, err = s.trFeatureSupportServer.Do(req) - case "FetchTieringCostClient": - initServer(s, &s.trFetchTieringCostServer, func() *FetchTieringCostServerTransport { - return NewFetchTieringCostServerTransport(&s.srv.FetchTieringCostServer) - }) - resp, err = s.trFetchTieringCostServer.Do(req) - case "GetTieringCostOperationResultClient": - initServer(s, &s.trGetTieringCostOperationResultServer, func() *GetTieringCostOperationResultServerTransport { - return NewGetTieringCostOperationResultServerTransport(&s.srv.GetTieringCostOperationResultServer) - }) - resp, err = s.trGetTieringCostOperationResultServer.Do(req) - case "ItemLevelRecoveryConnectionsClient": - initServer(s, &s.trItemLevelRecoveryConnectionsServer, func() *ItemLevelRecoveryConnectionsServerTransport { - return NewItemLevelRecoveryConnectionsServerTransport(&s.srv.ItemLevelRecoveryConnectionsServer) - }) - resp, err = s.trItemLevelRecoveryConnectionsServer.Do(req) - case "JobCancellationsClient": - initServer(s, &s.trJobCancellationsServer, func() *JobCancellationsServerTransport { - return NewJobCancellationsServerTransport(&s.srv.JobCancellationsServer) - }) - resp, err = s.trJobCancellationsServer.Do(req) - case "JobDetailsClient": - initServer(s, &s.trJobDetailsServer, func() *JobDetailsServerTransport { return NewJobDetailsServerTransport(&s.srv.JobDetailsServer) }) - resp, err = s.trJobDetailsServer.Do(req) - case "JobOperationResultsClient": - initServer(s, &s.trJobOperationResultsServer, func() *JobOperationResultsServerTransport { - return NewJobOperationResultsServerTransport(&s.srv.JobOperationResultsServer) - }) - resp, err = s.trJobOperationResultsServer.Do(req) - case "JobsClient": - initServer(s, &s.trJobsServer, func() *JobsServerTransport { return NewJobsServerTransport(&s.srv.JobsServer) }) - resp, err = s.trJobsServer.Do(req) - case "OperationClient": - initServer(s, &s.trOperationServer, func() *OperationServerTransport { return NewOperationServerTransport(&s.srv.OperationServer) }) - resp, err = s.trOperationServer.Do(req) - case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) - resp, err = s.trOperationsServer.Do(req) - case "PrivateEndpointClient": - initServer(s, &s.trPrivateEndpointServer, func() *PrivateEndpointServerTransport { - return NewPrivateEndpointServerTransport(&s.srv.PrivateEndpointServer) - }) - resp, err = s.trPrivateEndpointServer.Do(req) - case "PrivateEndpointConnectionClient": - initServer(s, &s.trPrivateEndpointConnectionServer, func() *PrivateEndpointConnectionServerTransport { - return NewPrivateEndpointConnectionServerTransport(&s.srv.PrivateEndpointConnectionServer) - }) - resp, err = s.trPrivateEndpointConnectionServer.Do(req) - case "ProtectableContainersClient": - initServer(s, &s.trProtectableContainersServer, func() *ProtectableContainersServerTransport { - return NewProtectableContainersServerTransport(&s.srv.ProtectableContainersServer) - }) - resp, err = s.trProtectableContainersServer.Do(req) - case "ProtectedItemOperationResultsClient": - initServer(s, &s.trProtectedItemOperationResultsServer, func() *ProtectedItemOperationResultsServerTransport { - return NewProtectedItemOperationResultsServerTransport(&s.srv.ProtectedItemOperationResultsServer) - }) - resp, err = s.trProtectedItemOperationResultsServer.Do(req) - case "ProtectedItemOperationStatusesClient": - initServer(s, &s.trProtectedItemOperationStatusesServer, func() *ProtectedItemOperationStatusesServerTransport { - return NewProtectedItemOperationStatusesServerTransport(&s.srv.ProtectedItemOperationStatusesServer) - }) - resp, err = s.trProtectedItemOperationStatusesServer.Do(req) - case "ProtectedItemsClient": - initServer(s, &s.trProtectedItemsServer, func() *ProtectedItemsServerTransport { - return NewProtectedItemsServerTransport(&s.srv.ProtectedItemsServer) - }) - resp, err = s.trProtectedItemsServer.Do(req) - case "ProtectionContainerOperationResultsClient": - initServer(s, &s.trProtectionContainerOperationResultsServer, func() *ProtectionContainerOperationResultsServerTransport { - return NewProtectionContainerOperationResultsServerTransport(&s.srv.ProtectionContainerOperationResultsServer) - }) - resp, err = s.trProtectionContainerOperationResultsServer.Do(req) - case "ProtectionContainerRefreshOperationResultsClient": - initServer(s, &s.trProtectionContainerRefreshOperationResultsServer, func() *ProtectionContainerRefreshOperationResultsServerTransport { - return NewProtectionContainerRefreshOperationResultsServerTransport(&s.srv.ProtectionContainerRefreshOperationResultsServer) - }) - resp, err = s.trProtectionContainerRefreshOperationResultsServer.Do(req) - case "ProtectionContainersClient": - initServer(s, &s.trProtectionContainersServer, func() *ProtectionContainersServerTransport { - return NewProtectionContainersServerTransport(&s.srv.ProtectionContainersServer) - }) - resp, err = s.trProtectionContainersServer.Do(req) - case "ProtectionIntentClient": - initServer(s, &s.trProtectionIntentServer, func() *ProtectionIntentServerTransport { - return NewProtectionIntentServerTransport(&s.srv.ProtectionIntentServer) - }) - resp, err = s.trProtectionIntentServer.Do(req) - case "ProtectionPoliciesClient": - initServer(s, &s.trProtectionPoliciesServer, func() *ProtectionPoliciesServerTransport { - return NewProtectionPoliciesServerTransport(&s.srv.ProtectionPoliciesServer) - }) - resp, err = s.trProtectionPoliciesServer.Do(req) - case "ProtectionPolicyOperationResultsClient": - initServer(s, &s.trProtectionPolicyOperationResultsServer, func() *ProtectionPolicyOperationResultsServerTransport { - return NewProtectionPolicyOperationResultsServerTransport(&s.srv.ProtectionPolicyOperationResultsServer) - }) - resp, err = s.trProtectionPolicyOperationResultsServer.Do(req) - case "ProtectionPolicyOperationStatusesClient": - initServer(s, &s.trProtectionPolicyOperationStatusesServer, func() *ProtectionPolicyOperationStatusesServerTransport { - return NewProtectionPolicyOperationStatusesServerTransport(&s.srv.ProtectionPolicyOperationStatusesServer) - }) - resp, err = s.trProtectionPolicyOperationStatusesServer.Do(req) + case "AADPropertiesClient": + initServer(s, &s.trAADPropertiesServer, func() *AADPropertiesServerTransport { + return NewAADPropertiesServerTransport(&s.srv.AADPropertiesServer) + }) + resp, err = s.trAADPropertiesServer.Do(req) + case "BackupCrrJobDetailsClient": + initServer(s, &s.trBackupCrrJobDetailsServer, func() *BackupCrrJobDetailsServerTransport { + return NewBackupCrrJobDetailsServerTransport(&s.srv.BackupCrrJobDetailsServer) + }) + resp, err = s.trBackupCrrJobDetailsServer.Do(req) + case "BackupCrrJobsClient": + initServer(s, &s.trBackupCrrJobsServer, func() *BackupCrrJobsServerTransport { + return NewBackupCrrJobsServerTransport(&s.srv.BackupCrrJobsServer) + }) + resp, err = s.trBackupCrrJobsServer.Do(req) + case "BackupProtectedItemsCrrClient": + initServer(s, &s.trBackupProtectedItemsCrrServer, func() *BackupProtectedItemsCrrServerTransport { + return NewBackupProtectedItemsCrrServerTransport(&s.srv.BackupProtectedItemsCrrServer) + }) + resp, err = s.trBackupProtectedItemsCrrServer.Do(req) + case "BackupResourceStorageConfigsClient": + initServer(s, &s.trBackupResourceStorageConfigsServer, func() *BackupResourceStorageConfigsServerTransport { + return NewBackupResourceStorageConfigsServerTransport(&s.srv.BackupResourceStorageConfigsServer) + }) + resp, err = s.trBackupResourceStorageConfigsServer.Do(req) + case "BackupUsageSummariesCRRClient": + initServer(s, &s.trBackupUsageSummariesCRRServer, func() *BackupUsageSummariesCRRServerTransport { + return NewBackupUsageSummariesCRRServerTransport(&s.srv.BackupUsageSummariesCRRServer) + }) + resp, err = s.trBackupUsageSummariesCRRServer.Do(req) + case "CrossRegionRestoreClient": + initServer(s, &s.trCrossRegionRestoreServer, func() *CrossRegionRestoreServerTransport { + return NewCrossRegionRestoreServerTransport(&s.srv.CrossRegionRestoreServer) + }) + resp, err = s.trCrossRegionRestoreServer.Do(req) + case "CrrOperationResultsClient": + initServer(s, &s.trCrrOperationResultsServer, func() *CrrOperationResultsServerTransport { + return NewCrrOperationResultsServerTransport(&s.srv.CrrOperationResultsServer) + }) + resp, err = s.trCrrOperationResultsServer.Do(req) + case "CrrOperationStatusClient": + initServer(s, &s.trCrrOperationStatusServer, func() *CrrOperationStatusServerTransport { + return NewCrrOperationStatusServerTransport(&s.srv.CrrOperationStatusServer) + }) + resp, err = s.trCrrOperationStatusServer.Do(req) case "RecoveryPointsClient": initServer(s, &s.trRecoveryPointsServer, func() *RecoveryPointsServerTransport { return NewRecoveryPointsServerTransport(&s.srv.RecoveryPointsServer) }) resp, err = s.trRecoveryPointsServer.Do(req) - case "RecoveryPointsRecommendedForMoveClient": - initServer(s, &s.trRecoveryPointsRecommendedForMoveServer, func() *RecoveryPointsRecommendedForMoveServerTransport { - return NewRecoveryPointsRecommendedForMoveServerTransport(&s.srv.RecoveryPointsRecommendedForMoveServer) - }) - resp, err = s.trRecoveryPointsRecommendedForMoveServer.Do(req) - case "ResourceGuardProxiesClient": - initServer(s, &s.trResourceGuardProxiesServer, func() *ResourceGuardProxiesServerTransport { - return NewResourceGuardProxiesServerTransport(&s.srv.ResourceGuardProxiesServer) - }) - resp, err = s.trResourceGuardProxiesServer.Do(req) - case "ResourceGuardProxyClient": - initServer(s, &s.trResourceGuardProxyServer, func() *ResourceGuardProxyServerTransport { - return NewResourceGuardProxyServerTransport(&s.srv.ResourceGuardProxyServer) - }) - resp, err = s.trResourceGuardProxyServer.Do(req) - case "RestoresClient": - initServer(s, &s.trRestoresServer, func() *RestoresServerTransport { return NewRestoresServerTransport(&s.srv.RestoresServer) }) - resp, err = s.trRestoresServer.Do(req) - case "SecurityPINsClient": - initServer(s, &s.trSecurityPINsServer, func() *SecurityPINsServerTransport { return NewSecurityPINsServerTransport(&s.srv.SecurityPINsServer) }) - resp, err = s.trSecurityPINsServer.Do(req) - case "TieringCostOperationStatusClient": - initServer(s, &s.trTieringCostOperationStatusServer, func() *TieringCostOperationStatusServerTransport { - return NewTieringCostOperationStatusServerTransport(&s.srv.TieringCostOperationStatusServer) - }) - resp, err = s.trTieringCostOperationStatusServer.Do(req) - case "ValidateOperationClient": - initServer(s, &s.trValidateOperationServer, func() *ValidateOperationServerTransport { - return NewValidateOperationServerTransport(&s.srv.ValidateOperationServer) - }) - resp, err = s.trValidateOperationServer.Do(req) - case "ValidateOperationResultsClient": - initServer(s, &s.trValidateOperationResultsServer, func() *ValidateOperationResultsServerTransport { - return NewValidateOperationResultsServerTransport(&s.srv.ValidateOperationResultsServer) - }) - resp, err = s.trValidateOperationResultsServer.Do(req) - case "ValidateOperationStatusesClient": - initServer(s, &s.trValidateOperationStatusesServer, func() *ValidateOperationStatusesServerTransport { - return NewValidateOperationStatusesServerTransport(&s.srv.ValidateOperationStatusesServer) + case "RecoveryPointsCrrClient": + initServer(s, &s.trRecoveryPointsCrrServer, func() *RecoveryPointsCrrServerTransport { + return NewRecoveryPointsCrrServerTransport(&s.srv.RecoveryPointsCrrServer) }) - resp, err = s.trValidateOperationStatusesServer.Do(req) + resp, err = s.trRecoveryPointsCrrServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/tieringcostoperationstatus_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/tieringcostoperationstatus_server.go deleted file mode 100644 index b409c3298910..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/tieringcostoperationstatus_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// TieringCostOperationStatusServer is a fake server for instances of the armrecoveryservicesbackup.TieringCostOperationStatusClient type. -type TieringCostOperationStatusServer struct { - // Get is the fake for method TieringCostOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *armrecoveryservicesbackup.TieringCostOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.TieringCostOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewTieringCostOperationStatusServerTransport creates a new instance of TieringCostOperationStatusServerTransport with the provided implementation. -// The returned TieringCostOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesbackup.TieringCostOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTieringCostOperationStatusServerTransport(srv *TieringCostOperationStatusServer) *TieringCostOperationStatusServerTransport { - return &TieringCostOperationStatusServerTransport{srv: srv} -} - -// TieringCostOperationStatusServerTransport connects instances of armrecoveryservicesbackup.TieringCostOperationStatusClient to instances of TieringCostOperationStatusServer. -// Don't use this type directly, use NewTieringCostOperationStatusServerTransport instead. -type TieringCostOperationStatusServerTransport struct { - srv *TieringCostOperationStatusServer -} - -// Do implements the policy.Transporter interface for TieringCostOperationStatusServerTransport. -func (t *TieringCostOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TieringCostOperationStatusClient.Get": - resp, err = t.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TieringCostOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupTieringCost/default/operationsStatus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperation_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperation_server.go deleted file mode 100644 index 7d9f03013883..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperation_server.go +++ /dev/null @@ -1,119 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ValidateOperationServer is a fake server for instances of the armrecoveryservicesbackup.ValidateOperationClient type. -type ValidateOperationServer struct { - // BeginTrigger is the fake for method ValidateOperationClient.BeginTrigger - // HTTP status codes to indicate success: http.StatusAccepted - BeginTrigger func(ctx context.Context, vaultName string, resourceGroupName string, parameters armrecoveryservicesbackup.ValidateOperationRequestResource, options *armrecoveryservicesbackup.ValidateOperationClientBeginTriggerOptions) (resp azfake.PollerResponder[armrecoveryservicesbackup.ValidateOperationClientTriggerResponse], errResp azfake.ErrorResponder) -} - -// NewValidateOperationServerTransport creates a new instance of ValidateOperationServerTransport with the provided implementation. -// The returned ValidateOperationServerTransport instance is connected to an instance of armrecoveryservicesbackup.ValidateOperationClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewValidateOperationServerTransport(srv *ValidateOperationServer) *ValidateOperationServerTransport { - return &ValidateOperationServerTransport{ - srv: srv, - beginTrigger: newTracker[azfake.PollerResponder[armrecoveryservicesbackup.ValidateOperationClientTriggerResponse]](), - } -} - -// ValidateOperationServerTransport connects instances of armrecoveryservicesbackup.ValidateOperationClient to instances of ValidateOperationServer. -// Don't use this type directly, use NewValidateOperationServerTransport instead. -type ValidateOperationServerTransport struct { - srv *ValidateOperationServer - beginTrigger *tracker[azfake.PollerResponder[armrecoveryservicesbackup.ValidateOperationClientTriggerResponse]] -} - -// Do implements the policy.Transporter interface for ValidateOperationServerTransport. -func (v *ValidateOperationServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ValidateOperationClient.BeginTrigger": - resp, err = v.dispatchBeginTrigger(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *ValidateOperationServerTransport) dispatchBeginTrigger(req *http.Request) (*http.Response, error) { - if v.srv.BeginTrigger == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginTrigger not implemented")} - } - beginTrigger := v.beginTrigger.get(req) - if beginTrigger == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupTriggerValidateOperation` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesbackup.ValidateOperationRequestResource](req) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.BeginTrigger(req.Context(), vaultNameParam, resourceGroupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginTrigger = &respr - v.beginTrigger.add(req, beginTrigger) - } - - resp, err := server.PollerResponderNext(beginTrigger, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { - v.beginTrigger.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginTrigger) { - v.beginTrigger.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperationresults_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperationresults_server.go deleted file mode 100644 index f045a99e7d83..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperationresults_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ValidateOperationResultsServer is a fake server for instances of the armrecoveryservicesbackup.ValidateOperationResultsClient type. -type ValidateOperationResultsServer struct { - // Get is the fake for method ValidateOperationResultsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - Get func(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *armrecoveryservicesbackup.ValidateOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ValidateOperationResultsClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewValidateOperationResultsServerTransport creates a new instance of ValidateOperationResultsServerTransport with the provided implementation. -// The returned ValidateOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesbackup.ValidateOperationResultsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewValidateOperationResultsServerTransport(srv *ValidateOperationResultsServer) *ValidateOperationResultsServerTransport { - return &ValidateOperationResultsServerTransport{srv: srv} -} - -// ValidateOperationResultsServerTransport connects instances of armrecoveryservicesbackup.ValidateOperationResultsClient to instances of ValidateOperationResultsServer. -// Don't use this type directly, use NewValidateOperationResultsServerTransport instead. -type ValidateOperationResultsServerTransport struct { - srv *ValidateOperationResultsServer -} - -// Do implements the policy.Transporter interface for ValidateOperationResultsServerTransport. -func (v *ValidateOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ValidateOperationResultsClient.Get": - resp, err = v.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *ValidateOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if v.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupValidateOperationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ValidateOperationsResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperationstatuses_server.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperationstatuses_server.go deleted file mode 100644 index e7908ce72d91..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fake/validateoperationstatuses_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" - "net/http" - "net/url" - "regexp" -) - -// ValidateOperationStatusesServer is a fake server for instances of the armrecoveryservicesbackup.ValidateOperationStatusesClient type. -type ValidateOperationStatusesServer struct { - // Get is the fake for method ValidateOperationStatusesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *armrecoveryservicesbackup.ValidateOperationStatusesClientGetOptions) (resp azfake.Responder[armrecoveryservicesbackup.ValidateOperationStatusesClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewValidateOperationStatusesServerTransport creates a new instance of ValidateOperationStatusesServerTransport with the provided implementation. -// The returned ValidateOperationStatusesServerTransport instance is connected to an instance of armrecoveryservicesbackup.ValidateOperationStatusesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewValidateOperationStatusesServerTransport(srv *ValidateOperationStatusesServer) *ValidateOperationStatusesServerTransport { - return &ValidateOperationStatusesServerTransport{srv: srv} -} - -// ValidateOperationStatusesServerTransport connects instances of armrecoveryservicesbackup.ValidateOperationStatusesClient to instances of ValidateOperationStatusesServer. -// Don't use this type directly, use NewValidateOperationStatusesServerTransport instead. -type ValidateOperationStatusesServerTransport struct { - srv *ValidateOperationStatusesServer -} - -// Do implements the policy.Transporter interface for ValidateOperationStatusesServerTransport. -func (v *ValidateOperationStatusesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ValidateOperationStatusesClient.Get": - resp, err = v.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *ValidateOperationStatusesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if v.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RecoveryServices/vaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupValidateOperationsStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Get(req.Context(), vaultNameParam, resourceGroupNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/featuresupport_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/featuresupport_client.go deleted file mode 100644 index 524c4c854d83..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/featuresupport_client.go +++ /dev/null @@ -1,107 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// FeatureSupportClient contains the methods for the FeatureSupport group. -// Don't use this type directly, use NewFeatureSupportClient() instead. -type FeatureSupportClient struct { - internal *arm.Client - subscriptionID string -} - -// NewFeatureSupportClient creates a new instance of FeatureSupportClient 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 NewFeatureSupportClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FeatureSupportClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &FeatureSupportClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Validate - It will validate if given feature with resource properties is supported in service -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - azureRegion - Azure region to hit Api -// - parameters - Feature support request object -// - options - FeatureSupportClientValidateOptions contains the optional parameters for the FeatureSupportClient.Validate method. -func (client *FeatureSupportClient) Validate(ctx context.Context, azureRegion string, parameters FeatureSupportRequestClassification, options *FeatureSupportClientValidateOptions) (FeatureSupportClientValidateResponse, error) { - var err error - const operationName = "FeatureSupportClient.Validate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.validateCreateRequest(ctx, azureRegion, parameters, options) - if err != nil { - return FeatureSupportClientValidateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return FeatureSupportClientValidateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return FeatureSupportClientValidateResponse{}, err - } - resp, err := client.validateHandleResponse(httpResp) - return resp, err -} - -// validateCreateRequest creates the Validate request. -func (client *FeatureSupportClient) validateCreateRequest(ctx context.Context, azureRegion string, parameters FeatureSupportRequestClassification, options *FeatureSupportClientValidateOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures" - if azureRegion == "" { - return nil, errors.New("parameter azureRegion cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureRegion}", url.PathEscape(azureRegion)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// validateHandleResponse handles the Validate response. -func (client *FeatureSupportClient) validateHandleResponse(resp *http.Response) (FeatureSupportClientValidateResponse, error) { - result := FeatureSupportClientValidateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureVMResourceFeatureSupportResponse); err != nil { - return FeatureSupportClientValidateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/featuresupport_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/featuresupport_client_example_test.go deleted file mode 100644 index a91eb7464c18..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/featuresupport_client_example_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupFeature_Validate.json -func ExampleFeatureSupportClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFeatureSupportClient().Validate(ctx, "southeastasia", &armrecoveryservicesbackup.AzureVMResourceFeatureSupportRequest{ - FeatureType: to.Ptr("AzureVMResourceBackup"), - VMSize: to.Ptr("Basic_A0"), - VMSKU: to.Ptr("Premium"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureVMResourceFeatureSupportResponse = armrecoveryservicesbackup.AzureVMResourceFeatureSupportResponse{ - // SupportStatus: to.Ptr(armrecoveryservicesbackup.SupportStatusDefaultOFF), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fetchtieringcost_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fetchtieringcost_client.go deleted file mode 100644 index de173c3918f1..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fetchtieringcost_client.go +++ /dev/null @@ -1,126 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// FetchTieringCostClient contains the methods for the FetchTieringCost group. -// Don't use this type directly, use NewFetchTieringCostClient() instead. -type FetchTieringCostClient struct { - internal *arm.Client - subscriptionID string -} - -// NewFetchTieringCostClient creates a new instance of FetchTieringCostClient 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 NewFetchTieringCostClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FetchTieringCostClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &FetchTieringCostClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginPost - Provides the details of the tiering related sizes and cost. Status of the operation can be fetched using GetTieringCostOperationStatus -// API and result using GetTieringCostOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - vaultName - The name of the recovery services vault. -// - parameters - Fetch Tiering Cost Request -// - options - FetchTieringCostClientBeginPostOptions contains the optional parameters for the FetchTieringCostClient.BeginPost -// method. -func (client *FetchTieringCostClient) BeginPost(ctx context.Context, resourceGroupName string, vaultName string, parameters FetchTieringCostInfoRequestClassification, options *FetchTieringCostClientBeginPostOptions) (*runtime.Poller[FetchTieringCostClientPostResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.post(ctx, resourceGroupName, vaultName, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FetchTieringCostClientPostResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FetchTieringCostClientPostResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Post - Provides the details of the tiering related sizes and cost. Status of the operation can be fetched using GetTieringCostOperationStatus -// API and result using GetTieringCostOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *FetchTieringCostClient) post(ctx context.Context, resourceGroupName string, vaultName string, parameters FetchTieringCostInfoRequestClassification, options *FetchTieringCostClientBeginPostOptions) (*http.Response, error) { - var err error - const operationName = "FetchTieringCostClient.BeginPost" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.postCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// postCreateRequest creates the Post request. -func (client *FetchTieringCostClient) postCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, parameters FetchTieringCostInfoRequestClassification, options *FetchTieringCostClientBeginPostOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTieringCost/default/fetchTieringCost" - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fetchtieringcost_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fetchtieringcost_client_example_test.go deleted file mode 100644 index 5508cd1325d4..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/fetchtieringcost_client_example_test.go +++ /dev/null @@ -1,172 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForRehydrate.json -func ExampleFetchTieringCostClient_BeginPost_getTheRehydrationCostForRecoveryPoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFetchTieringCostClient().BeginPost(ctx, "netsdktestrg", "testVault", &armrecoveryservicesbackup.FetchTieringCostInfoForRehydrationRequest{ - ObjectType: to.Ptr("FetchTieringCostInfoForRehydrationRequest"), - SourceTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeArchivedRP), - TargetTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - ContainerName: to.Ptr("IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - ProtectedItemName: to.Ptr("VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - RecoveryPointID: to.Ptr("1222343434"), - RehydrationPriority: to.Ptr(armrecoveryservicesbackup.RehydrationPriorityHigh), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armrecoveryservicesbackup.FetchTieringCostClientPostResponse{ - // TieringCostInfoClassification: &armrecoveryservicesbackup.TieringCostRehydrationInfo{ - // ObjectType: to.Ptr("TieringCostRehydrationInfo"), - // RehydrationSizeInBytes: to.Ptr[int64](1204000), - // RetailRehydrationCostPerGBPerMonth: to.Ptr[float64](0.02), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForPolicy.json -func ExampleFetchTieringCostClient_BeginPost_getTheTieringSavingsCostInfoForPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFetchTieringCostClient().BeginPost(ctx, "netsdktestrg", "testVault", &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForPolicyRequest{ - ObjectType: to.Ptr("FetchTieringCostSavingsInfoForPolicyRequest"), - SourceTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - TargetTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeArchivedRP), - PolicyName: to.Ptr("monthly"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armrecoveryservicesbackup.FetchTieringCostClientPostResponse{ - // TieringCostInfoClassification: &armrecoveryservicesbackup.TieringCostSavingInfo{ - // ObjectType: to.Ptr("TieringCostSavingInfo"), - // RetailSourceTierCostPerGBPerMonth: to.Ptr[float64](0.02), - // RetailTargetTierCostPerGBPerMonth: to.Ptr[float64](0.003), - // SourceTierSizeReductionInBytes: to.Ptr[int64](1204000), - // TargetTierSizeIncreaseInBytes: to.Ptr[int64](1892), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForProtectedItem.json -func ExampleFetchTieringCostClient_BeginPost_getTheTieringSavingsCostInfoForProtectedItem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFetchTieringCostClient().BeginPost(ctx, "netsdktestrg", "testVault", &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForProtectedItemRequest{ - ObjectType: to.Ptr("FetchTieringCostSavingsInfoForProtectedItemRequest"), - SourceTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - TargetTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeArchivedRP), - ContainerName: to.Ptr("IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - ProtectedItemName: to.Ptr("VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armrecoveryservicesbackup.FetchTieringCostClientPostResponse{ - // TieringCostInfoClassification: &armrecoveryservicesbackup.TieringCostSavingInfo{ - // ObjectType: to.Ptr("TieringCostSavingInfo"), - // RetailSourceTierCostPerGBPerMonth: to.Ptr[float64](0.02), - // RetailTargetTierCostPerGBPerMonth: to.Ptr[float64](0.003), - // SourceTierSizeReductionInBytes: to.Ptr[int64](1204000), - // TargetTierSizeIncreaseInBytes: to.Ptr[int64](1892), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForVault.json -func ExampleFetchTieringCostClient_BeginPost_getTheTieringSavingsCostInfoForVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFetchTieringCostClient().BeginPost(ctx, "netsdktestrg", "testVault", &armrecoveryservicesbackup.FetchTieringCostSavingsInfoForVaultRequest{ - ObjectType: to.Ptr("FetchTieringCostSavingsInfoForVaultRequest"), - SourceTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - TargetTierType: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeArchivedRP), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armrecoveryservicesbackup.FetchTieringCostClientPostResponse{ - // TieringCostInfoClassification: &armrecoveryservicesbackup.TieringCostSavingInfo{ - // ObjectType: to.Ptr("TieringCostSavingInfo"), - // RetailSourceTierCostPerGBPerMonth: to.Ptr[float64](0.02), - // RetailTargetTierCostPerGBPerMonth: to.Ptr[float64](0.003), - // SourceTierSizeReductionInBytes: to.Ptr[int64](1204000), - // TargetTierSizeIncreaseInBytes: to.Ptr[int64](1892), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/gettieringcostoperationresult_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/gettieringcostoperationresult_client.go deleted file mode 100644 index 6ab9f54a5a27..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/gettieringcostoperationresult_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// GetTieringCostOperationResultClient contains the methods for the GetTieringCostOperationResult group. -// Don't use this type directly, use NewGetTieringCostOperationResultClient() instead. -type GetTieringCostOperationResultClient struct { - internal *arm.Client - subscriptionID string -} - -// NewGetTieringCostOperationResultClient creates a new instance of GetTieringCostOperationResultClient 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 NewGetTieringCostOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GetTieringCostOperationResultClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GetTieringCostOperationResultClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets the result of async operation for tiering cost -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - vaultName - The name of the recovery services vault. -// - options - GetTieringCostOperationResultClientGetOptions contains the optional parameters for the GetTieringCostOperationResultClient.Get -// method. -func (client *GetTieringCostOperationResultClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *GetTieringCostOperationResultClientGetOptions) (GetTieringCostOperationResultClientGetResponse, error) { - var err error - const operationName = "GetTieringCostOperationResultClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) - if err != nil { - return GetTieringCostOperationResultClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GetTieringCostOperationResultClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GetTieringCostOperationResultClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GetTieringCostOperationResultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *GetTieringCostOperationResultClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTieringCost/default/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 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GetTieringCostOperationResultClient) getHandleResponse(resp *http.Response) (GetTieringCostOperationResultClientGetResponse, error) { - result := GetTieringCostOperationResultClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return GetTieringCostOperationResultClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/gettieringcostoperationresult_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/gettieringcostoperationresult_client_example_test.go deleted file mode 100644 index 644d09c16676..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/gettieringcostoperationresult_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/GetTieringCostOperationResult.json -func ExampleGetTieringCostOperationResultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGetTieringCostOperationResultClient().Get(ctx, "gaallaRG", "gaallavaultbvtd2msi", "0f48183b-0a44-4dca-aec1-bba5daab888a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armrecoveryservicesbackup.GetTieringCostOperationResultClientGetResponse{ - // TieringCostInfoClassification: &armrecoveryservicesbackup.TieringCostSavingInfo{ - // ObjectType: to.Ptr("TieringCostSavingInfo"), - // RetailSourceTierCostPerGBPerMonth: to.Ptr[float64](0.02), - // RetailTargetTierCostPerGBPerMonth: to.Ptr[float64](0.003), - // SourceTierSizeReductionInBytes: to.Ptr[int64](1204000), - // TargetTierSizeIncreaseInBytes: to.Ptr[int64](1892), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.mod b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.mod index bf4cb1e47cb0..8c7ca4d7f8ac 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.mod +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v5 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.31.0 // indirect golang.org/x/net v0.32.0 // indirect - golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect ) diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.sum b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.sum index 5a15625c8c87..147da7454bac 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.sum +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/go.sum @@ -1,35 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 h1:B/dfvscEQtew9dVuoxqxrUKKv8Ih2f55PydknDamU+g= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0/go.mod h1:fiPSssYvltE08HJchL04dOy+RD4hgrjph0cwGGMntdI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.0 h1:+m0M/LFxN43KvULkDNfdXOgrjtg6UYJPFBJyuEcRCAw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 h1:kYRSnvJju5gYVyhkij+RTJ/VR6QIUaCfWeaFm2ycsjQ= -github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -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/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/interfaces.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/interfaces.go index 4edd1b3d3239..db704d693184 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/interfaces.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/interfaces.go @@ -18,70 +18,17 @@ type AzureIaaSVMProtectedItemClassification interface { GetAzureIaaSVMProtectedItem() *AzureIaaSVMProtectedItem } -// AzureRecoveryServiceVaultProtectionIntentClassification provides polymorphic access to related types. -// Call the interface's GetAzureRecoveryServiceVaultProtectionIntent() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureRecoveryServiceVaultProtectionIntent, *AzureWorkloadAutoProtectionIntent, *AzureWorkloadSQLAutoProtectionIntent -type AzureRecoveryServiceVaultProtectionIntentClassification interface { - ProtectionIntentClassification - // GetAzureRecoveryServiceVaultProtectionIntent returns the AzureRecoveryServiceVaultProtectionIntent content of the underlying type. - GetAzureRecoveryServiceVaultProtectionIntent() *AzureRecoveryServiceVaultProtectionIntent -} - -// AzureVMWorkloadItemClassification provides polymorphic access to related types. -// Call the interface's GetAzureVMWorkloadItem() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureVMWorkloadItem, *AzureVMWorkloadSAPAseDatabaseWorkloadItem, *AzureVMWorkloadSAPAseSystemWorkloadItem, *AzureVMWorkloadSAPHanaDatabaseWorkloadItem, -// - *AzureVMWorkloadSAPHanaSystemWorkloadItem, *AzureVMWorkloadSQLDatabaseWorkloadItem, *AzureVMWorkloadSQLInstanceWorkloadItem -type AzureVMWorkloadItemClassification interface { - WorkloadItemClassification - // GetAzureVMWorkloadItem returns the AzureVMWorkloadItem content of the underlying type. - GetAzureVMWorkloadItem() *AzureVMWorkloadItem -} - -// AzureVMWorkloadProtectableItemClassification provides polymorphic access to related types. -// Call the interface's GetAzureVMWorkloadProtectableItem() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureVMWorkloadProtectableItem, *AzureVMWorkloadSAPAseSystemProtectableItem, *AzureVMWorkloadSAPHanaDBInstance, *AzureVMWorkloadSAPHanaDatabaseProtectableItem, -// - *AzureVMWorkloadSAPHanaHSRProtectableItem, *AzureVMWorkloadSAPHanaSystemProtectableItem, *AzureVMWorkloadSQLAvailabilityGroupProtectableItem, -// - *AzureVMWorkloadSQLDatabaseProtectableItem, *AzureVMWorkloadSQLInstanceProtectableItem -type AzureVMWorkloadProtectableItemClassification interface { - WorkloadProtectableItemClassification - // GetAzureVMWorkloadProtectableItem returns the AzureVMWorkloadProtectableItem content of the underlying type. - GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem -} - // AzureVMWorkloadProtectedItemClassification provides polymorphic access to related types. // Call the interface's GetAzureVMWorkloadProtectedItem() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AzureVMWorkloadProtectedItem, *AzureVMWorkloadSAPAseDatabaseProtectedItem, *AzureVMWorkloadSAPHanaDBInstanceProtectedItem, -// - *AzureVMWorkloadSAPHanaDatabaseProtectedItem, *AzureVMWorkloadSQLDatabaseProtectedItem +// - *AzureVMWorkloadProtectedItem, *AzureVMWorkloadSAPAseDatabaseProtectedItem, *AzureVMWorkloadSAPHanaDatabaseProtectedItem, +// - *AzureVMWorkloadSQLDatabaseProtectedItem type AzureVMWorkloadProtectedItemClassification interface { ProtectedItemClassification // GetAzureVMWorkloadProtectedItem returns the AzureVMWorkloadProtectedItem content of the underlying type. GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem } -// AzureWorkloadAutoProtectionIntentClassification provides polymorphic access to related types. -// Call the interface's GetAzureWorkloadAutoProtectionIntent() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureWorkloadAutoProtectionIntent, *AzureWorkloadSQLAutoProtectionIntent -type AzureWorkloadAutoProtectionIntentClassification interface { - AzureRecoveryServiceVaultProtectionIntentClassification - // GetAzureWorkloadAutoProtectionIntent returns the AzureWorkloadAutoProtectionIntent content of the underlying type. - GetAzureWorkloadAutoProtectionIntent() *AzureWorkloadAutoProtectionIntent -} - -// AzureWorkloadContainerClassification provides polymorphic access to related types. -// Call the interface's GetAzureWorkloadContainer() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureSQLAGWorkloadContainerProtectionContainer, *AzureVMAppContainerProtectionContainer, *AzureWorkloadContainer -type AzureWorkloadContainerClassification interface { - ProtectionContainerClassification - // GetAzureWorkloadContainer returns the AzureWorkloadContainer content of the underlying type. - GetAzureWorkloadContainer() *AzureWorkloadContainer -} - // AzureWorkloadPointInTimeRecoveryPointClassification provides polymorphic access to related types. // Call the interface's GetAzureWorkloadPointInTimeRecoveryPoint() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -107,46 +54,23 @@ type AzureWorkloadRecoveryPointClassification interface { // Call the interface's GetAzureWorkloadRestoreRequest() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: // - *AzureWorkloadPointInTimeRestoreRequest, *AzureWorkloadRestoreRequest, *AzureWorkloadSAPHanaPointInTimeRestoreRequest, -// - *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest, *AzureWorkloadSAPHanaRestoreRequest, *AzureWorkloadSAPHanaRestoreWithRehydrateRequest, -// - *AzureWorkloadSQLPointInTimeRestoreRequest, *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest, *AzureWorkloadSQLRestoreRequest, -// - *AzureWorkloadSQLRestoreWithRehydrateRequest +// - *AzureWorkloadSAPHanaRestoreRequest, *AzureWorkloadSQLPointInTimeRestoreRequest, *AzureWorkloadSQLRestoreRequest type AzureWorkloadRestoreRequestClassification interface { RestoreRequestClassification // GetAzureWorkloadRestoreRequest returns the AzureWorkloadRestoreRequest content of the underlying type. GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest } -// AzureWorkloadSAPHanaPointInTimeRestoreRequestClassification provides polymorphic access to related types. -// Call the interface's GetAzureWorkloadSAPHanaPointInTimeRestoreRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureWorkloadSAPHanaPointInTimeRestoreRequest, *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest -type AzureWorkloadSAPHanaPointInTimeRestoreRequestClassification interface { - AzureWorkloadSAPHanaRestoreRequestClassification - // GetAzureWorkloadSAPHanaPointInTimeRestoreRequest returns the AzureWorkloadSAPHanaPointInTimeRestoreRequest content of the underlying type. - GetAzureWorkloadSAPHanaPointInTimeRestoreRequest() *AzureWorkloadSAPHanaPointInTimeRestoreRequest -} - // AzureWorkloadSAPHanaRestoreRequestClassification provides polymorphic access to related types. // Call the interface's GetAzureWorkloadSAPHanaRestoreRequest() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AzureWorkloadSAPHanaPointInTimeRestoreRequest, *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest, *AzureWorkloadSAPHanaRestoreRequest, -// - *AzureWorkloadSAPHanaRestoreWithRehydrateRequest +// - *AzureWorkloadSAPHanaPointInTimeRestoreRequest, *AzureWorkloadSAPHanaRestoreRequest type AzureWorkloadSAPHanaRestoreRequestClassification interface { AzureWorkloadRestoreRequestClassification // GetAzureWorkloadSAPHanaRestoreRequest returns the AzureWorkloadSAPHanaRestoreRequest content of the underlying type. GetAzureWorkloadSAPHanaRestoreRequest() *AzureWorkloadSAPHanaRestoreRequest } -// AzureWorkloadSQLPointInTimeRestoreRequestClassification provides polymorphic access to related types. -// Call the interface's GetAzureWorkloadSQLPointInTimeRestoreRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureWorkloadSQLPointInTimeRestoreRequest, *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest -type AzureWorkloadSQLPointInTimeRestoreRequestClassification interface { - AzureWorkloadSQLRestoreRequestClassification - // GetAzureWorkloadSQLPointInTimeRestoreRequest returns the AzureWorkloadSQLPointInTimeRestoreRequest content of the underlying type. - GetAzureWorkloadSQLPointInTimeRestoreRequest() *AzureWorkloadSQLPointInTimeRestoreRequest -} - // AzureWorkloadSQLRecoveryPointClassification provides polymorphic access to related types. // Call the interface's GetAzureWorkloadSQLRecoveryPoint() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -160,180 +84,52 @@ type AzureWorkloadSQLRecoveryPointClassification interface { // AzureWorkloadSQLRestoreRequestClassification provides polymorphic access to related types. // Call the interface's GetAzureWorkloadSQLRestoreRequest() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AzureWorkloadSQLPointInTimeRestoreRequest, *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest, *AzureWorkloadSQLRestoreRequest, -// - *AzureWorkloadSQLRestoreWithRehydrateRequest +// - *AzureWorkloadSQLPointInTimeRestoreRequest, *AzureWorkloadSQLRestoreRequest type AzureWorkloadSQLRestoreRequestClassification interface { AzureWorkloadRestoreRequestClassification // GetAzureWorkloadSQLRestoreRequest returns the AzureWorkloadSQLRestoreRequest content of the underlying type. GetAzureWorkloadSQLRestoreRequest() *AzureWorkloadSQLRestoreRequest } -// BackupEngineBaseClassification provides polymorphic access to related types. -// Call the interface's GetBackupEngineBase() method to access the common type. +// CrrAccessTokenClassification provides polymorphic access to related types. +// Call the interface's GetCrrAccessToken() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupServerEngine, *BackupEngineBase, *DpmBackupEngine -type BackupEngineBaseClassification interface { - // GetBackupEngineBase returns the BackupEngineBase content of the underlying type. - GetBackupEngineBase() *BackupEngineBase -} - -// BackupRequestClassification provides polymorphic access to related types. -// Call the interface's GetBackupRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureFileShareBackupRequest, *AzureWorkloadBackupRequest, *BackupRequest, *IaasVMBackupRequest -type BackupRequestClassification interface { - // GetBackupRequest returns the BackupRequest content of the underlying type. - GetBackupRequest() *BackupRequest -} - -// DpmContainerClassification provides polymorphic access to related types. -// Call the interface's GetDpmContainer() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupServerContainer, *DpmContainer -type DpmContainerClassification interface { - ProtectionContainerClassification - // GetDpmContainer returns the DpmContainer content of the underlying type. - GetDpmContainer() *DpmContainer -} - -// FeatureSupportRequestClassification provides polymorphic access to related types. -// Call the interface's GetFeatureSupportRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupGoalFeatureSupportRequest, *AzureVMResourceFeatureSupportRequest, *FeatureSupportRequest -type FeatureSupportRequestClassification interface { - // GetFeatureSupportRequest returns the FeatureSupportRequest content of the underlying type. - GetFeatureSupportRequest() *FeatureSupportRequest -} - -// FetchTieringCostInfoRequestClassification provides polymorphic access to related types. -// Call the interface's GetFetchTieringCostInfoRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *FetchTieringCostInfoForRehydrationRequest, *FetchTieringCostInfoRequest, *FetchTieringCostSavingsInfoForPolicyRequest, -// - *FetchTieringCostSavingsInfoForProtectedItemRequest, *FetchTieringCostSavingsInfoForVaultRequest -type FetchTieringCostInfoRequestClassification interface { - // GetFetchTieringCostInfoRequest returns the FetchTieringCostInfoRequest content of the underlying type. - GetFetchTieringCostInfoRequest() *FetchTieringCostInfoRequest -} - -// ILRRequestClassification provides polymorphic access to related types. -// Call the interface's GetILRRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureFileShareProvisionILRRequest, *ILRRequest, *IaasVMILRRegistrationRequest -type ILRRequestClassification interface { - // GetILRRequest returns the ILRRequest content of the underlying type. - GetILRRequest() *ILRRequest -} - -// IaaSVMContainerClassification provides polymorphic access to related types. -// Call the interface's GetIaaSVMContainer() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureIaaSClassicComputeVMContainer, *AzureIaaSComputeVMContainer, *IaaSVMContainer -type IaaSVMContainerClassification interface { - ProtectionContainerClassification - // GetIaaSVMContainer returns the IaaSVMContainer content of the underlying type. - GetIaaSVMContainer() *IaaSVMContainer -} - -// IaaSVMProtectableItemClassification provides polymorphic access to related types. -// Call the interface's GetIaaSVMProtectableItem() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureIaaSClassicComputeVMProtectableItem, *AzureIaaSComputeVMProtectableItem, *IaaSVMProtectableItem -type IaaSVMProtectableItemClassification interface { - WorkloadProtectableItemClassification - // GetIaaSVMProtectableItem returns the IaaSVMProtectableItem content of the underlying type. - GetIaaSVMProtectableItem() *IaaSVMProtectableItem -} - -// IaasVMRestoreRequestClassification provides polymorphic access to related types. -// Call the interface's GetIaasVMRestoreRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *IaasVMRestoreRequest, *IaasVMRestoreWithRehydrationRequest -type IaasVMRestoreRequestClassification interface { - RestoreRequestClassification - // GetIaasVMRestoreRequest returns the IaasVMRestoreRequest content of the underlying type. - GetIaasVMRestoreRequest() *IaasVMRestoreRequest +// - *CrrAccessToken, *WorkloadCrrAccessToken +type CrrAccessTokenClassification interface { + // GetCrrAccessToken returns the CrrAccessToken content of the underlying type. + GetCrrAccessToken() *CrrAccessToken } // JobClassification provides polymorphic access to related types. // Call the interface's GetJob() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AzureIaaSVMJob, *AzureIaaSVMJobV2, *AzureStorageJob, *AzureWorkloadJob, *DpmJob, *Job, *MabJob, *VaultJob +// - *AzureIaaSVMJob, *AzureStorageJob, *AzureWorkloadJob, *DpmJob, *Job, *MabJob type JobClassification interface { // GetJob returns the Job content of the underlying type. GetJob() *Job } -// OperationResultInfoBaseClassification provides polymorphic access to related types. -// Call the interface's GetOperationResultInfoBase() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ExportJobsOperationResultInfo, *OperationResultInfo, *OperationResultInfoBase -type OperationResultInfoBaseClassification interface { - // GetOperationResultInfoBase returns the OperationResultInfoBase content of the underlying type. - GetOperationResultInfoBase() *OperationResultInfoBase -} - // OperationStatusExtendedInfoClassification provides polymorphic access to related types. // Call the interface's GetOperationStatusExtendedInfo() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: // - *OperationStatusExtendedInfo, *OperationStatusJobExtendedInfo, *OperationStatusJobsExtendedInfo, *OperationStatusProvisionILRExtendedInfo, -// - *OperationStatusValidateOperationExtendedInfo +// - *OperationStatusRecoveryPointExtendedInfo type OperationStatusExtendedInfoClassification interface { // GetOperationStatusExtendedInfo returns the OperationStatusExtendedInfo content of the underlying type. GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo } -// ProtectableContainerClassification provides polymorphic access to related types. -// Call the interface's GetProtectableContainer() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureStorageProtectableContainer, *AzureVMAppContainerProtectableContainer, *ProtectableContainer -type ProtectableContainerClassification interface { - // GetProtectableContainer returns the ProtectableContainer content of the underlying type. - GetProtectableContainer() *ProtectableContainer -} - // ProtectedItemClassification provides polymorphic access to related types. // Call the interface's GetProtectedItem() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: // - *AzureFileshareProtectedItem, *AzureIaaSClassicComputeVMProtectedItem, *AzureIaaSComputeVMProtectedItem, *AzureIaaSVMProtectedItem, -// - *AzureSQLProtectedItem, *AzureVMWorkloadProtectedItem, *AzureVMWorkloadSAPAseDatabaseProtectedItem, *AzureVMWorkloadSAPHanaDBInstanceProtectedItem, -// - *AzureVMWorkloadSAPHanaDatabaseProtectedItem, *AzureVMWorkloadSQLDatabaseProtectedItem, *DPMProtectedItem, *GenericProtectedItem, -// - *MabFileFolderProtectedItem, *ProtectedItem +// - *AzureSQLProtectedItem, *AzureVMWorkloadProtectedItem, *AzureVMWorkloadSAPAseDatabaseProtectedItem, *AzureVMWorkloadSAPHanaDatabaseProtectedItem, +// - *AzureVMWorkloadSQLDatabaseProtectedItem, *DPMProtectedItem, *GenericProtectedItem, *MabFileFolderProtectedItem, *ProtectedItem type ProtectedItemClassification interface { // GetProtectedItem returns the ProtectedItem content of the underlying type. GetProtectedItem() *ProtectedItem } -// ProtectionContainerClassification provides polymorphic access to related types. -// Call the interface's GetProtectionContainer() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupServerContainer, *AzureIaaSClassicComputeVMContainer, *AzureIaaSComputeVMContainer, *AzureSQLAGWorkloadContainerProtectionContainer, -// - *AzureSQLContainer, *AzureStorageContainer, *AzureVMAppContainerProtectionContainer, *AzureWorkloadContainer, *DpmContainer, -// - *GenericContainer, *IaaSVMContainer, *MabContainer, *ProtectionContainer -type ProtectionContainerClassification interface { - // GetProtectionContainer returns the ProtectionContainer content of the underlying type. - GetProtectionContainer() *ProtectionContainer -} - -// ProtectionIntentClassification provides polymorphic access to related types. -// Call the interface's GetProtectionIntent() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureRecoveryServiceVaultProtectionIntent, *AzureResourceProtectionIntent, *AzureWorkloadAutoProtectionIntent, *AzureWorkloadContainerAutoProtectionIntent, -// - *AzureWorkloadSQLAutoProtectionIntent, *ProtectionIntent -type ProtectionIntentClassification interface { - // GetProtectionIntent returns the ProtectionIntent content of the underlying type. - GetProtectionIntent() *ProtectionIntent -} - -// ProtectionPolicyClassification provides polymorphic access to related types. -// Call the interface's GetProtectionPolicy() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureFileShareProtectionPolicy, *AzureIaaSVMProtectionPolicy, *AzureSQLProtectionPolicy, *AzureVMWorkloadProtectionPolicy, -// - *GenericProtectionPolicy, *MabProtectionPolicy, *ProtectionPolicy -type ProtectionPolicyClassification interface { - // GetProtectionPolicy returns the ProtectionPolicy content of the underlying type. - GetProtectionPolicy() *ProtectionPolicy -} - // RecoveryPointClassification provides polymorphic access to related types. // Call the interface's GetRecoveryPoint() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -349,88 +145,9 @@ type RecoveryPointClassification interface { // Call the interface's GetRestoreRequest() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: // - *AzureFileShareRestoreRequest, *AzureWorkloadPointInTimeRestoreRequest, *AzureWorkloadRestoreRequest, *AzureWorkloadSAPHanaPointInTimeRestoreRequest, -// - *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest, *AzureWorkloadSAPHanaRestoreRequest, *AzureWorkloadSAPHanaRestoreWithRehydrateRequest, -// - *AzureWorkloadSQLPointInTimeRestoreRequest, *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest, *AzureWorkloadSQLRestoreRequest, -// - *AzureWorkloadSQLRestoreWithRehydrateRequest, *IaasVMRestoreRequest, *IaasVMRestoreWithRehydrationRequest, *RestoreRequest +// - *AzureWorkloadSAPHanaRestoreRequest, *AzureWorkloadSQLPointInTimeRestoreRequest, *AzureWorkloadSQLRestoreRequest, *IaasVMRestoreRequest, +// - *RestoreRequest type RestoreRequestClassification interface { // GetRestoreRequest returns the RestoreRequest content of the underlying type. GetRestoreRequest() *RestoreRequest } - -// RetentionPolicyClassification provides polymorphic access to related types. -// Call the interface's GetRetentionPolicy() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *LongTermRetentionPolicy, *RetentionPolicy, *SimpleRetentionPolicy -type RetentionPolicyClassification interface { - // GetRetentionPolicy returns the RetentionPolicy content of the underlying type. - GetRetentionPolicy() *RetentionPolicy -} - -// SchedulePolicyClassification provides polymorphic access to related types. -// Call the interface's GetSchedulePolicy() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *LogSchedulePolicy, *LongTermSchedulePolicy, *SchedulePolicy, *SimpleSchedulePolicy, *SimpleSchedulePolicyV2 -type SchedulePolicyClassification interface { - // GetSchedulePolicy returns the SchedulePolicy content of the underlying type. - GetSchedulePolicy() *SchedulePolicy -} - -// TieringCostInfoClassification provides polymorphic access to related types. -// Call the interface's GetTieringCostInfo() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *TieringCostInfo, *TieringCostRehydrationInfo, *TieringCostSavingInfo -type TieringCostInfoClassification interface { - // GetTieringCostInfo returns the TieringCostInfo content of the underlying type. - GetTieringCostInfo() *TieringCostInfo -} - -// ValidateOperationRequestClassification provides polymorphic access to related types. -// Call the interface's GetValidateOperationRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ValidateIaasVMRestoreOperationRequest, *ValidateOperationRequest, *ValidateRestoreOperationRequest -type ValidateOperationRequestClassification interface { - // GetValidateOperationRequest returns the ValidateOperationRequest content of the underlying type. - GetValidateOperationRequest() *ValidateOperationRequest -} - -// ValidateRestoreOperationRequestClassification provides polymorphic access to related types. -// Call the interface's GetValidateRestoreOperationRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ValidateIaasVMRestoreOperationRequest, *ValidateRestoreOperationRequest -type ValidateRestoreOperationRequestClassification interface { - ValidateOperationRequestClassification - // GetValidateRestoreOperationRequest returns the ValidateRestoreOperationRequest content of the underlying type. - GetValidateRestoreOperationRequest() *ValidateRestoreOperationRequest -} - -// VaultStorageConfigOperationResultResponseClassification provides polymorphic access to related types. -// Call the interface's GetVaultStorageConfigOperationResultResponse() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *PrepareDataMoveResponse, *VaultStorageConfigOperationResultResponse -type VaultStorageConfigOperationResultResponseClassification interface { - // GetVaultStorageConfigOperationResultResponse returns the VaultStorageConfigOperationResultResponse content of the underlying type. - GetVaultStorageConfigOperationResultResponse() *VaultStorageConfigOperationResultResponse -} - -// WorkloadItemClassification provides polymorphic access to related types. -// Call the interface's GetWorkloadItem() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureVMWorkloadItem, *AzureVMWorkloadSAPAseDatabaseWorkloadItem, *AzureVMWorkloadSAPAseSystemWorkloadItem, *AzureVMWorkloadSAPHanaDatabaseWorkloadItem, -// - *AzureVMWorkloadSAPHanaSystemWorkloadItem, *AzureVMWorkloadSQLDatabaseWorkloadItem, *AzureVMWorkloadSQLInstanceWorkloadItem, -// - *WorkloadItem -type WorkloadItemClassification interface { - // GetWorkloadItem returns the WorkloadItem content of the underlying type. - GetWorkloadItem() *WorkloadItem -} - -// WorkloadProtectableItemClassification provides polymorphic access to related types. -// Call the interface's GetWorkloadProtectableItem() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureFileShareProtectableItem, *AzureIaaSClassicComputeVMProtectableItem, *AzureIaaSComputeVMProtectableItem, *AzureVMWorkloadProtectableItem, -// - *AzureVMWorkloadSAPAseSystemProtectableItem, *AzureVMWorkloadSAPHanaDBInstance, *AzureVMWorkloadSAPHanaDatabaseProtectableItem, -// - *AzureVMWorkloadSAPHanaHSRProtectableItem, *AzureVMWorkloadSAPHanaSystemProtectableItem, *AzureVMWorkloadSQLAvailabilityGroupProtectableItem, -// - *AzureVMWorkloadSQLDatabaseProtectableItem, *AzureVMWorkloadSQLInstanceProtectableItem, *IaaSVMProtectableItem, *WorkloadProtectableItem -type WorkloadProtectableItemClassification interface { - // GetWorkloadProtectableItem returns the WorkloadProtectableItem content of the underlying type. - GetWorkloadProtectableItem() *WorkloadProtectableItem -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/itemlevelrecoveryconnections_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/itemlevelrecoveryconnections_client.go deleted file mode 100644 index 66b145ab2c6f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/itemlevelrecoveryconnections_client.go +++ /dev/null @@ -1,203 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ItemLevelRecoveryConnectionsClient contains the methods for the ItemLevelRecoveryConnections group. -// Don't use this type directly, use NewItemLevelRecoveryConnectionsClient() instead. -type ItemLevelRecoveryConnectionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewItemLevelRecoveryConnectionsClient creates a new instance of ItemLevelRecoveryConnectionsClient 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 NewItemLevelRecoveryConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ItemLevelRecoveryConnectionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ItemLevelRecoveryConnectionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Provision - Provisions a script which invokes an iSCSI connection to the backup data. Executing this script opens a file -// explorer displaying all the recoverable files and folders. This is an asynchronous -// operation. To know the status of provisioning, call GetProtectedItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backed up items. -// - containerName - Container name associated with the backed up items. -// - protectedItemName - Backed up item name whose files/folders are to be restored. -// - recoveryPointID - Recovery point ID which represents backed up data. iSCSI connection will be provisioned for this backed -// up data. -// - parameters - resource ILR request -// - options - ItemLevelRecoveryConnectionsClientProvisionOptions contains the optional parameters for the ItemLevelRecoveryConnectionsClient.Provision -// method. -func (client *ItemLevelRecoveryConnectionsClient) Provision(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters ILRRequestResource, options *ItemLevelRecoveryConnectionsClientProvisionOptions) (ItemLevelRecoveryConnectionsClientProvisionResponse, error) { - var err error - const operationName = "ItemLevelRecoveryConnectionsClient.Provision" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.provisionCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters, options) - if err != nil { - return ItemLevelRecoveryConnectionsClientProvisionResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ItemLevelRecoveryConnectionsClientProvisionResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ItemLevelRecoveryConnectionsClientProvisionResponse{}, err - } - return ItemLevelRecoveryConnectionsClientProvisionResponse{}, nil -} - -// provisionCreateRequest creates the Provision request. -func (client *ItemLevelRecoveryConnectionsClient) provisionCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters ILRRequestResource, options *ItemLevelRecoveryConnectionsClientProvisionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - if recoveryPointID == "" { - return nil, errors.New("parameter recoveryPointID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{recoveryPointId}", url.PathEscape(recoveryPointID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// Revoke - Revokes an iSCSI connection which can be used to download a script. Executing this script opens a file explorer -// displaying all recoverable files and folders. This is an asynchronous operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backed up items. -// - containerName - Container name associated with the backed up items. -// - protectedItemName - Backed up item name whose files/folders are to be restored. -// - recoveryPointID - Recovery point ID which represents backed up data. iSCSI connection will be revoked for this backed up -// data. -// - options - ItemLevelRecoveryConnectionsClientRevokeOptions contains the optional parameters for the ItemLevelRecoveryConnectionsClient.Revoke -// method. -func (client *ItemLevelRecoveryConnectionsClient) Revoke(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *ItemLevelRecoveryConnectionsClientRevokeOptions) (ItemLevelRecoveryConnectionsClientRevokeResponse, error) { - var err error - const operationName = "ItemLevelRecoveryConnectionsClient.Revoke" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.revokeCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, options) - if err != nil { - return ItemLevelRecoveryConnectionsClientRevokeResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ItemLevelRecoveryConnectionsClientRevokeResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ItemLevelRecoveryConnectionsClientRevokeResponse{}, err - } - return ItemLevelRecoveryConnectionsClientRevokeResponse{}, nil -} - -// revokeCreateRequest creates the Revoke request. -func (client *ItemLevelRecoveryConnectionsClient) revokeCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *ItemLevelRecoveryConnectionsClientRevokeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - if recoveryPointID == "" { - return nil, errors.New("parameter recoveryPointID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{recoveryPointId}", url.PathEscape(recoveryPointID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/itemlevelrecoveryconnections_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/itemlevelrecoveryconnections_client_example_test.go deleted file mode 100644 index 06a65ef06b5a..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/itemlevelrecoveryconnections_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Provision_Ilr.json -func ExampleItemLevelRecoveryConnectionsClient_Provision() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewItemLevelRecoveryConnectionsClient().Provision(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", "Azure", "iaasvmcontainer;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", "vm;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", "1", armrecoveryservicesbackup.ILRRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMILRRegistrationRequest{ - ObjectType: to.Ptr("IaasVMILRRegistrationRequest"), - InitiatorName: to.Ptr("Hello World"), - RecoveryPointID: to.Ptr("38823086363464"), - RenewExistingRegistration: to.Ptr(true), - VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdktestrg/providers/Microsoft.Compute/virtualMachines/pysdktestv2vm1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Revoke_Ilr.json -func ExampleItemLevelRecoveryConnectionsClient_Revoke() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewItemLevelRecoveryConnectionsClient().Revoke(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", "Azure", "iaasvmcontainer;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", "vm;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", "1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobcancellations_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobcancellations_client.go deleted file mode 100644 index 9c791ccedd4d..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobcancellations_client.go +++ /dev/null @@ -1,105 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// JobCancellationsClient contains the methods for the JobCancellations group. -// Don't use this type directly, use NewJobCancellationsClient() instead. -type JobCancellationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewJobCancellationsClient creates a new instance of JobCancellationsClient 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 NewJobCancellationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobCancellationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &JobCancellationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Trigger - Cancels a job. This is an asynchronous operation. To know the status of the cancellation, call GetCancelOperationResult -// API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - jobName - Name of the job to cancel. -// - options - JobCancellationsClientTriggerOptions contains the optional parameters for the JobCancellationsClient.Trigger -// method. -func (client *JobCancellationsClient) Trigger(ctx context.Context, vaultName string, resourceGroupName string, jobName string, options *JobCancellationsClientTriggerOptions) (JobCancellationsClientTriggerResponse, error) { - var err error - const operationName = "JobCancellationsClient.Trigger" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.triggerCreateRequest(ctx, vaultName, resourceGroupName, jobName, options) - if err != nil { - return JobCancellationsClientTriggerResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JobCancellationsClientTriggerResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return JobCancellationsClientTriggerResponse{}, err - } - return JobCancellationsClientTriggerResponse{}, nil -} - -// triggerCreateRequest creates the Trigger request. -func (client *JobCancellationsClient) triggerCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, jobName string, options *JobCancellationsClientTriggerOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 jobName == "" { - return nil, errors.New("parameter jobName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobcancellations_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobcancellations_client_example_test.go deleted file mode 100644 index 6468728336ea..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobcancellations_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerCancelJob.json -func ExampleJobCancellationsClient_Trigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobCancellationsClient().Trigger(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobdetails_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobdetails_client.go deleted file mode 100644 index b55cc2be3df2..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobdetails_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// JobDetailsClient contains the methods for the JobDetails group. -// Don't use this type directly, use NewJobDetailsClient() instead. -type JobDetailsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewJobDetailsClient creates a new instance of JobDetailsClient 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 NewJobDetailsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobDetailsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &JobDetailsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets extended information associated with the job. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - jobName - Name of the job whose details are to be fetched. -// - options - JobDetailsClientGetOptions contains the optional parameters for the JobDetailsClient.Get method. -func (client *JobDetailsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, jobName string, options *JobDetailsClientGetOptions) (JobDetailsClientGetResponse, error) { - var err error - const operationName = "JobDetailsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, jobName, options) - if err != nil { - return JobDetailsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JobDetailsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return JobDetailsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *JobDetailsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, jobName string, options *JobDetailsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 jobName == "" { - return nil, errors.New("parameter jobName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *JobDetailsClient) getHandleResponse(resp *http.Response) (JobDetailsClientGetResponse, error) { - result := JobDetailsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.JobResource); err != nil { - return JobDetailsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobdetails_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobdetails_client_example_test.go deleted file mode 100644 index 32e415218d0c..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobdetails_client_example_test.go +++ /dev/null @@ -1,70 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/GetJobDetails.json -func ExampleJobDetailsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobDetailsClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobResource = armrecoveryservicesbackup.JobResource{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupJobs"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupJobs/00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMJob{ - // ActivityID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // EntityFriendlyName: to.Ptr("testvm"), - // JobType: to.Ptr("AzureIaaSVMJob"), - // Operation: to.Ptr("Backup"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-03T05:31:07.014Z"); return t}()), - // Status: to.Ptr("InProgress"), - // Duration: to.Ptr("PT9.8782791S"), - // ExtendedInfo: &armrecoveryservicesbackup.AzureIaaSVMJobExtendedInfo{ - // PropertyBag: map[string]*string{ - // "VM Name": to.Ptr("testvm"), - // }, - // TasksList: []*armrecoveryservicesbackup.AzureIaaSVMJobTaskDetails{ - // { - // Duration: to.Ptr("PT0S"), - // Status: to.Ptr("InProgress"), - // TaskID: to.Ptr("Take Snapshot"), - // }, - // { - // Duration: to.Ptr("PT0S"), - // Status: to.Ptr("NotStarted"), - // TaskID: to.Ptr("Transfer data to vault"), - // }}, - // }, - // VirtualMachineVersion: to.Ptr("Compute"), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/joboperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/joboperationresults_client.go deleted file mode 100644 index 3f02cf8c9178..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/joboperationresults_client.go +++ /dev/null @@ -1,108 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// JobOperationResultsClient contains the methods for the JobOperationResults group. -// Don't use this type directly, use NewJobOperationResultsClient() instead. -type JobOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewJobOperationResultsClient creates a new instance of JobOperationResultsClient 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 NewJobOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &JobOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches the result of any operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - jobName - Job name whose operation result has to be fetched. -// - operationID - OperationID which represents the operation whose result has to be fetched. -// - options - JobOperationResultsClientGetOptions contains the optional parameters for the JobOperationResultsClient.Get method. -func (client *JobOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, jobName string, operationID string, options *JobOperationResultsClientGetOptions) (JobOperationResultsClientGetResponse, error) { - var err error - const operationName = "JobOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, jobName, operationID, options) - if err != nil { - return JobOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JobOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return JobOperationResultsClientGetResponse{}, err - } - return JobOperationResultsClientGetResponse{}, nil -} - -// getCreateRequest creates the Get request. -func (client *JobOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, jobName string, operationID string, options *JobOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 jobName == "" { - return nil, errors.New("parameter jobName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/joboperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/joboperationresults_client_example_test.go deleted file mode 100644 index 2d0a6c570bc1..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/joboperationresults_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/CancelJobOperationResult.json -func ExampleJobOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobOperationResultsClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobs_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobs_client.go deleted file mode 100644 index 1b00640724cf..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobs_client.go +++ /dev/null @@ -1,101 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// JobsClient contains the methods for the Jobs group. -// Don't use this type directly, use NewJobsClient() instead. -type JobsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewJobsClient creates a new instance of JobsClient 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 NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &JobsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Export - Triggers export of jobs specified by filters and returns an OperationID to track. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - JobsClientExportOptions contains the optional parameters for the JobsClient.Export method. -func (client *JobsClient) Export(ctx context.Context, vaultName string, resourceGroupName string, options *JobsClientExportOptions) (JobsClientExportResponse, error) { - var err error - const operationName = "JobsClient.Export" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.exportCreateRequest(ctx, vaultName, resourceGroupName, options) - if err != nil { - return JobsClientExportResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return JobsClientExportResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return JobsClientExportResponse{}, err - } - return JobsClientExportResponse{}, nil -} - -// exportCreateRequest creates the Export request. -func (client *JobsClient) exportCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *JobsClientExportOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobs_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobs_client_example_test.go deleted file mode 100644 index 2c78395dbbe9..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/jobs_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerExportJobs.json -func ExampleJobsClient_Export() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobsClient().Export(ctx, "NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.JobsClientExportOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models.go index cb4efdaf4a50..b9e4766cb9dd 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models.go @@ -10,267 +10,35 @@ package armrecoveryservicesbackup import "time" -// AzureBackupGoalFeatureSupportRequest - Azure backup goal feature specific request. -type AzureBackupGoalFeatureSupportRequest struct { - // REQUIRED; backup support feature type. - FeatureType *string -} - -// GetFeatureSupportRequest implements the FeatureSupportRequestClassification interface for type AzureBackupGoalFeatureSupportRequest. -func (a *AzureBackupGoalFeatureSupportRequest) GetFeatureSupportRequest() *FeatureSupportRequest { - return &FeatureSupportRequest{ - FeatureType: a.FeatureType, - } -} - -// AzureBackupServerContainer - AzureBackupServer (DPMVenus) workload-specific protection container. -type AzureBackupServerContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Specifies whether the container is re-registrable. - CanReRegister *bool - - // ID of container. - ContainerID *string - - // Backup engine Agent version - DpmAgentVersion *string - - // List of BackupEngines protecting the container - DpmServers []*string - - // Extended Info of the container. - ExtendedInfo *DPMContainerExtendedInfo - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Number of protected items in the BackupEngine - ProtectedItemCount *int64 - - // Protection status of the container. - ProtectionStatus *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // To check if upgrade available - UpgradeAvailable *bool -} - -// GetDpmContainer implements the DpmContainerClassification interface for type AzureBackupServerContainer. -func (a *AzureBackupServerContainer) GetDpmContainer() *DpmContainer { - return &DpmContainer{ - BackupManagementType: a.BackupManagementType, - CanReRegister: a.CanReRegister, - ContainerID: a.ContainerID, - ContainerType: a.ContainerType, - DpmAgentVersion: a.DpmAgentVersion, - DpmServers: a.DpmServers, - ExtendedInfo: a.ExtendedInfo, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - ProtectedItemCount: a.ProtectedItemCount, - ProtectionStatus: a.ProtectionStatus, - RegistrationStatus: a.RegistrationStatus, - UpgradeAvailable: a.UpgradeAvailable, - } -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureBackupServerContainer. -func (a *AzureBackupServerContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } -} - -// AzureBackupServerEngine - Backup engine type when Azure Backup Server is used to manage the backups. -type AzureBackupServerEngine struct { - // REQUIRED; Type of the backup engine. - BackupEngineType *BackupEngineType - - // Backup agent version - AzureBackupAgentVersion *string - - // ID of the backup engine. - BackupEngineID *string - - // Status of the backup engine with the Recovery Services Vault. = {Active/Deleting/DeleteFailed} - BackupEngineState *string - - // Type of backup management for the backup engine. - BackupManagementType *BackupManagementType - - // Flag indicating if the backup engine be registered, once already registered. - CanReRegister *bool - - // Backup engine version - DpmVersion *string - - // Extended info of the backupengine - ExtendedInfo *BackupEngineExtendedInfo - - // Friendly name of the backup engine. - FriendlyName *string - - // Backup status of the backup engine. - HealthStatus *string - - // To check if backup agent upgrade available - IsAzureBackupAgentUpgradeAvailable *bool - - // To check if backup engine upgrade available - IsDpmUpgradeAvailable *bool - - // Registration status of the backup engine with the Recovery Services Vault. - RegistrationStatus *string -} - -// GetBackupEngineBase implements the BackupEngineBaseClassification interface for type AzureBackupServerEngine. -func (a *AzureBackupServerEngine) GetBackupEngineBase() *BackupEngineBase { - return &BackupEngineBase{ - AzureBackupAgentVersion: a.AzureBackupAgentVersion, - BackupEngineID: a.BackupEngineID, - BackupEngineState: a.BackupEngineState, - BackupEngineType: a.BackupEngineType, - BackupManagementType: a.BackupManagementType, - CanReRegister: a.CanReRegister, - DpmVersion: a.DpmVersion, - ExtendedInfo: a.ExtendedInfo, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - IsAzureBackupAgentUpgradeAvailable: a.IsAzureBackupAgentUpgradeAvailable, - IsDpmUpgradeAvailable: a.IsDpmUpgradeAvailable, - RegistrationStatus: a.RegistrationStatus, - } -} - -// AzureFileShareBackupRequest - AzureFileShare workload-specific backup request. -type AzureFileShareBackupRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Backup copy will expire after the time specified (UTC). - RecoveryPointExpiryTimeInUTC *time.Time -} - -// GetBackupRequest implements the BackupRequestClassification interface for type AzureFileShareBackupRequest. -func (a *AzureFileShareBackupRequest) GetBackupRequest() *BackupRequest { - return &BackupRequest{ - ObjectType: a.ObjectType, - } -} - -// AzureFileShareProtectableItem - Protectable item for Azure Fileshare workloads. -type AzureFileShareProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // File Share type XSync or XSMB. - AzureFileShareType *AzureFileShareType - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Full Fabric ID of container to which this protectable item belongs. For example, ARM ID. - ParentContainerFabricID *string - - // Friendly name of container to which this protectable item belongs. - ParentContainerFriendlyName *string - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Type of workload for the backup management - WorkloadType *string -} - -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureFileShareProtectableItem. -func (a *AzureFileShareProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } +type AADProperties struct { + Audience *string + Authority *string + ServicePrincipalClientID *string + ServicePrincipalObjectID *string + TenantID *string } -// AzureFileShareProtectionPolicy - AzureStorage backup policy. -type AzureFileShareProtectionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - BackupManagementType *string - - // Number of items associated with this policy. - ProtectedItemsCount *int32 - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string - - // Retention policy with the details on backup copy retention ranges. - RetentionPolicy RetentionPolicyClassification - - // Backup schedule specified as part of backup policy. - SchedulePolicy SchedulePolicyClassification - - // TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". - TimeZone *string - - // Retention policy with the details on hardened backup copy retention ranges. - VaultRetentionPolicy *VaultRetentionPolicy +type AADPropertiesResource struct { + // Optional ETag. + ETag *string - // Type of workload for the backup management - WorkLoadType *WorkloadType -} + // Resource location. + Location *string -// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type AzureFileShareProtectionPolicy. -func (a *AzureFileShareProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { - return &ProtectionPolicy{ - BackupManagementType: a.BackupManagementType, - ProtectedItemsCount: a.ProtectedItemsCount, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} + // AADPropertiesResource properties + Properties *AADProperties -// AzureFileShareProvisionILRRequest - Update snapshot Uri with the correct friendly Name of the source Azure file share. -type AzureFileShareProvisionILRRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string + // Resource tags. + Tags map[string]*string - // Recovery point ID. - RecoveryPointID *string + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string - // Source Storage account ARM Id - SourceResourceID *string -} + // READ-ONLY; Resource name associated with the resource. + Name *string -// GetILRRequest implements the ILRRequestClassification interface for type AzureFileShareProvisionILRRequest. -func (a *AzureFileShareProvisionILRRequest) GetILRRequest() *ILRRequest { - return &ILRRequest{ - ObjectType: a.ObjectType, - } + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string } // AzureFileShareRecoveryPoint - Azure File Share workload specific backup copy. @@ -278,19 +46,22 @@ type AzureFileShareRecoveryPoint struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. ObjectType *string - // Contains Url to the snapshot of fileshare, if applicable - FileShareSnapshotURI *string + // Denotes whether the Recovery point can be restored to secondary region + CrossRegionRestoreState *string // Properties of Recovery Point RecoveryPointProperties *RecoveryPointProperties - // Contains recovery point size + // READ-ONLY; Contains Url to the snapshot of fileshare, if applicable + FileShareSnapshotURI *string + + // READ-ONLY; Contains recovery point size RecoveryPointSizeInGB *int32 - // Time at which this backup copy was created. + // READ-ONLY; Time at which this backup copy was created. RecoveryPointTime *time.Time - // Type of the backup copy. Specifies whether it is a crash consistent backup or app consistent. + // READ-ONLY; Type of the backup copy. Specifies whether it is a crash consistent backup or app consistent. RecoveryPointType *string } @@ -312,9 +83,6 @@ type AzureFileShareRestoreRequest struct { // Type of this recovery. RecoveryType *RecoveryType - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - // List of Source Files/Folders(which need to recover) and TargetFolderPath details RestoreFileSpecs []*RestoreFileSpecs @@ -331,8 +99,7 @@ type AzureFileShareRestoreRequest struct { // GetRestoreRequest implements the RestoreRequestClassification interface for type AzureFileShareRestoreRequest. func (a *AzureFileShareRestoreRequest) GetRestoreRequest() *RestoreRequest { return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, + ObjectType: a.ObjectType, } } @@ -341,6 +108,9 @@ type AzureFileshareProtectedItem struct { // REQUIRED; backup item type. ProtectedItemType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType + // Name of the backup set the backup item belongs to BackupSetName *string @@ -362,8 +132,8 @@ type AzureFileshareProtectedItem struct { // Friendly name of the fileshare represented by this backup item. FriendlyName *string - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // backups running status for this backup item. + HealthStatus *HealthStatus // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -389,9 +159,6 @@ type AzureFileshareProtectedItem struct { // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string - // Backup state of this backup item. ProtectionState *ProtectionState @@ -401,19 +168,10 @@ type AzureFileshareProtectedItem struct { // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } @@ -426,18 +184,14 @@ func (a *AzureFileshareProtectedItem) GetProtectedItem() *ProtectedItem { CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemType: a.ProtectedItemType, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } @@ -461,123 +215,14 @@ type AzureFileshareProtectedItemExtendedInfo struct { ResourceStateSyncTime *time.Time } -// AzureIaaSClassicComputeVMContainer - IaaS VM workload-specific backup item representing a classic virtual machine. -type AzureIaaSClassicComputeVMContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // Resource group name of Recovery Services Vault. - ResourceGroup *string - - // Fully qualified ARM url of the virtual machine represented by this Azure IaaS VM container. - VirtualMachineID *string - - // Specifies whether the container represents a Classic or an Azure Resource Manager VM. - VirtualMachineVersion *string -} - -// GetIaaSVMContainer implements the IaaSVMContainerClassification interface for type AzureIaaSClassicComputeVMContainer. -func (a *AzureIaaSClassicComputeVMContainer) GetIaaSVMContainer() *IaaSVMContainer { - return &IaaSVMContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - ResourceGroup: a.ResourceGroup, - VirtualMachineID: a.VirtualMachineID, - VirtualMachineVersion: a.VirtualMachineVersion, - } -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureIaaSClassicComputeVMContainer. -func (a *AzureIaaSClassicComputeVMContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } -} - -// AzureIaaSClassicComputeVMProtectableItem - IaaS VM workload-specific backup item representing the Classic Compute VM. -type AzureIaaSClassicComputeVMProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Resource group name of Recovery Services Vault. - ResourceGroup *string - - // Fully qualified ARM ID of the virtual machine. - VirtualMachineID *string - - // Specifies whether the container represents a Classic or an Azure Resource Manager VM. - VirtualMachineVersion *string - - // Type of workload for the backup management - WorkloadType *string -} - -// GetIaaSVMProtectableItem implements the IaaSVMProtectableItemClassification interface for type AzureIaaSClassicComputeVMProtectableItem. -func (a *AzureIaaSClassicComputeVMProtectableItem) GetIaaSVMProtectableItem() *IaaSVMProtectableItem { - return &IaaSVMProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ResourceGroup: a.ResourceGroup, - VirtualMachineID: a.VirtualMachineID, - VirtualMachineVersion: a.VirtualMachineVersion, - WorkloadType: a.WorkloadType, - } -} - -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureIaaSClassicComputeVMProtectableItem. -func (a *AzureIaaSClassicComputeVMProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } -} - // AzureIaaSClassicComputeVMProtectedItem - IaaS VM workload-specific backup item representing the Classic Compute VM. type AzureIaaSClassicComputeVMProtectedItem struct { // REQUIRED; backup item type. ProtectedItemType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType + // Name of the backup set the backup item belongs to BackupSetName *string @@ -599,11 +244,14 @@ type AzureIaaSClassicComputeVMProtectedItem struct { // Extended Properties for Azure IaasVM Backup. ExtendedProperties *ExtendedProperties + // Friendly name of the VM represented by this backup item. + FriendlyName *string + // Health details on this backup item. HealthDetails []*AzureIaaSVMHealthDetails - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // Health status of protected item. + HealthStatus *HealthStatus // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -620,14 +268,17 @@ type AzureIaaSClassicComputeVMProtectedItem struct { // Last backup operation status. LastBackupStatus *string + // Timestamp of the last backup operation on this backup item. + LastBackupTime *time.Time + // Timestamp when the last (latest) backup copy was created for this backup item. LastRecoveryPoint *time.Time // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string + // Data ID of the protected item. + ProtectedItemDataID *string // Backup state of this backup item. ProtectionState *ProtectionState @@ -638,34 +289,13 @@ type AzureIaaSClassicComputeVMProtectedItem struct { // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the VM represented by this backup item. - FriendlyName *string - - // READ-ONLY; Health status of protected item. - HealthStatus *HealthStatus - - // READ-ONLY; Timestamp of the last backup operation on this backup item. - LastBackupTime *time.Time - - // READ-ONLY; Data ID of the protected item. - ProtectedItemDataID *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Fully qualified ARM ID of the virtual machine represented by this item. + // Fully qualified ARM ID of the virtual machine represented by this item. VirtualMachineID *string - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } @@ -683,7 +313,6 @@ func (a *AzureIaaSClassicComputeVMProtectedItem) GetAzureIaaSVMProtectedItem() * FriendlyName: a.FriendlyName, HealthDetails: a.HealthDetails, HealthStatus: a.HealthStatus, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, @@ -692,15 +321,12 @@ func (a *AzureIaaSClassicComputeVMProtectedItem) GetAzureIaaSVMProtectedItem() * LastBackupTime: a.LastBackupTime, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemDataID: a.ProtectedItemDataID, ProtectedItemType: a.ProtectedItemType, ProtectionState: a.ProtectionState, ProtectionStatus: a.ProtectionStatus, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, VirtualMachineID: a.VirtualMachineID, WorkloadType: a.WorkloadType, } @@ -715,139 +341,26 @@ func (a *AzureIaaSClassicComputeVMProtectedItem) GetProtectedItem() *ProtectedIt CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemType: a.ProtectedItemType, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } -// AzureIaaSComputeVMContainer - IaaS VM workload-specific backup item representing an Azure Resource Manager virtual machine. -type AzureIaaSComputeVMContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // Resource group name of Recovery Services Vault. - ResourceGroup *string - - // Fully qualified ARM url of the virtual machine represented by this Azure IaaS VM container. - VirtualMachineID *string - - // Specifies whether the container represents a Classic or an Azure Resource Manager VM. - VirtualMachineVersion *string -} - -// GetIaaSVMContainer implements the IaaSVMContainerClassification interface for type AzureIaaSComputeVMContainer. -func (a *AzureIaaSComputeVMContainer) GetIaaSVMContainer() *IaaSVMContainer { - return &IaaSVMContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - ResourceGroup: a.ResourceGroup, - VirtualMachineID: a.VirtualMachineID, - VirtualMachineVersion: a.VirtualMachineVersion, - } -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureIaaSComputeVMContainer. -func (a *AzureIaaSComputeVMContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } -} - -// AzureIaaSComputeVMProtectableItem - IaaS VM workload-specific backup item representing the Azure Resource Manager VM. -type AzureIaaSComputeVMProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Resource group name of Recovery Services Vault. - ResourceGroup *string - - // Fully qualified ARM ID of the virtual machine. - VirtualMachineID *string - - // Specifies whether the container represents a Classic or an Azure Resource Manager VM. - VirtualMachineVersion *string - - // Type of workload for the backup management - WorkloadType *string -} - -// GetIaaSVMProtectableItem implements the IaaSVMProtectableItemClassification interface for type AzureIaaSComputeVMProtectableItem. -func (a *AzureIaaSComputeVMProtectableItem) GetIaaSVMProtectableItem() *IaaSVMProtectableItem { - return &IaaSVMProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ResourceGroup: a.ResourceGroup, - VirtualMachineID: a.VirtualMachineID, - VirtualMachineVersion: a.VirtualMachineVersion, - WorkloadType: a.WorkloadType, - } -} - -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureIaaSComputeVMProtectableItem. -func (a *AzureIaaSComputeVMProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } -} - // AzureIaaSComputeVMProtectedItem - IaaS VM workload-specific backup item representing the Azure Resource Manager VM. type AzureIaaSComputeVMProtectedItem struct { // REQUIRED; backup item type. ProtectedItemType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType + // Name of the backup set the backup item belongs to BackupSetName *string @@ -869,11 +382,14 @@ type AzureIaaSComputeVMProtectedItem struct { // Extended Properties for Azure IaasVM Backup. ExtendedProperties *ExtendedProperties + // Friendly name of the VM represented by this backup item. + FriendlyName *string + // Health details on this backup item. HealthDetails []*AzureIaaSVMHealthDetails - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // Health status of protected item. + HealthStatus *HealthStatus // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -890,14 +406,17 @@ type AzureIaaSComputeVMProtectedItem struct { // Last backup operation status. LastBackupStatus *string + // Timestamp of the last backup operation on this backup item. + LastBackupTime *time.Time + // Timestamp when the last (latest) backup copy was created for this backup item. LastRecoveryPoint *time.Time // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string + // Data ID of the protected item. + ProtectedItemDataID *string // Backup state of this backup item. ProtectionState *ProtectionState @@ -908,34 +427,13 @@ type AzureIaaSComputeVMProtectedItem struct { // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the VM represented by this backup item. - FriendlyName *string - - // READ-ONLY; Health status of protected item. - HealthStatus *HealthStatus - - // READ-ONLY; Timestamp of the last backup operation on this backup item. - LastBackupTime *time.Time - - // READ-ONLY; Data ID of the protected item. - ProtectedItemDataID *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Fully qualified ARM ID of the virtual machine represented by this item. + // Fully qualified ARM ID of the virtual machine represented by this item. VirtualMachineID *string - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } @@ -953,7 +451,6 @@ func (a *AzureIaaSComputeVMProtectedItem) GetAzureIaaSVMProtectedItem() *AzureIa FriendlyName: a.FriendlyName, HealthDetails: a.HealthDetails, HealthStatus: a.HealthStatus, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, @@ -962,15 +459,12 @@ func (a *AzureIaaSComputeVMProtectedItem) GetAzureIaaSVMProtectedItem() *AzureIa LastBackupTime: a.LastBackupTime, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemDataID: a.ProtectedItemDataID, ProtectedItemType: a.ProtectedItemType, ProtectionState: a.ProtectionState, ProtectionStatus: a.ProtectionStatus, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, VirtualMachineID: a.VirtualMachineID, WorkloadType: a.WorkloadType, } @@ -985,18 +479,14 @@ func (a *AzureIaaSComputeVMProtectedItem) GetProtectedItem() *ProtectedItem { CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemType: a.ProtectedItemType, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } @@ -1045,9 +535,6 @@ type AzureIaaSVMJob struct { // Backup management type to execute the current job. BackupManagementType *BackupManagementType - // Container name of the entity on which the current job is executing. - ContainerName *string - // Time elapsed during the execution of this job. Duration *string @@ -1063,9 +550,6 @@ type AzureIaaSVMJob struct { // Additional information for this job. ExtendedInfo *AzureIaaSVMJobExtendedInfo - // Indicated that whether the job is adhoc(true) or scheduled(false) - IsUserTriggered *bool - // The operation name. Operation *string @@ -1141,70 +625,14 @@ type AzureIaaSVMJobTaskDetails struct { TaskID *string } -// AzureIaaSVMJobV2 - Azure IaaS VM workload-specific job object. -type AzureIaaSVMJobV2 struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - JobType *string - - // Gets or sets the state/actions applicable on this job like cancel/retry. - ActionsInfo []*JobSupportedAction - - // ActivityId of job. - ActivityID *string - - // Backup management type to execute the current job. - BackupManagementType *BackupManagementType - - // Container name of the entity on which the current job is executing. - ContainerName *string - - // Time elapsed during the execution of this job. - Duration *string - - // The end time. - EndTime *time.Time - - // Friendly name of the entity on which the current job is executing. - EntityFriendlyName *string - - // Error details on execution of this job. - ErrorDetails []*AzureIaaSVMErrorInfo - - // Additional information for this job. - ExtendedInfo *AzureIaaSVMJobExtendedInfo - - // The operation name. - Operation *string - - // The start time. - StartTime *time.Time - - // Job status. - Status *string - - // Specifies whether the backup item is a Classic or an Azure Resource Manager VM. - VirtualMachineVersion *string -} - -// GetJob implements the JobClassification interface for type AzureIaaSVMJobV2. -func (a *AzureIaaSVMJobV2) GetJob() *Job { - return &Job{ - ActivityID: a.ActivityID, - BackupManagementType: a.BackupManagementType, - EndTime: a.EndTime, - EntityFriendlyName: a.EntityFriendlyName, - JobType: a.JobType, - Operation: a.Operation, - StartTime: a.StartTime, - Status: a.Status, - } -} - // AzureIaaSVMProtectedItem - IaaS VM workload-specific backup item. type AzureIaaSVMProtectedItem struct { // REQUIRED; backup item type. ProtectedItemType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType + // Name of the backup set the backup item belongs to BackupSetName *string @@ -1226,11 +654,14 @@ type AzureIaaSVMProtectedItem struct { // Extended Properties for Azure IaasVM Backup. ExtendedProperties *ExtendedProperties + // Friendly name of the VM represented by this backup item. + FriendlyName *string + // Health details on this backup item. HealthDetails []*AzureIaaSVMHealthDetails - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // Health status of protected item. + HealthStatus *HealthStatus // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -1247,14 +678,17 @@ type AzureIaaSVMProtectedItem struct { // Last backup operation status. LastBackupStatus *string + // Timestamp of the last backup operation on this backup item. + LastBackupTime *time.Time + // Timestamp when the last (latest) backup copy was created for this backup item. LastRecoveryPoint *time.Time // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string + // Data ID of the protected item. + ProtectedItemDataID *string // Backup state of this backup item. ProtectionState *ProtectionState @@ -1265,34 +699,13 @@ type AzureIaaSVMProtectedItem struct { // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the VM represented by this backup item. - FriendlyName *string - - // READ-ONLY; Health status of protected item. - HealthStatus *HealthStatus - - // READ-ONLY; Timestamp of the last backup operation on this backup item. - LastBackupTime *time.Time - - // READ-ONLY; Data ID of the protected item. - ProtectedItemDataID *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Fully qualified ARM ID of the virtual machine represented by this item. + // Fully qualified ARM ID of the virtual machine represented by this item. VirtualMachineID *string - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } @@ -1308,36 +721,23 @@ func (a *AzureIaaSVMProtectedItem) GetProtectedItem() *ProtectedItem { CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemType: a.ProtectedItemType, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } // AzureIaaSVMProtectedItemExtendedInfo - Additional information on Azure IaaS VM specific backup item. type AzureIaaSVMProtectedItemExtendedInfo struct { - // The latest backup copy available for this backup item in archive tier - NewestRecoveryPointInArchive *time.Time - - // The oldest backup copy available for this backup item across all tiers. + // The oldest backup copy available for this backup item. OldestRecoveryPoint *time.Time - // The oldest backup copy available for this backup item in archive tier - OldestRecoveryPointInArchive *time.Time - - // The oldest backup copy available for this backup item in vault tier - OldestRecoveryPointInVault *time.Time - // Specifies if backup policy associated with the backup item is inconsistent. PolicyInconsistent *bool @@ -1345,230 +745,14 @@ type AzureIaaSVMProtectedItemExtendedInfo struct { RecoveryPointCount *int32 } -// AzureIaaSVMProtectionPolicy - IaaS VM workload-specific backup policy. -type AzureIaaSVMProtectionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - BackupManagementType *string - InstantRPDetails *InstantRPAdditionalDetails - - // Instant RP retention policy range in days - InstantRpRetentionRangeInDays *int32 - PolicyType *IAASVMPolicyType - - // Number of items associated with this policy. - ProtectedItemsCount *int32 - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string - - // Retention policy with the details on backup copy retention ranges. - RetentionPolicy RetentionPolicyClassification - - // Backup schedule specified as part of backup policy. - SchedulePolicy SchedulePolicyClassification - SnapshotConsistencyType *IaasVMSnapshotConsistencyType - - // Tiering policy to automatically move RPs to another tier Key is Target Tier, defined in RecoveryPointTierType enum. Tiering - // policy specifies the criteria to move RP to the target tier. - TieringPolicy map[string]*TieringPolicy - - // TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". - TimeZone *string -} - -// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type AzureIaaSVMProtectionPolicy. -func (a *AzureIaaSVMProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { - return &ProtectionPolicy{ - BackupManagementType: a.BackupManagementType, - ProtectedItemsCount: a.ProtectedItemsCount, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} - -// AzureRecoveryServiceVaultProtectionIntent - Azure Recovery Services Vault specific protection intent item. -type AzureRecoveryServiceVaultProtectionIntent struct { - // REQUIRED; backup protectionIntent type. - ProtectionIntentItemType *ProtectionIntentItemType - - // Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId - ItemID *string - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Backup state of this backup item. - ProtectionState *ProtectionStatus - - // ARM ID of the resource to be backed up. - SourceResourceID *string -} - -// GetAzureRecoveryServiceVaultProtectionIntent implements the AzureRecoveryServiceVaultProtectionIntentClassification interface -// for type AzureRecoveryServiceVaultProtectionIntent. -func (a *AzureRecoveryServiceVaultProtectionIntent) GetAzureRecoveryServiceVaultProtectionIntent() *AzureRecoveryServiceVaultProtectionIntent { - return a -} - -// GetProtectionIntent implements the ProtectionIntentClassification interface for type AzureRecoveryServiceVaultProtectionIntent. -func (a *AzureRecoveryServiceVaultProtectionIntent) GetProtectionIntent() *ProtectionIntent { - return &ProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, - } -} - -// AzureResourceProtectionIntent - IaaS VM specific backup protection intent item. -type AzureResourceProtectionIntent struct { - // REQUIRED; backup protectionIntent type. - ProtectionIntentItemType *ProtectionIntentItemType - - // Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // Friendly name of the VM represented by this backup item. - FriendlyName *string - - // ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId - ItemID *string - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Backup state of this backup item. - ProtectionState *ProtectionStatus - - // ARM ID of the resource to be backed up. - SourceResourceID *string -} - -// GetProtectionIntent implements the ProtectionIntentClassification interface for type AzureResourceProtectionIntent. -func (a *AzureResourceProtectionIntent) GetProtectionIntent() *ProtectionIntent { - return &ProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, - } -} - -// AzureSQLAGWorkloadContainerProtectionContainer - Container for SQL workloads under SQL Availability Group. -type AzureSQLAGWorkloadContainerProtectionContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Additional details of a workload container. - ExtendedInfo *AzureWorkloadContainerExtendedInfo - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Time stamp when this container was updated. - LastUpdatedTime *time.Time - - // Re-Do Operation - OperationType *OperationType - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // ARM ID of the virtual machine represented by this Azure Workload Container - SourceResourceID *string - - // Workload type for which registration was sent. - WorkloadType *WorkloadType -} - -// GetAzureWorkloadContainer implements the AzureWorkloadContainerClassification interface for type AzureSQLAGWorkloadContainerProtectionContainer. -func (a *AzureSQLAGWorkloadContainerProtectionContainer) GetAzureWorkloadContainer() *AzureWorkloadContainer { - return &AzureWorkloadContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - ExtendedInfo: a.ExtendedInfo, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - LastUpdatedTime: a.LastUpdatedTime, - OperationType: a.OperationType, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - SourceResourceID: a.SourceResourceID, - WorkloadType: a.WorkloadType, - } -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureSQLAGWorkloadContainerProtectionContainer. -func (a *AzureSQLAGWorkloadContainerProtectionContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } -} - -// AzureSQLContainer - Azure Sql workload-specific container. -type AzureSQLContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureSQLContainer. -func (a *AzureSQLContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } -} - // AzureSQLProtectedItem - Azure SQL workload-specific backup item. type AzureSQLProtectedItem struct { // REQUIRED; backup item type. ProtectedItemType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType + // Name of the backup set the backup item belongs to BackupSetName *string @@ -1587,9 +771,6 @@ type AzureSQLProtectedItem struct { // Additional information for this backup item. ExtendedInfo *AzureSQLProtectedItemExtendedInfo - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool - // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -1605,9 +786,6 @@ type AzureSQLProtectedItem struct { // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string - // Internal ID of a backup item. Used by Azure SQL Backup engine to contact Recovery Services. ProtectedItemDataID *string @@ -1617,19 +795,10 @@ type AzureSQLProtectedItem struct { // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } @@ -1642,18 +811,14 @@ func (a *AzureSQLProtectedItem) GetProtectedItem() *ProtectedItem { CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemType: a.ProtectedItemType, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } @@ -1670,81 +835,6 @@ type AzureSQLProtectedItemExtendedInfo struct { RecoveryPointCount *int32 } -// AzureSQLProtectionPolicy - Azure SQL workload-specific backup policy. -type AzureSQLProtectionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - BackupManagementType *string - - // Number of items associated with this policy. - ProtectedItemsCount *int32 - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string - - // Retention policy details. - RetentionPolicy RetentionPolicyClassification -} - -// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type AzureSQLProtectionPolicy. -func (a *AzureSQLProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { - return &ProtectionPolicy{ - BackupManagementType: a.BackupManagementType, - ProtectedItemsCount: a.ProtectedItemsCount, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} - -// AzureStorageContainer - Azure Storage Account workload-specific container. -type AzureStorageContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Whether storage account lock is to be acquired for this container or not. - AcquireStorageAccountLock *AcquireStorageAccountLock - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Number of items backed up in this container. - ProtectedItemCount *int64 - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // Resource group name of Recovery Services Vault. - ResourceGroup *string - - // Fully qualified ARM url. - SourceResourceID *string - - // Storage account version. - StorageAccountVersion *string -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureStorageContainer. -func (a *AzureStorageContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } -} - // AzureStorageErrorInfo - Azure storage specific error information type AzureStorageErrorInfo struct { // Error code. @@ -1786,9 +876,6 @@ type AzureStorageJob struct { // Additional information about the job. ExtendedInfo *AzureStorageJobExtendedInfo - // Indicated that whether the job is adhoc(true) or scheduled(false) - IsUserTriggered *bool - // The operation name. Operation *string @@ -1840,275 +927,139 @@ type AzureStorageJobTaskDetails struct { TaskID *string } -// AzureStorageProtectableContainer - Azure Storage-specific protectable containers -type AzureStorageProtectableContainer struct { - // REQUIRED; Type of the container. The value of this property for - // 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines - ProtectableContainerType *ProtectableContainerType +// AzureVMWorkloadProtectedItem - Azure VM workload-specific protected item. +type AzureVMWorkloadProtectedItem struct { + // REQUIRED; backup item type. + ProtectedItemType *string - // Type of backup management for the container. + // Type of backup management for the backed up item. BackupManagementType *BackupManagementType - // Fabric Id of the container such as ARM Id. - ContainerID *string - - // Friendly name of the container. - FriendlyName *string + // Name of the backup set the backup item belongs to + BackupSetName *string - // Status of health of the container. - HealthStatus *string -} + // Unique name of container + ContainerName *string -// GetProtectableContainer implements the ProtectableContainerClassification interface for type AzureStorageProtectableContainer. -func (a *AzureStorageProtectableContainer) GetProtectableContainer() *ProtectableContainer { - return &ProtectableContainer{ - BackupManagementType: a.BackupManagementType, - ContainerID: a.ContainerID, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableContainerType: a.ProtectableContainerType, - } -} + // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. + CreateMode *CreateMode -// AzureVMAppContainerProtectableContainer - Azure workload-specific container -type AzureVMAppContainerProtectableContainer struct { - // REQUIRED; Type of the container. The value of this property for - // 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines - ProtectableContainerType *ProtectableContainerType + // Time for deferred deletion in UTC + DeferredDeleteTimeInUTC *time.Time - // Type of backup management for the container. - BackupManagementType *BackupManagementType + // Time remaining before the DS marked for deferred delete is permanently deleted + DeferredDeleteTimeRemaining *string - // Fabric Id of the container such as ARM Id. - ContainerID *string + // Additional information for this backup item. + ExtendedInfo *AzureVMWorkloadProtectedItemExtendedInfo - // Friendly name of the container. + // Friendly name of the DB represented by this backup item. FriendlyName *string - // Status of health of the container. - HealthStatus *string -} + // Flag to identify whether the deferred deleted DS is to be purged soon + IsDeferredDeleteScheduleUpcoming *bool -// GetProtectableContainer implements the ProtectableContainerClassification interface for type AzureVMAppContainerProtectableContainer. -func (a *AzureVMAppContainerProtectableContainer) GetProtectableContainer() *ProtectableContainer { - return &ProtectableContainer{ - BackupManagementType: a.BackupManagementType, - ContainerID: a.ContainerID, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableContainerType: a.ProtectableContainerType, - } -} + // Flag to identify that deferred deleted DS is to be moved into Pause state + IsRehydrate *bool -// AzureVMAppContainerProtectionContainer - Container for SQL workloads under Azure Virtual Machines. -type AzureVMAppContainerProtectionContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType + // Flag to identify whether the DS is scheduled for deferred delete + IsScheduledForDeferredDelete *bool - // Type of backup management for the container. - BackupManagementType *BackupManagementType + // Health details of different KPIs + KpisHealths map[string]*KPIResourceHealthDetails - // Additional details of a workload container. - ExtendedInfo *AzureWorkloadContainerExtendedInfo - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Time stamp when this container was updated. - LastUpdatedTime *time.Time - - // Re-Do Operation - OperationType *OperationType - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // ARM ID of the virtual machine represented by this Azure Workload Container - SourceResourceID *string - - // Workload type for which registration was sent. - WorkloadType *WorkloadType -} - -// GetAzureWorkloadContainer implements the AzureWorkloadContainerClassification interface for type AzureVMAppContainerProtectionContainer. -func (a *AzureVMAppContainerProtectionContainer) GetAzureWorkloadContainer() *AzureWorkloadContainer { - return &AzureWorkloadContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - ExtendedInfo: a.ExtendedInfo, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - LastUpdatedTime: a.LastUpdatedTime, - OperationType: a.OperationType, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - SourceResourceID: a.SourceResourceID, - WorkloadType: a.WorkloadType, - } -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureVMAppContainerProtectionContainer. -func (a *AzureVMAppContainerProtectionContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } -} + // Error details in last backup + LastBackupErrorDetail *ErrorDetail -// AzureVMResourceFeatureSupportRequest - AzureResource(IaaS VM) Specific feature support request -type AzureVMResourceFeatureSupportRequest struct { - // REQUIRED; backup support feature type. - FeatureType *string + // Last backup operation status. Possible values: Healthy, Unhealthy. + LastBackupStatus *LastBackupStatus - // SKUs (Premium/Managed etc) in case of IaasVM - VMSKU *string + // Timestamp of the last backup operation on this backup item. + LastBackupTime *time.Time - // Size of the resource: VM size(A/D series etc) in case of IaasVM - VMSize *string -} + // Timestamp when the last (latest) backup copy was created for this backup item. + LastRecoveryPoint *time.Time -// GetFeatureSupportRequest implements the FeatureSupportRequestClassification interface for type AzureVMResourceFeatureSupportRequest. -func (a *AzureVMResourceFeatureSupportRequest) GetFeatureSupportRequest() *FeatureSupportRequest { - return &FeatureSupportRequest{ - FeatureType: a.FeatureType, - } -} + // Parent name of the DB such as Instance or Availability Group. + ParentName *string -// AzureVMResourceFeatureSupportResponse - Response for feature support requests for Azure IaasVm -type AzureVMResourceFeatureSupportResponse struct { - // Support status of feature - SupportStatus *SupportStatus -} + // Parent type of protected item, example: for a DB, standalone server or distributed + ParentType *string -// AzureVMWorkloadItem - Azure VM workload-specific workload item. -type AzureVMWorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string + // ID of the backup policy with which this item is backed up. + PolicyID *string - // Type of backup management to backup an item. - BackupManagementType *string + // Data ID of the protected item. + ProtectedItemDataSourceID *string - // Friendly name of the backup item. - FriendlyName *string + // Health status of the backup item, evaluated based on last heartbeat received + ProtectedItemHealthStatus *ProtectedItemHealthStatus - // Indicates if workload item is auto-protectable - IsAutoProtectable *bool + // Backup state of this backup item. + ProtectionState *ProtectionState - // Name for instance or AG - ParentName *string + // Backup status of this backup item. + ProtectionStatus *string - // State of the back up item. - ProtectionState *ProtectionStatus + // ResourceGuardOperationRequests on which LAC check will be performed + ResourceGuardOperationRequests []*string // Host/Cluster Name for instance or AG ServerName *string - // For instance or AG, indicates number of DB's to be protected - SubWorkloadItemCount *int32 - - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // ARM ID of the resource to be backed up. + SourceResourceID *string - // Type of workload for the backup management - WorkloadType *string + // Type of workload this item represents. + WorkloadType *DataSourceType } -// GetAzureVMWorkloadItem implements the AzureVMWorkloadItemClassification interface for type AzureVMWorkloadItem. -func (a *AzureVMWorkloadItem) GetAzureVMWorkloadItem() *AzureVMWorkloadItem { return a } +// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadProtectedItem. +func (a *AzureVMWorkloadProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { + return a +} -// GetWorkloadItem implements the WorkloadItemClassification interface for type AzureVMWorkloadItem. -func (a *AzureVMWorkloadItem) GetWorkloadItem() *WorkloadItem { - return &WorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectionState: a.ProtectionState, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, +// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadProtectedItem. +func (a *AzureVMWorkloadProtectedItem) GetProtectedItem() *ProtectedItem { + return &ProtectedItem{ + BackupManagementType: a.BackupManagementType, + BackupSetName: a.BackupSetName, + ContainerName: a.ContainerName, + CreateMode: a.CreateMode, + DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, + DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, + IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, + IsRehydrate: a.IsRehydrate, + IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, + LastRecoveryPoint: a.LastRecoveryPoint, + PolicyID: a.PolicyID, + ProtectedItemType: a.ProtectedItemType, + ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, + SourceResourceID: a.SourceResourceID, + WorkloadType: a.WorkloadType, } } -// AzureVMWorkloadProtectableItem - Azure VM workload-specific protectable item. -type AzureVMWorkloadProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool - - // Indicates if protectable item is auto-protected - IsAutoProtected *bool - - // Indicates if item is protectable - IsProtectable *bool - - // Name for instance or AG - ParentName *string - - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string - - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Host/Cluster Name for instance or AG - ServerName *string - - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 - - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 - - // Type of workload for the backup management - WorkloadType *string -} +// AzureVMWorkloadProtectedItemExtendedInfo - Additional information on Azure Workload for SQL specific backup item. +type AzureVMWorkloadProtectedItemExtendedInfo struct { + // The oldest backup copy available for this backup item. + OldestRecoveryPoint *time.Time -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadProtectableItem. -func (a *AzureVMWorkloadProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return a -} + // Indicates consistency of policy object and policy applied to this backup item. + PolicyState *string -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadProtectableItem. -func (a *AzureVMWorkloadProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } + // Number of backup copies available for this backup item. + RecoveryPointCount *int32 } -// AzureVMWorkloadProtectedItem - Azure VM workload-specific protected item. -type AzureVMWorkloadProtectedItem struct { +// AzureVMWorkloadSAPAseDatabaseProtectedItem - Azure VM workload-specific protected item representing SAP ASE Database. +type AzureVMWorkloadSAPAseDatabaseProtectedItem struct { // REQUIRED; backup item type. ProtectedItemType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType + // Name of the backup set the backup item belongs to BackupSetName *string @@ -2127,8 +1078,8 @@ type AzureVMWorkloadProtectedItem struct { // Additional information for this backup item. ExtendedInfo *AzureVMWorkloadProtectedItemExtendedInfo - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // Friendly name of the DB represented by this backup item. + FriendlyName *string // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -2154,9 +1105,6 @@ type AzureVMWorkloadProtectedItem struct { // Timestamp when the last (latest) backup copy was created for this backup item. LastRecoveryPoint *time.Time - // List of the nodes in case of distributed container. - NodesList []*DistributedNodesInfo - // Parent name of the DB such as Instance or Availability Group. ParentName *string @@ -2166,9 +1114,6 @@ type AzureVMWorkloadProtectedItem struct { // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string - // Data ID of the protected item. ProtectedItemDataSourceID *string @@ -2178,126 +1123,85 @@ type AzureVMWorkloadProtectedItem struct { // Backup state of this backup item. ProtectionState *ProtectionState + // Backup status of this backup item. + ProtectionStatus *string + // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string // Host/Cluster Name for instance or AG ServerName *string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the DB represented by this backup item. - FriendlyName *string - - // READ-ONLY; Backup status of this backup item. - ProtectionStatus *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } -// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadProtectedItem. -func (a *AzureVMWorkloadProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { - return a -} - -// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadProtectedItem. -func (a *AzureVMWorkloadProtectedItem) GetProtectedItem() *ProtectedItem { - return &ProtectedItem{ +// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. +func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { + return &AzureVMWorkloadProtectedItem{ BackupManagementType: a.BackupManagementType, BackupSetName: a.BackupSetName, ContainerName: a.ContainerName, CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, + ExtendedInfo: a.ExtendedInfo, + FriendlyName: a.FriendlyName, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, + KpisHealths: a.KpisHealths, + LastBackupErrorDetail: a.LastBackupErrorDetail, + LastBackupStatus: a.LastBackupStatus, + LastBackupTime: a.LastBackupTime, LastRecoveryPoint: a.LastRecoveryPoint, + ParentName: a.ParentName, + ParentType: a.ParentType, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, + ProtectedItemDataSourceID: a.ProtectedItemDataSourceID, + ProtectedItemHealthStatus: a.ProtectedItemHealthStatus, ProtectedItemType: a.ProtectedItemType, + ProtectionState: a.ProtectionState, + ProtectionStatus: a.ProtectionStatus, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, + ServerName: a.ServerName, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } -// AzureVMWorkloadProtectedItemExtendedInfo - Additional information on Azure Workload for SQL specific backup item. -type AzureVMWorkloadProtectedItemExtendedInfo struct { - // The latest backup copy available for this backup item in archive tier - NewestRecoveryPointInArchive *time.Time - - // The oldest backup copy available for this backup item across all tiers. - OldestRecoveryPoint *time.Time - - // The oldest backup copy available for this backup item in archive tier - OldestRecoveryPointInArchive *time.Time - - // The oldest backup copy available for this backup item in vault tier - OldestRecoveryPointInVault *time.Time - - // Indicates consistency of policy object and policy applied to this backup item. - PolicyState *string - - // Indicates consistency of policy object and policy applied to this backup item. - RecoveryModel *string - - // Number of backup copies available for this backup item. - RecoveryPointCount *int32 -} - -// AzureVMWorkloadProtectionPolicy - Azure VM (Mercury) workload-specific backup policy. -type AzureVMWorkloadProtectionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - BackupManagementType *string - - // Fix the policy inconsistency - MakePolicyConsistent *bool - - // Number of items associated with this policy. - ProtectedItemsCount *int32 - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string - - // Common settings for the backup management - Settings *Settings - - // List of sub-protection policies which includes schedule and retention - SubProtectionPolicy []*SubProtectionPolicy - - // Type of workload for the backup management - WorkLoadType *WorkloadType -} - -// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type AzureVMWorkloadProtectionPolicy. -func (a *AzureVMWorkloadProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { - return &ProtectionPolicy{ - BackupManagementType: a.BackupManagementType, - ProtectedItemsCount: a.ProtectedItemsCount, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, +// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. +func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetProtectedItem() *ProtectedItem { + return &ProtectedItem{ + BackupManagementType: a.BackupManagementType, + BackupSetName: a.BackupSetName, + ContainerName: a.ContainerName, + CreateMode: a.CreateMode, + DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, + DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, + IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, + IsRehydrate: a.IsRehydrate, + IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, + LastRecoveryPoint: a.LastRecoveryPoint, + PolicyID: a.PolicyID, + ProtectedItemType: a.ProtectedItemType, + ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, + SourceResourceID: a.SourceResourceID, + WorkloadType: a.WorkloadType, } } -// AzureVMWorkloadSAPAseDatabaseProtectedItem - Azure VM workload-specific protected item representing SAP ASE Database. -type AzureVMWorkloadSAPAseDatabaseProtectedItem struct { +// AzureVMWorkloadSAPHanaDatabaseProtectedItem - Azure VM workload-specific protected item representing SAP HANA Database. +type AzureVMWorkloadSAPHanaDatabaseProtectedItem struct { // REQUIRED; backup item type. ProtectedItemType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType + // Name of the backup set the backup item belongs to BackupSetName *string @@ -2316,8 +1220,8 @@ type AzureVMWorkloadSAPAseDatabaseProtectedItem struct { // Additional information for this backup item. ExtendedInfo *AzureVMWorkloadProtectedItemExtendedInfo - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // Friendly name of the DB represented by this backup item. + FriendlyName *string // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -2343,9 +1247,6 @@ type AzureVMWorkloadSAPAseDatabaseProtectedItem struct { // Timestamp when the last (latest) backup copy was created for this backup item. LastRecoveryPoint *time.Time - // List of the nodes in case of distributed container. - NodesList []*DistributedNodesInfo - // Parent name of the DB such as Instance or Availability Group. ParentName *string @@ -2355,9 +1256,6 @@ type AzureVMWorkloadSAPAseDatabaseProtectedItem struct { // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string - // Data ID of the protected item. ProtectedItemDataSourceID *string @@ -2367,36 +1265,24 @@ type AzureVMWorkloadSAPAseDatabaseProtectedItem struct { // Backup state of this backup item. ProtectionState *ProtectionState + // Backup status of this backup item. + ProtectionStatus *string + // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string // Host/Cluster Name for instance or AG ServerName *string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the DB represented by this backup item. - FriendlyName *string - - // READ-ONLY; Backup status of this backup item. - ProtectionStatus *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } -// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. -func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { +// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. +func (a *AzureVMWorkloadSAPHanaDatabaseProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { return &AzureVMWorkloadProtectedItem{ BackupManagementType: a.BackupManagementType, BackupSetName: a.BackupSetName, @@ -2406,7 +1292,6 @@ func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetAzureVMWorkloadProtected DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, ExtendedInfo: a.ExtendedInfo, FriendlyName: a.FriendlyName, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, @@ -2415,11 +1300,9 @@ func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetAzureVMWorkloadProtected LastBackupStatus: a.LastBackupStatus, LastBackupTime: a.LastBackupTime, LastRecoveryPoint: a.LastRecoveryPoint, - NodesList: a.NodesList, ParentName: a.ParentName, ParentType: a.ParentType, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemDataSourceID: a.ProtectedItemDataSourceID, ProtectedItemHealthStatus: a.ProtectedItemHealthStatus, ProtectedItemType: a.ProtectedItemType, @@ -2427,15 +1310,13 @@ func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetAzureVMWorkloadProtected ProtectionStatus: a.ProtectionStatus, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, ServerName: a.ServerName, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } -// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. -func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetProtectedItem() *ProtectedItem { +// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. +func (a *AzureVMWorkloadSAPHanaDatabaseProtectedItem) GetProtectedItem() *ProtectedItem { return &ProtectedItem{ BackupManagementType: a.BackupManagementType, BackupSetName: a.BackupSetName, @@ -2443,322 +1324,47 @@ func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) GetProtectedItem() *Protect CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemType: a.ProtectedItemType, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } -// AzureVMWorkloadSAPAseDatabaseWorkloadItem - Azure VM workload-specific workload item representing SAP ASE Database. -type AzureVMWorkloadSAPAseDatabaseWorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string +// AzureVMWorkloadSQLDatabaseProtectedItem - Azure VM workload-specific protected item representing SQL Database. +type AzureVMWorkloadSQLDatabaseProtectedItem struct { + // REQUIRED; backup item type. + ProtectedItemType *string - // Type of backup management to backup an item. - BackupManagementType *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType - // Friendly name of the backup item. - FriendlyName *string + // Name of the backup set the backup item belongs to + BackupSetName *string - // Indicates if workload item is auto-protectable - IsAutoProtectable *bool + // Unique name of container + ContainerName *string - // Name for instance or AG - ParentName *string + // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. + CreateMode *CreateMode - // State of the back up item. - ProtectionState *ProtectionStatus + // Time for deferred deletion in UTC + DeferredDeleteTimeInUTC *time.Time - // Host/Cluster Name for instance or AG - ServerName *string + // Time remaining before the DS marked for deferred delete is permanently deleted + DeferredDeleteTimeRemaining *string - // For instance or AG, indicates number of DB's to be protected - SubWorkloadItemCount *int32 + // Additional information for this backup item. + ExtendedInfo *AzureVMWorkloadProtectedItemExtendedInfo - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 - - // Type of workload for the backup management - WorkloadType *string -} - -// GetAzureVMWorkloadItem implements the AzureVMWorkloadItemClassification interface for type AzureVMWorkloadSAPAseDatabaseWorkloadItem. -func (a *AzureVMWorkloadSAPAseDatabaseWorkloadItem) GetAzureVMWorkloadItem() *AzureVMWorkloadItem { - return &AzureVMWorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - ParentName: a.ParentName, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - SubWorkloadItemCount: a.SubWorkloadItemCount, - Subinquireditemcount: a.Subinquireditemcount, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, - } -} - -// GetWorkloadItem implements the WorkloadItemClassification interface for type AzureVMWorkloadSAPAseDatabaseWorkloadItem. -func (a *AzureVMWorkloadSAPAseDatabaseWorkloadItem) GetWorkloadItem() *WorkloadItem { - return &WorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectionState: a.ProtectionState, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, - } -} - -// AzureVMWorkloadSAPAseSystemProtectableItem - Azure VM workload-specific protectable item representing SAP ASE System. -type AzureVMWorkloadSAPAseSystemProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool - - // Indicates if protectable item is auto-protected - IsAutoProtected *bool - - // Indicates if item is protectable - IsProtectable *bool - - // Name for instance or AG - ParentName *string - - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string - - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Host/Cluster Name for instance or AG - ServerName *string - - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 - - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 - - // Type of workload for the backup management - WorkloadType *string -} - -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPAseSystemProtectableItem. -func (a *AzureVMWorkloadSAPAseSystemProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, - } -} - -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPAseSystemProtectableItem. -func (a *AzureVMWorkloadSAPAseSystemProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } -} - -// AzureVMWorkloadSAPAseSystemWorkloadItem - Azure VM workload-specific workload item representing SAP ASE System. -type AzureVMWorkloadSAPAseSystemWorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if workload item is auto-protectable - IsAutoProtectable *bool - - // Name for instance or AG - ParentName *string - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Host/Cluster Name for instance or AG - ServerName *string - - // For instance or AG, indicates number of DB's to be protected - SubWorkloadItemCount *int32 - - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 - - // Type of workload for the backup management - WorkloadType *string -} - -// GetAzureVMWorkloadItem implements the AzureVMWorkloadItemClassification interface for type AzureVMWorkloadSAPAseSystemWorkloadItem. -func (a *AzureVMWorkloadSAPAseSystemWorkloadItem) GetAzureVMWorkloadItem() *AzureVMWorkloadItem { - return &AzureVMWorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - ParentName: a.ParentName, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - SubWorkloadItemCount: a.SubWorkloadItemCount, - Subinquireditemcount: a.Subinquireditemcount, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, - } -} - -// GetWorkloadItem implements the WorkloadItemClassification interface for type AzureVMWorkloadSAPAseSystemWorkloadItem. -func (a *AzureVMWorkloadSAPAseSystemWorkloadItem) GetWorkloadItem() *WorkloadItem { - return &WorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectionState: a.ProtectionState, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, - } -} - -// AzureVMWorkloadSAPHanaDBInstance - Azure VM workload-specific protectable item representing SAP HANA Dbinstance. -type AzureVMWorkloadSAPHanaDBInstance struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. + // Friendly name of the DB represented by this backup item. FriendlyName *string - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool - - // Indicates if protectable item is auto-protected - IsAutoProtected *bool - - // Indicates if item is protectable - IsProtectable *bool - - // Name for instance or AG - ParentName *string - - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string - - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Host/Cluster Name for instance or AG - ServerName *string - - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 - - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 - - // Type of workload for the backup management - WorkloadType *string -} - -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaDBInstance. -func (a *AzureVMWorkloadSAPHanaDBInstance) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, - } -} - -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaDBInstance. -func (a *AzureVMWorkloadSAPHanaDBInstance) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } -} - -// AzureVMWorkloadSAPHanaDBInstanceProtectedItem - Azure VM workload-specific protected item representing SAP HANA DBInstance. -type AzureVMWorkloadSAPHanaDBInstanceProtectedItem struct { - // REQUIRED; backup item type. - ProtectedItemType *string - - // Name of the backup set the backup item belongs to - BackupSetName *string - - // Unique name of container - ContainerName *string - - // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. - CreateMode *CreateMode - - // Time for deferred deletion in UTC - DeferredDeleteTimeInUTC *time.Time - - // Time remaining before the DS marked for deferred delete is permanently deleted - DeferredDeleteTimeRemaining *string - - // Additional information for this backup item. - ExtendedInfo *AzureVMWorkloadProtectedItemExtendedInfo - - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool - // Flag to identify whether the deferred deleted DS is to be purged soon IsDeferredDeleteScheduleUpcoming *bool @@ -2783,9 +1389,6 @@ type AzureVMWorkloadSAPHanaDBInstanceProtectedItem struct { // Timestamp when the last (latest) backup copy was created for this backup item. LastRecoveryPoint *time.Time - // List of the nodes in case of distributed container. - NodesList []*DistributedNodesInfo - // Parent name of the DB such as Instance or Availability Group. ParentName *string @@ -2795,9 +1398,6 @@ type AzureVMWorkloadSAPHanaDBInstanceProtectedItem struct { // ID of the backup policy with which this item is backed up. PolicyID *string - // Name of the policy used for protection - PolicyName *string - // Data ID of the protected item. ProtectedItemDataSourceID *string @@ -2807,36 +1407,24 @@ type AzureVMWorkloadSAPHanaDBInstanceProtectedItem struct { // Backup state of this backup item. ProtectionState *ProtectionState + // Backup status of this backup item. + ProtectionStatus *string + // ResourceGuardOperationRequests on which LAC check will be performed ResourceGuardOperationRequests []*string // Host/Cluster Name for instance or AG ServerName *string - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - // ARM ID of the resource to be backed up. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the DB represented by this backup item. - FriendlyName *string - - // READ-ONLY; Backup status of this backup item. - ProtectionStatus *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. + // Type of workload this item represents. WorkloadType *DataSourceType } -// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadSAPHanaDBInstanceProtectedItem. -func (a *AzureVMWorkloadSAPHanaDBInstanceProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { +// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadSQLDatabaseProtectedItem. +func (a *AzureVMWorkloadSQLDatabaseProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { return &AzureVMWorkloadProtectedItem{ BackupManagementType: a.BackupManagementType, BackupSetName: a.BackupSetName, @@ -2846,7 +1434,6 @@ func (a *AzureVMWorkloadSAPHanaDBInstanceProtectedItem) GetAzureVMWorkloadProtec DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, ExtendedInfo: a.ExtendedInfo, FriendlyName: a.FriendlyName, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, @@ -2855,11 +1442,9 @@ func (a *AzureVMWorkloadSAPHanaDBInstanceProtectedItem) GetAzureVMWorkloadProtec LastBackupStatus: a.LastBackupStatus, LastBackupTime: a.LastBackupTime, LastRecoveryPoint: a.LastRecoveryPoint, - NodesList: a.NodesList, ParentName: a.ParentName, ParentType: a.ParentType, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemDataSourceID: a.ProtectedItemDataSourceID, ProtectedItemHealthStatus: a.ProtectedItemHealthStatus, ProtectedItemType: a.ProtectedItemType, @@ -2867,15 +1452,13 @@ func (a *AzureVMWorkloadSAPHanaDBInstanceProtectedItem) GetAzureVMWorkloadProtec ProtectionStatus: a.ProtectionStatus, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, ServerName: a.ServerName, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } -// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadSAPHanaDBInstanceProtectedItem. -func (a *AzureVMWorkloadSAPHanaDBInstanceProtectedItem) GetProtectedItem() *ProtectedItem { +// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadSQLDatabaseProtectedItem. +func (a *AzureVMWorkloadSQLDatabaseProtectedItem) GetProtectedItem() *ProtectedItem { return &ProtectedItem{ BackupManagementType: a.BackupManagementType, BackupSetName: a.BackupSetName, @@ -2883,1260 +1466,1193 @@ func (a *AzureVMWorkloadSAPHanaDBInstanceProtectedItem) GetProtectedItem() *Prot CreateMode: a.CreateMode, DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, IsRehydrate: a.IsRehydrate, IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, LastRecoveryPoint: a.LastRecoveryPoint, PolicyID: a.PolicyID, - PolicyName: a.PolicyName, ProtectedItemType: a.ProtectedItemType, ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, WorkloadType: a.WorkloadType, } } -// AzureVMWorkloadSAPHanaDatabaseProtectableItem - Azure VM workload-specific protectable item representing SAP HANA Database. -type AzureVMWorkloadSAPHanaDatabaseProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string +// AzureWorkloadErrorInfo - Azure storage specific error information +type AzureWorkloadErrorInfo struct { + // Additional details for above error code. + AdditionalDetails *string + + // Error code. + ErrorCode *int32 - // Type of backup management to backup an item. - BackupManagementType *string + // Localized error string. + ErrorString *string - // Friendly name of the backup item. - FriendlyName *string + // Title: Typically, the entity that the error pertains to. + ErrorTitle *string + + // List of localized recommendations for above error code. + Recommendations []*string +} - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool +// AzureWorkloadJob - Azure storage specific job. +type AzureWorkloadJob struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + JobType *string - // Indicates if protectable item is auto-protected - IsAutoProtected *bool + // Gets or sets the state/actions applicable on this job like cancel/retry. + ActionsInfo []*JobSupportedAction - // Indicates if item is protectable - IsProtectable *bool + // ActivityId of job. + ActivityID *string - // Name for instance or AG - ParentName *string + // Backup management type to execute the current job. + BackupManagementType *BackupManagementType - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string + // Time elapsed during the execution of this job. + Duration *string - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation + // The end time. + EndTime *time.Time - // State of the back up item. - ProtectionState *ProtectionStatus + // Friendly name of the entity on which the current job is executing. + EntityFriendlyName *string - // Host/Cluster Name for instance or AG - ServerName *string + // Error details on execution of this job. + ErrorDetails []*AzureWorkloadErrorInfo - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // Additional information about the job. + ExtendedInfo *AzureWorkloadJobExtendedInfo - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 + // The operation name. + Operation *string - // Type of workload for the backup management - WorkloadType *string -} + // The start time. + StartTime *time.Time -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseProtectableItem. -func (a *AzureVMWorkloadSAPHanaDatabaseProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, - } + // Job status. + Status *string + + // Workload type of the job + WorkloadType *string } -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseProtectableItem. -func (a *AzureVMWorkloadSAPHanaDatabaseProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ +// GetJob implements the JobClassification interface for type AzureWorkloadJob. +func (a *AzureWorkloadJob) GetJob() *Job { + return &Job{ + ActivityID: a.ActivityID, BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, + EndTime: a.EndTime, + EntityFriendlyName: a.EntityFriendlyName, + JobType: a.JobType, + Operation: a.Operation, + StartTime: a.StartTime, + Status: a.Status, } } -// AzureVMWorkloadSAPHanaDatabaseProtectedItem - Azure VM workload-specific protected item representing SAP HANA Database. -type AzureVMWorkloadSAPHanaDatabaseProtectedItem struct { - // REQUIRED; backup item type. - ProtectedItemType *string +// AzureWorkloadJobExtendedInfo - Azure VM workload-specific additional information for job. +type AzureWorkloadJobExtendedInfo struct { + // Non localized error message on job execution. + DynamicErrorMessage *string - // Name of the backup set the backup item belongs to - BackupSetName *string + // Job properties. + PropertyBag map[string]*string - // Unique name of container - ContainerName *string + // List of tasks for this job + TasksList []*AzureWorkloadJobTaskDetails +} - // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. - CreateMode *CreateMode +// AzureWorkloadJobTaskDetails - Azure VM workload specific job task details. +type AzureWorkloadJobTaskDetails struct { + // The status. + Status *string - // Time for deferred deletion in UTC - DeferredDeleteTimeInUTC *time.Time + // The task display name. + TaskID *string +} - // Time remaining before the DS marked for deferred delete is permanently deleted - DeferredDeleteTimeRemaining *string +// AzureWorkloadPointInTimeRecoveryPoint - Recovery point specific to PointInTime +type AzureWorkloadPointInTimeRecoveryPoint struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Additional information for this backup item. - ExtendedInfo *AzureVMWorkloadProtectedItemExtendedInfo + // Eligibility of RP to be moved to another tier + RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // Properties of Recovery Point + RecoveryPointProperties *RecoveryPointProperties - // Flag to identify whether the deferred deleted DS is to be purged soon - IsDeferredDeleteScheduleUpcoming *bool + // Recovery point tier information. + RecoveryPointTierDetails []*RecoveryPointTierInformation - // Flag to identify that deferred deleted DS is to be moved into Pause state - IsRehydrate *bool + // List of log ranges + TimeRanges []*PointInTimeRange - // Flag to identify whether the DS is scheduled for deferred delete - IsScheduledForDeferredDelete *bool + // READ-ONLY; UTC time at which recovery point was created + RecoveryPointTimeInUTC *time.Time - // Health details of different KPIs - KpisHealths map[string]*KPIResourceHealthDetails + // READ-ONLY; Type of restore point + Type *RestorePointType +} - // Error details in last backup - LastBackupErrorDetail *ErrorDetail +// GetAzureWorkloadPointInTimeRecoveryPoint implements the AzureWorkloadPointInTimeRecoveryPointClassification interface for +// type AzureWorkloadPointInTimeRecoveryPoint. +func (a *AzureWorkloadPointInTimeRecoveryPoint) GetAzureWorkloadPointInTimeRecoveryPoint() *AzureWorkloadPointInTimeRecoveryPoint { + return a +} - // Last backup operation status. Possible values: Healthy, Unhealthy. - LastBackupStatus *LastBackupStatus - - // Timestamp of the last backup operation on this backup item. - LastBackupTime *time.Time - - // Timestamp when the last (latest) backup copy was created for this backup item. - LastRecoveryPoint *time.Time - - // List of the nodes in case of distributed container. - NodesList []*DistributedNodesInfo - - // Parent name of the DB such as Instance or Availability Group. - ParentName *string - - // Parent type of protected item, example: for a DB, standalone server or distributed - ParentType *string - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Name of the policy used for protection - PolicyName *string +// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadPointInTimeRecoveryPoint. +func (a *AzureWorkloadPointInTimeRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { + return &AzureWorkloadRecoveryPoint{ + ObjectType: a.ObjectType, + RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, + RecoveryPointProperties: a.RecoveryPointProperties, + RecoveryPointTierDetails: a.RecoveryPointTierDetails, + RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, + Type: a.Type, + } +} - // Data ID of the protected item. - ProtectedItemDataSourceID *string +// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadPointInTimeRecoveryPoint. +func (a *AzureWorkloadPointInTimeRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { + return &RecoveryPoint{ + ObjectType: a.ObjectType, + } +} - // Health status of the backup item, evaluated based on last heartbeat received - ProtectedItemHealthStatus *ProtectedItemHealthStatus +// AzureWorkloadPointInTimeRestoreRequest - AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore +type AzureWorkloadPointInTimeRestoreRequest struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Backup state of this backup item. - ProtectionState *ProtectionState + // PointInTime value + PointInTime *time.Time - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string + // Workload specific property bag. + PropertyBag map[string]*string - // Host/Cluster Name for instance or AG - ServerName *string + // Defines whether the current recovery mode is file restore or database restore + RecoveryMode *RecoveryMode - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 + // Type of this recovery. + RecoveryType *RecoveryType - // ARM ID of the resource to be backed up. + // Fully qualified ARM ID of the VM on which workload that was running is being recovered. SourceResourceID *string - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the DB represented by this backup item. - FriendlyName *string - - // READ-ONLY; Backup status of this backup item. - ProtectionStatus *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string + // Details of target database + TargetInfo *TargetRestoreInfo - // READ-ONLY; Type of workload this item represents. - WorkloadType *DataSourceType + // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} + TargetVirtualMachineID *string } -// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. -func (a *AzureVMWorkloadSAPHanaDatabaseProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { - return &AzureVMWorkloadProtectedItem{ - BackupManagementType: a.BackupManagementType, - BackupSetName: a.BackupSetName, - ContainerName: a.ContainerName, - CreateMode: a.CreateMode, - DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, - DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - ExtendedInfo: a.ExtendedInfo, - FriendlyName: a.FriendlyName, - IsArchiveEnabled: a.IsArchiveEnabled, - IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, - IsRehydrate: a.IsRehydrate, - IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, - KpisHealths: a.KpisHealths, - LastBackupErrorDetail: a.LastBackupErrorDetail, - LastBackupStatus: a.LastBackupStatus, - LastBackupTime: a.LastBackupTime, - LastRecoveryPoint: a.LastRecoveryPoint, - NodesList: a.NodesList, - ParentName: a.ParentName, - ParentType: a.ParentType, - PolicyID: a.PolicyID, - PolicyName: a.PolicyName, - ProtectedItemDataSourceID: a.ProtectedItemDataSourceID, - ProtectedItemHealthStatus: a.ProtectedItemHealthStatus, - ProtectedItemType: a.ProtectedItemType, - ProtectionState: a.ProtectionState, - ProtectionStatus: a.ProtectionStatus, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - ServerName: a.ServerName, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, - SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadPointInTimeRestoreRequest. +func (a *AzureWorkloadPointInTimeRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { + return &AzureWorkloadRestoreRequest{ + ObjectType: a.ObjectType, + PropertyBag: a.PropertyBag, + RecoveryMode: a.RecoveryMode, + RecoveryType: a.RecoveryType, + SourceResourceID: a.SourceResourceID, + TargetInfo: a.TargetInfo, + TargetVirtualMachineID: a.TargetVirtualMachineID, } } -// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. -func (a *AzureVMWorkloadSAPHanaDatabaseProtectedItem) GetProtectedItem() *ProtectedItem { - return &ProtectedItem{ - BackupManagementType: a.BackupManagementType, - BackupSetName: a.BackupSetName, - ContainerName: a.ContainerName, - CreateMode: a.CreateMode, - DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, - DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, - IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, - IsRehydrate: a.IsRehydrate, - IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, - LastRecoveryPoint: a.LastRecoveryPoint, - PolicyID: a.PolicyID, - PolicyName: a.PolicyName, - ProtectedItemType: a.ProtectedItemType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, - SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, - WorkloadType: a.WorkloadType, +// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadPointInTimeRestoreRequest. +func (a *AzureWorkloadPointInTimeRestoreRequest) GetRestoreRequest() *RestoreRequest { + return &RestoreRequest{ + ObjectType: a.ObjectType, } } -// AzureVMWorkloadSAPHanaDatabaseWorkloadItem - Azure VM workload-specific workload item representing SAP HANA Database. -type AzureVMWorkloadSAPHanaDatabaseWorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if workload item is auto-protectable - IsAutoProtectable *bool - - // Name for instance or AG - ParentName *string +// AzureWorkloadRecoveryPoint - Workload specific recovery point, specifically encapsulates full/diff recovery point +type AzureWorkloadRecoveryPoint struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // State of the back up item. - ProtectionState *ProtectionStatus + // Eligibility of RP to be moved to another tier + RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo - // Host/Cluster Name for instance or AG - ServerName *string + // Properties of Recovery Point + RecoveryPointProperties *RecoveryPointProperties - // For instance or AG, indicates number of DB's to be protected - SubWorkloadItemCount *int32 + // Recovery point tier information. + RecoveryPointTierDetails []*RecoveryPointTierInformation - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // READ-ONLY; UTC time at which recovery point was created + RecoveryPointTimeInUTC *time.Time - // Type of workload for the backup management - WorkloadType *string + // READ-ONLY; Type of restore point + Type *RestorePointType } -// GetAzureVMWorkloadItem implements the AzureVMWorkloadItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseWorkloadItem. -func (a *AzureVMWorkloadSAPHanaDatabaseWorkloadItem) GetAzureVMWorkloadItem() *AzureVMWorkloadItem { - return &AzureVMWorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - ParentName: a.ParentName, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - SubWorkloadItemCount: a.SubWorkloadItemCount, - Subinquireditemcount: a.Subinquireditemcount, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, - } +// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadRecoveryPoint. +func (a *AzureWorkloadRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { + return a } -// GetWorkloadItem implements the WorkloadItemClassification interface for type AzureVMWorkloadSAPHanaDatabaseWorkloadItem. -func (a *AzureVMWorkloadSAPHanaDatabaseWorkloadItem) GetWorkloadItem() *WorkloadItem { - return &WorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectionState: a.ProtectionState, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, +// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadRecoveryPoint. +func (a *AzureWorkloadRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { + return &RecoveryPoint{ + ObjectType: a.ObjectType, } } -// AzureVMWorkloadSAPHanaHSRProtectableItem - Azure VM workload-specific protectable item representing HANA HSR. -type AzureVMWorkloadSAPHanaHSRProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool - - // Indicates if protectable item is auto-protected - IsAutoProtected *bool - - // Indicates if item is protectable - IsProtectable *bool - - // Name for instance or AG - ParentName *string - - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string +// AzureWorkloadRestoreRequest - AzureWorkload-specific restore. +type AzureWorkloadRestoreRequest struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation + // Workload specific property bag. + PropertyBag map[string]*string - // State of the back up item. - ProtectionState *ProtectionStatus + // Defines whether the current recovery mode is file restore or database restore + RecoveryMode *RecoveryMode - // Host/Cluster Name for instance or AG - ServerName *string + // Type of this recovery. + RecoveryType *RecoveryType - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // Fully qualified ARM ID of the VM on which workload that was running is being recovered. + SourceResourceID *string - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 + // Details of target database + TargetInfo *TargetRestoreInfo - // Type of workload for the backup management - WorkloadType *string + // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} + TargetVirtualMachineID *string } -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaHSRProtectableItem. -func (a *AzureVMWorkloadSAPHanaHSRProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, - } +// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadRestoreRequest. +func (a *AzureWorkloadRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { + return a } -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaHSRProtectableItem. -func (a *AzureVMWorkloadSAPHanaHSRProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, +// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadRestoreRequest. +func (a *AzureWorkloadRestoreRequest) GetRestoreRequest() *RestoreRequest { + return &RestoreRequest{ + ObjectType: a.ObjectType, } } -// AzureVMWorkloadSAPHanaSystemProtectableItem - Azure VM workload-specific protectable item representing SAP HANA System. -type AzureVMWorkloadSAPHanaSystemProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool - - // Indicates if protectable item is auto-protected - IsAutoProtected *bool - - // Indicates if item is protectable - IsProtectable *bool - - // Name for instance or AG - ParentName *string +// AzureWorkloadSAPHanaPointInTimeRecoveryPoint - Recovery point specific to PointInTime in SAPHana +type AzureWorkloadSAPHanaPointInTimeRecoveryPoint struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string + // Eligibility of RP to be moved to another tier + RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation + // Properties of Recovery Point + RecoveryPointProperties *RecoveryPointProperties - // State of the back up item. - ProtectionState *ProtectionStatus + // Recovery point tier information. + RecoveryPointTierDetails []*RecoveryPointTierInformation - // Host/Cluster Name for instance or AG - ServerName *string + // List of log ranges + TimeRanges []*PointInTimeRange - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // READ-ONLY; UTC time at which recovery point was created + RecoveryPointTimeInUTC *time.Time - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 + // READ-ONLY; Type of restore point + Type *RestorePointType +} - // Type of workload for the backup management - WorkloadType *string +// GetAzureWorkloadPointInTimeRecoveryPoint implements the AzureWorkloadPointInTimeRecoveryPointClassification interface for +// type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. +func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) GetAzureWorkloadPointInTimeRecoveryPoint() *AzureWorkloadPointInTimeRecoveryPoint { + return &AzureWorkloadPointInTimeRecoveryPoint{ + ObjectType: a.ObjectType, + RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, + RecoveryPointProperties: a.RecoveryPointProperties, + RecoveryPointTierDetails: a.RecoveryPointTierDetails, + RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, + TimeRanges: a.TimeRanges, + Type: a.Type, + } } -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaSystemProtectableItem. -func (a *AzureVMWorkloadSAPHanaSystemProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. +func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { + return &AzureWorkloadRecoveryPoint{ + ObjectType: a.ObjectType, + RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, + RecoveryPointProperties: a.RecoveryPointProperties, + RecoveryPointTierDetails: a.RecoveryPointTierDetails, + RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, + Type: a.Type, } } -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSAPHanaSystemProtectableItem. -func (a *AzureVMWorkloadSAPHanaSystemProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, +// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. +func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { + return &RecoveryPoint{ + ObjectType: a.ObjectType, } } -// AzureVMWorkloadSAPHanaSystemWorkloadItem - Azure VM workload-specific workload item representing SAP HANA System. -type AzureVMWorkloadSAPHanaSystemWorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string +// AzureWorkloadSAPHanaPointInTimeRestoreRequest - AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log +// restore +type AzureWorkloadSAPHanaPointInTimeRestoreRequest struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Type of backup management to backup an item. - BackupManagementType *string + // PointInTime value + PointInTime *time.Time - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if workload item is auto-protectable - IsAutoProtectable *bool + // Workload specific property bag. + PropertyBag map[string]*string - // Name for instance or AG - ParentName *string + // Defines whether the current recovery mode is file restore or database restore + RecoveryMode *RecoveryMode - // State of the back up item. - ProtectionState *ProtectionStatus + // Type of this recovery. + RecoveryType *RecoveryType - // Host/Cluster Name for instance or AG - ServerName *string + // Fully qualified ARM ID of the VM on which workload that was running is being recovered. + SourceResourceID *string - // For instance or AG, indicates number of DB's to be protected - SubWorkloadItemCount *int32 + // Details of target database + TargetInfo *TargetRestoreInfo - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} + TargetVirtualMachineID *string +} - // Type of workload for the backup management - WorkloadType *string +// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. +func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { + return &AzureWorkloadRestoreRequest{ + ObjectType: a.ObjectType, + PropertyBag: a.PropertyBag, + RecoveryMode: a.RecoveryMode, + RecoveryType: a.RecoveryType, + SourceResourceID: a.SourceResourceID, + TargetInfo: a.TargetInfo, + TargetVirtualMachineID: a.TargetVirtualMachineID, + } } -// GetAzureVMWorkloadItem implements the AzureVMWorkloadItemClassification interface for type AzureVMWorkloadSAPHanaSystemWorkloadItem. -func (a *AzureVMWorkloadSAPHanaSystemWorkloadItem) GetAzureVMWorkloadItem() *AzureVMWorkloadItem { - return &AzureVMWorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - ParentName: a.ParentName, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - SubWorkloadItemCount: a.SubWorkloadItemCount, - Subinquireditemcount: a.Subinquireditemcount, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadSAPHanaRestoreRequest implements the AzureWorkloadSAPHanaRestoreRequestClassification interface for type +// AzureWorkloadSAPHanaPointInTimeRestoreRequest. +func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) GetAzureWorkloadSAPHanaRestoreRequest() *AzureWorkloadSAPHanaRestoreRequest { + return &AzureWorkloadSAPHanaRestoreRequest{ + ObjectType: a.ObjectType, + PropertyBag: a.PropertyBag, + RecoveryMode: a.RecoveryMode, + RecoveryType: a.RecoveryType, + SourceResourceID: a.SourceResourceID, + TargetInfo: a.TargetInfo, + TargetVirtualMachineID: a.TargetVirtualMachineID, } } -// GetWorkloadItem implements the WorkloadItemClassification interface for type AzureVMWorkloadSAPHanaSystemWorkloadItem. -func (a *AzureVMWorkloadSAPHanaSystemWorkloadItem) GetWorkloadItem() *WorkloadItem { - return &WorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectionState: a.ProtectionState, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, +// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. +func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) GetRestoreRequest() *RestoreRequest { + return &RestoreRequest{ + ObjectType: a.ObjectType, } } -// AzureVMWorkloadSQLAvailabilityGroupProtectableItem - Azure VM workload-specific protectable item representing SQL Availability -// Group. -type AzureVMWorkloadSQLAvailabilityGroupProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string +// AzureWorkloadSAPHanaRecoveryPoint - SAPHana specific recoverypoint, specifically encapsulates full/diff recoverypoints +type AzureWorkloadSAPHanaRecoveryPoint struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Type of backup management to backup an item. - BackupManagementType *string + // Eligibility of RP to be moved to another tier + RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo - // Friendly name of the backup item. - FriendlyName *string + // Properties of Recovery Point + RecoveryPointProperties *RecoveryPointProperties - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool + // Recovery point tier information. + RecoveryPointTierDetails []*RecoveryPointTierInformation - // Indicates if protectable item is auto-protected - IsAutoProtected *bool + // READ-ONLY; UTC time at which recovery point was created + RecoveryPointTimeInUTC *time.Time - // Indicates if item is protectable - IsProtectable *bool + // READ-ONLY; Type of restore point + Type *RestorePointType +} - // List of the nodes in case of distributed container. - NodesList []*DistributedNodesInfo +// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSAPHanaRecoveryPoint. +func (a *AzureWorkloadSAPHanaRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { + return &AzureWorkloadRecoveryPoint{ + ObjectType: a.ObjectType, + RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, + RecoveryPointProperties: a.RecoveryPointProperties, + RecoveryPointTierDetails: a.RecoveryPointTierDetails, + RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, + Type: a.Type, + } +} - // Name for instance or AG - ParentName *string +// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSAPHanaRecoveryPoint. +func (a *AzureWorkloadSAPHanaRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { + return &RecoveryPoint{ + ObjectType: a.ObjectType, + } +} - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string +// AzureWorkloadSAPHanaRestoreRequest - AzureWorkload SAP Hana-specific restore. +type AzureWorkloadSAPHanaRestoreRequest struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation + // Workload specific property bag. + PropertyBag map[string]*string - // State of the back up item. - ProtectionState *ProtectionStatus + // Defines whether the current recovery mode is file restore or database restore + RecoveryMode *RecoveryMode - // Host/Cluster Name for instance or AG - ServerName *string + // Type of this recovery. + RecoveryType *RecoveryType - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // Fully qualified ARM ID of the VM on which workload that was running is being recovered. + SourceResourceID *string - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 + // Details of target database + TargetInfo *TargetRestoreInfo - // Type of workload for the backup management - WorkloadType *string + // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} + TargetVirtualMachineID *string } -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSQLAvailabilityGroupProtectableItem. -func (a *AzureVMWorkloadSQLAvailabilityGroupProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSAPHanaRestoreRequest. +func (a *AzureWorkloadSAPHanaRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { + return &AzureWorkloadRestoreRequest{ + ObjectType: a.ObjectType, + PropertyBag: a.PropertyBag, + RecoveryMode: a.RecoveryMode, + RecoveryType: a.RecoveryType, + SourceResourceID: a.SourceResourceID, + TargetInfo: a.TargetInfo, + TargetVirtualMachineID: a.TargetVirtualMachineID, } } -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSQLAvailabilityGroupProtectableItem. -func (a *AzureVMWorkloadSQLAvailabilityGroupProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } +// GetAzureWorkloadSAPHanaRestoreRequest implements the AzureWorkloadSAPHanaRestoreRequestClassification interface for type +// AzureWorkloadSAPHanaRestoreRequest. +func (a *AzureWorkloadSAPHanaRestoreRequest) GetAzureWorkloadSAPHanaRestoreRequest() *AzureWorkloadSAPHanaRestoreRequest { + return a } -// AzureVMWorkloadSQLDatabaseProtectableItem - Azure VM workload-specific protectable item representing SQL Database. -type AzureVMWorkloadSQLDatabaseProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool - - // Indicates if protectable item is auto-protected - IsAutoProtected *bool - - // Indicates if item is protectable - IsProtectable *bool +// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSAPHanaRestoreRequest. +func (a *AzureWorkloadSAPHanaRestoreRequest) GetRestoreRequest() *RestoreRequest { + return &RestoreRequest{ + ObjectType: a.ObjectType, + } +} - // Name for instance or AG - ParentName *string +// AzureWorkloadSQLPointInTimeRecoveryPoint - Recovery point specific to PointInTime +type AzureWorkloadSQLPointInTimeRecoveryPoint struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string + // Extended Info that provides data directory details. Will be populated in two cases: When a specific recovery point is accessed + // using GetRecoveryPoint Or when ListRecoveryPoints is called for Log RP + // only with ExtendedInfo query filter + ExtendedInfo *AzureWorkloadSQLRecoveryPointExtendedInfo - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation + // Eligibility of RP to be moved to another tier + RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo - // State of the back up item. - ProtectionState *ProtectionStatus + // Properties of Recovery Point + RecoveryPointProperties *RecoveryPointProperties - // Host/Cluster Name for instance or AG - ServerName *string + // Recovery point tier information. + RecoveryPointTierDetails []*RecoveryPointTierInformation - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // List of log ranges + TimeRanges []*PointInTimeRange - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 + // READ-ONLY; UTC time at which recovery point was created + RecoveryPointTimeInUTC *time.Time - // Type of workload for the backup management - WorkloadType *string + // READ-ONLY; Type of restore point + Type *RestorePointType } -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSQLDatabaseProtectableItem. -func (a *AzureVMWorkloadSQLDatabaseProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. +func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { + return &AzureWorkloadRecoveryPoint{ + ObjectType: a.ObjectType, + RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, + RecoveryPointProperties: a.RecoveryPointProperties, + RecoveryPointTierDetails: a.RecoveryPointTierDetails, + RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, + Type: a.Type, } } -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSQLDatabaseProtectableItem. -func (a *AzureVMWorkloadSQLDatabaseProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadSQLRecoveryPoint implements the AzureWorkloadSQLRecoveryPointClassification interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. +func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) GetAzureWorkloadSQLRecoveryPoint() *AzureWorkloadSQLRecoveryPoint { + return &AzureWorkloadSQLRecoveryPoint{ + ExtendedInfo: a.ExtendedInfo, + ObjectType: a.ObjectType, + RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, + RecoveryPointProperties: a.RecoveryPointProperties, + RecoveryPointTierDetails: a.RecoveryPointTierDetails, + RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, + Type: a.Type, } } -// AzureVMWorkloadSQLDatabaseProtectedItem - Azure VM workload-specific protected item representing SQL Database. -type AzureVMWorkloadSQLDatabaseProtectedItem struct { - // REQUIRED; backup item type. - ProtectedItemType *string - - // Name of the backup set the backup item belongs to - BackupSetName *string +// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. +func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { + return &RecoveryPoint{ + ObjectType: a.ObjectType, + } +} - // Unique name of container - ContainerName *string +// AzureWorkloadSQLPointInTimeRestoreRequest - AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore +type AzureWorkloadSQLPointInTimeRestoreRequest struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. - CreateMode *CreateMode + // Data directory details + AlternateDirectoryPaths []*SQLDataDirectoryMapping - // Time for deferred deletion in UTC - DeferredDeleteTimeInUTC *time.Time + // SQL specific property where user can chose to set no-recovery when restore operation is tried + IsNonRecoverable *bool - // Time remaining before the DS marked for deferred delete is permanently deleted - DeferredDeleteTimeRemaining *string + // PointInTime value + PointInTime *time.Time - // Additional information for this backup item. - ExtendedInfo *AzureVMWorkloadProtectedItemExtendedInfo + // Workload specific property bag. + PropertyBag map[string]*string - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool + // Defines whether the current recovery mode is file restore or database restore + RecoveryMode *RecoveryMode - // Flag to identify whether the deferred deleted DS is to be purged soon - IsDeferredDeleteScheduleUpcoming *bool + // Type of this recovery. + RecoveryType *RecoveryType - // Flag to identify that deferred deleted DS is to be moved into Pause state - IsRehydrate *bool + // Default option set to true. If this is set to false, alternate data directory must be provided + ShouldUseAlternateTargetLocation *bool - // Flag to identify whether the DS is scheduled for deferred delete - IsScheduledForDeferredDelete *bool + // Fully qualified ARM ID of the VM on which workload that was running is being recovered. + SourceResourceID *string - // Health details of different KPIs - KpisHealths map[string]*KPIResourceHealthDetails + // Details of target database + TargetInfo *TargetRestoreInfo - // Error details in last backup - LastBackupErrorDetail *ErrorDetail + // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} + TargetVirtualMachineID *string +} - // Last backup operation status. Possible values: Healthy, Unhealthy. - LastBackupStatus *LastBackupStatus +// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreRequest. +func (a *AzureWorkloadSQLPointInTimeRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { + return &AzureWorkloadRestoreRequest{ + ObjectType: a.ObjectType, + PropertyBag: a.PropertyBag, + RecoveryMode: a.RecoveryMode, + RecoveryType: a.RecoveryType, + SourceResourceID: a.SourceResourceID, + TargetInfo: a.TargetInfo, + TargetVirtualMachineID: a.TargetVirtualMachineID, + } +} - // Timestamp of the last backup operation on this backup item. - LastBackupTime *time.Time +// GetAzureWorkloadSQLRestoreRequest implements the AzureWorkloadSQLRestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreRequest. +func (a *AzureWorkloadSQLPointInTimeRestoreRequest) GetAzureWorkloadSQLRestoreRequest() *AzureWorkloadSQLRestoreRequest { + return &AzureWorkloadSQLRestoreRequest{ + AlternateDirectoryPaths: a.AlternateDirectoryPaths, + IsNonRecoverable: a.IsNonRecoverable, + ObjectType: a.ObjectType, + PropertyBag: a.PropertyBag, + RecoveryMode: a.RecoveryMode, + RecoveryType: a.RecoveryType, + ShouldUseAlternateTargetLocation: a.ShouldUseAlternateTargetLocation, + SourceResourceID: a.SourceResourceID, + TargetInfo: a.TargetInfo, + TargetVirtualMachineID: a.TargetVirtualMachineID, + } +} - // Timestamp when the last (latest) backup copy was created for this backup item. - LastRecoveryPoint *time.Time +// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreRequest. +func (a *AzureWorkloadSQLPointInTimeRestoreRequest) GetRestoreRequest() *RestoreRequest { + return &RestoreRequest{ + ObjectType: a.ObjectType, + } +} - // List of the nodes in case of distributed container. - NodesList []*DistributedNodesInfo +// AzureWorkloadSQLRecoveryPoint - SQL specific recoverypoint, specifically encapsulates full/diff recoverypoint along with +// extended info +type AzureWorkloadSQLRecoveryPoint struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Parent name of the DB such as Instance or Availability Group. - ParentName *string + // Extended Info that provides data directory details. Will be populated in two cases: When a specific recovery point is accessed + // using GetRecoveryPoint Or when ListRecoveryPoints is called for Log RP + // only with ExtendedInfo query filter + ExtendedInfo *AzureWorkloadSQLRecoveryPointExtendedInfo - // Parent type of protected item, example: for a DB, standalone server or distributed - ParentType *string + // Eligibility of RP to be moved to another tier + RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo - // ID of the backup policy with which this item is backed up. - PolicyID *string + // Properties of Recovery Point + RecoveryPointProperties *RecoveryPointProperties - // Name of the policy used for protection - PolicyName *string + // Recovery point tier information. + RecoveryPointTierDetails []*RecoveryPointTierInformation - // Data ID of the protected item. - ProtectedItemDataSourceID *string + // READ-ONLY; UTC time at which recovery point was created + RecoveryPointTimeInUTC *time.Time - // Health status of the backup item, evaluated based on last heartbeat received - ProtectedItemHealthStatus *ProtectedItemHealthStatus + // READ-ONLY; Type of restore point + Type *RestorePointType +} - // Backup state of this backup item. - ProtectionState *ProtectionState - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Host/Cluster Name for instance or AG - ServerName *string - - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - - // ARM ID of the resource to be backed up. - SourceResourceID *string - - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; Friendly name of the DB represented by this backup item. - FriendlyName *string - - // READ-ONLY; Backup status of this backup item. - ProtectionStatus *string - - // READ-ONLY; ID of the vault which protects this item - VaultID *string +// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSQLRecoveryPoint. +func (a *AzureWorkloadSQLRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { + return &AzureWorkloadRecoveryPoint{ + ObjectType: a.ObjectType, + RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, + RecoveryPointProperties: a.RecoveryPointProperties, + RecoveryPointTierDetails: a.RecoveryPointTierDetails, + RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, + Type: a.Type, + } +} - // READ-ONLY; Type of workload this item represents. - WorkloadType *DataSourceType +// GetAzureWorkloadSQLRecoveryPoint implements the AzureWorkloadSQLRecoveryPointClassification interface for type AzureWorkloadSQLRecoveryPoint. +func (a *AzureWorkloadSQLRecoveryPoint) GetAzureWorkloadSQLRecoveryPoint() *AzureWorkloadSQLRecoveryPoint { + return a } -// GetAzureVMWorkloadProtectedItem implements the AzureVMWorkloadProtectedItemClassification interface for type AzureVMWorkloadSQLDatabaseProtectedItem. -func (a *AzureVMWorkloadSQLDatabaseProtectedItem) GetAzureVMWorkloadProtectedItem() *AzureVMWorkloadProtectedItem { - return &AzureVMWorkloadProtectedItem{ - BackupManagementType: a.BackupManagementType, - BackupSetName: a.BackupSetName, - ContainerName: a.ContainerName, - CreateMode: a.CreateMode, - DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, - DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - ExtendedInfo: a.ExtendedInfo, - FriendlyName: a.FriendlyName, - IsArchiveEnabled: a.IsArchiveEnabled, - IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, - IsRehydrate: a.IsRehydrate, - IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, - KpisHealths: a.KpisHealths, - LastBackupErrorDetail: a.LastBackupErrorDetail, - LastBackupStatus: a.LastBackupStatus, - LastBackupTime: a.LastBackupTime, - LastRecoveryPoint: a.LastRecoveryPoint, - NodesList: a.NodesList, - ParentName: a.ParentName, - ParentType: a.ParentType, - PolicyID: a.PolicyID, - PolicyName: a.PolicyName, - ProtectedItemDataSourceID: a.ProtectedItemDataSourceID, - ProtectedItemHealthStatus: a.ProtectedItemHealthStatus, - ProtectedItemType: a.ProtectedItemType, - ProtectionState: a.ProtectionState, - ProtectionStatus: a.ProtectionStatus, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - ServerName: a.ServerName, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, - SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, - WorkloadType: a.WorkloadType, +// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSQLRecoveryPoint. +func (a *AzureWorkloadSQLRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { + return &RecoveryPoint{ + ObjectType: a.ObjectType, } } -// GetProtectedItem implements the ProtectedItemClassification interface for type AzureVMWorkloadSQLDatabaseProtectedItem. -func (a *AzureVMWorkloadSQLDatabaseProtectedItem) GetProtectedItem() *ProtectedItem { - return &ProtectedItem{ - BackupManagementType: a.BackupManagementType, - BackupSetName: a.BackupSetName, - ContainerName: a.ContainerName, - CreateMode: a.CreateMode, - DeferredDeleteTimeInUTC: a.DeferredDeleteTimeInUTC, - DeferredDeleteTimeRemaining: a.DeferredDeleteTimeRemaining, - IsArchiveEnabled: a.IsArchiveEnabled, - IsDeferredDeleteScheduleUpcoming: a.IsDeferredDeleteScheduleUpcoming, - IsRehydrate: a.IsRehydrate, - IsScheduledForDeferredDelete: a.IsScheduledForDeferredDelete, - LastRecoveryPoint: a.LastRecoveryPoint, - PolicyID: a.PolicyID, - PolicyName: a.PolicyName, - ProtectedItemType: a.ProtectedItemType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: a.SoftDeleteRetentionPeriodInDays, - SourceResourceID: a.SourceResourceID, - VaultID: a.VaultID, - WorkloadType: a.WorkloadType, - } +// AzureWorkloadSQLRecoveryPointExtendedInfo - Extended info class details +type AzureWorkloadSQLRecoveryPointExtendedInfo struct { + // READ-ONLY; List of data directory paths during restore operation. + DataDirectoryPaths []*SQLDataDirectory + + // READ-ONLY; UTC time at which data directory info was captured + DataDirectoryTimeInUTC *time.Time } -// AzureVMWorkloadSQLDatabaseWorkloadItem - Azure VM workload-specific workload item representing SQL Database. -type AzureVMWorkloadSQLDatabaseWorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string +// AzureWorkloadSQLRestoreRequest - AzureWorkload SQL -specific restore. Specifically for full/diff restore +type AzureWorkloadSQLRestoreRequest struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Type of backup management to backup an item. - BackupManagementType *string + // Data directory details + AlternateDirectoryPaths []*SQLDataDirectoryMapping - // Friendly name of the backup item. - FriendlyName *string + // SQL specific property where user can chose to set no-recovery when restore operation is tried + IsNonRecoverable *bool - // Indicates if workload item is auto-protectable - IsAutoProtectable *bool + // Workload specific property bag. + PropertyBag map[string]*string - // Name for instance or AG - ParentName *string + // Defines whether the current recovery mode is file restore or database restore + RecoveryMode *RecoveryMode - // State of the back up item. - ProtectionState *ProtectionStatus + // Type of this recovery. + RecoveryType *RecoveryType - // Host/Cluster Name for instance or AG - ServerName *string + // Default option set to true. If this is set to false, alternate data directory must be provided + ShouldUseAlternateTargetLocation *bool - // For instance or AG, indicates number of DB's to be protected - SubWorkloadItemCount *int32 + // Fully qualified ARM ID of the VM on which workload that was running is being recovered. + SourceResourceID *string - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // Details of target database + TargetInfo *TargetRestoreInfo - // Type of workload for the backup management - WorkloadType *string + // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} + TargetVirtualMachineID *string } -// GetAzureVMWorkloadItem implements the AzureVMWorkloadItemClassification interface for type AzureVMWorkloadSQLDatabaseWorkloadItem. -func (a *AzureVMWorkloadSQLDatabaseWorkloadItem) GetAzureVMWorkloadItem() *AzureVMWorkloadItem { - return &AzureVMWorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - ParentName: a.ParentName, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - SubWorkloadItemCount: a.SubWorkloadItemCount, - Subinquireditemcount: a.Subinquireditemcount, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSQLRestoreRequest. +func (a *AzureWorkloadSQLRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { + return &AzureWorkloadRestoreRequest{ + ObjectType: a.ObjectType, + PropertyBag: a.PropertyBag, + RecoveryMode: a.RecoveryMode, + RecoveryType: a.RecoveryType, + SourceResourceID: a.SourceResourceID, + TargetInfo: a.TargetInfo, + TargetVirtualMachineID: a.TargetVirtualMachineID, } } -// GetWorkloadItem implements the WorkloadItemClassification interface for type AzureVMWorkloadSQLDatabaseWorkloadItem. -func (a *AzureVMWorkloadSQLDatabaseWorkloadItem) GetWorkloadItem() *WorkloadItem { - return &WorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectionState: a.ProtectionState, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, +// GetAzureWorkloadSQLRestoreRequest implements the AzureWorkloadSQLRestoreRequestClassification interface for type AzureWorkloadSQLRestoreRequest. +func (a *AzureWorkloadSQLRestoreRequest) GetAzureWorkloadSQLRestoreRequest() *AzureWorkloadSQLRestoreRequest { + return a +} + +// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSQLRestoreRequest. +func (a *AzureWorkloadSQLRestoreRequest) GetRestoreRequest() *RestoreRequest { + return &RestoreRequest{ + ObjectType: a.ObjectType, } } -// AzureVMWorkloadSQLInstanceProtectableItem - Azure VM workload-specific protectable item representing SQL Instance. -type AzureVMWorkloadSQLInstanceProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string +// BEKDetails - BEK is bitlocker encryption key. +type BEKDetails struct { + // BEK data. + SecretData *string - // Type of backup management to backup an item. - BackupManagementType *string + // Secret is BEK. + SecretURL *string - // Friendly name of the backup item. - FriendlyName *string + // ID of the Key Vault where this Secret is stored. + SecretVaultID *string +} - // Indicates if protectable item is auto-protectable - IsAutoProtectable *bool +// BMSAADPropertiesQueryObject - Filters to list backup items. +type BMSAADPropertiesQueryObject struct { + // Backup management type for the backed up item. + BackupManagementType *BackupManagementType +} - // Indicates if protectable item is auto-protected - IsAutoProtected *bool +// BMSBackupSummariesQueryObject - Query parameters to fetch backup summaries. +type BMSBackupSummariesQueryObject struct { + // Backup management type for this container. + Type *Type +} - // Indicates if item is protectable - IsProtectable *bool +// BMSRPQueryObject - Filters to list backup copies. +type BMSRPQueryObject struct { + // Backup copies created before this time. + EndDate *time.Time - // Name for instance or AG - ParentName *string + // In Get Recovery Point, it tells whether extended information about recovery point is asked. + ExtendedInfo *bool - // Parent Unique Name is added to provide the service formatted URI Name of the Parent Only Applicable for data bases where - // the parent would be either Instance or a SQL AG. - ParentUniqueName *string + // Flag to indicate whether Soft Deleted RPs should be included/excluded from result. + IncludeSoftDeletedRP *bool - // Pre-backup validation for protectable objects - Prebackupvalidation *PreBackupValidation + // Whether the RP can be moved to another tier + MoveReadyRPOnly *bool - // State of the back up item. - ProtectionState *ProtectionStatus + // RestorePoint type + RestorePointQueryType *RestorePointQueryType - // Host/Cluster Name for instance or AG - ServerName *string + // Backup copies created after this time. + StartDate *time.Time +} + +// BackupManagementUsage - Backup management usages of a vault. +type BackupManagementUsage struct { + // Current value of usage. + CurrentValue *int64 - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // Limit of usage. + Limit *int64 - // For instance or AG, indicates number of DB's to be protected - Subprotectableitemcount *int32 + // Name of usage. + Name *NameInfo - // Type of workload for the backup management - WorkloadType *string -} + // Next reset time of usage. + NextResetTime *time.Time -// GetAzureVMWorkloadProtectableItem implements the AzureVMWorkloadProtectableItemClassification interface for type AzureVMWorkloadSQLInstanceProtectableItem. -func (a *AzureVMWorkloadSQLInstanceProtectableItem) GetAzureVMWorkloadProtectableItem() *AzureVMWorkloadProtectableItem { - return &AzureVMWorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - IsAutoProtected: a.IsAutoProtected, - IsProtectable: a.IsProtectable, - ParentName: a.ParentName, - ParentUniqueName: a.ParentUniqueName, - Prebackupvalidation: a.Prebackupvalidation, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - Subinquireditemcount: a.Subinquireditemcount, - Subprotectableitemcount: a.Subprotectableitemcount, - WorkloadType: a.WorkloadType, - } + // Quota period of usage. + QuotaPeriod *string + + // Unit of the usage. + Unit *UsagesUnit } -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type AzureVMWorkloadSQLInstanceProtectableItem. -func (a *AzureVMWorkloadSQLInstanceProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectableItemType: a.ProtectableItemType, - ProtectionState: a.ProtectionState, - WorkloadType: a.WorkloadType, - } +// BackupManagementUsageList - Backup management usage for vault. +type BackupManagementUsageList struct { + // The list of backup management usages for the given vault. + Value []*BackupManagementUsage } -// AzureVMWorkloadSQLInstanceWorkloadItem - Azure VM workload-specific workload item representing SQL Instance. -type AzureVMWorkloadSQLInstanceWorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string +// BackupResourceConfig - The resource storage details. +type BackupResourceConfig struct { + // Opt in details of Cross Region Restore feature. + CrossRegionRestoreFlag *bool - // Type of backup management to backup an item. - BackupManagementType *string + // Storage type + StorageModelType *StorageType - // Data Directory Paths for default directories - DataDirectoryPaths []*SQLDataDirectory + // Storage type. + StorageType *StorageType - // Friendly name of the backup item. - FriendlyName *string + // Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. + StorageTypeState *StorageTypeState +} - // Indicates if workload item is auto-protectable - IsAutoProtectable *bool +// BackupResourceConfigResource - The resource storage details. +type BackupResourceConfigResource struct { + // Optional ETag. + ETag *string - // Name for instance or AG - ParentName *string + // Resource location. + Location *string - // State of the back up item. - ProtectionState *ProtectionStatus + // BackupResourceConfigResource properties + Properties *BackupResourceConfig - // Host/Cluster Name for instance or AG - ServerName *string + // Resource tags. + Tags map[string]*string - // For instance or AG, indicates number of DB's to be protected - SubWorkloadItemCount *int32 + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string - // For instance or AG, indicates number of DB's present - Subinquireditemcount *int32 + // READ-ONLY; Resource name associated with the resource. + Name *string - // Type of workload for the backup management - WorkloadType *string + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string } -// GetAzureVMWorkloadItem implements the AzureVMWorkloadItemClassification interface for type AzureVMWorkloadSQLInstanceWorkloadItem. -func (a *AzureVMWorkloadSQLInstanceWorkloadItem) GetAzureVMWorkloadItem() *AzureVMWorkloadItem { - return &AzureVMWorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - IsAutoProtectable: a.IsAutoProtectable, - ParentName: a.ParentName, - ProtectionState: a.ProtectionState, - ServerName: a.ServerName, - SubWorkloadItemCount: a.SubWorkloadItemCount, - Subinquireditemcount: a.Subinquireditemcount, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, - } -} +// ClientScriptForConnect - Client script details for file / folder restore. +type ClientScriptForConnect struct { + // OS type - Windows, Linux etc. for which this file / folder restore client script works. + OSType *string -// GetWorkloadItem implements the WorkloadItemClassification interface for type AzureVMWorkloadSQLInstanceWorkloadItem. -func (a *AzureVMWorkloadSQLInstanceWorkloadItem) GetWorkloadItem() *WorkloadItem { - return &WorkloadItem{ - BackupManagementType: a.BackupManagementType, - FriendlyName: a.FriendlyName, - ProtectionState: a.ProtectionState, - WorkloadItemType: a.WorkloadItemType, - WorkloadType: a.WorkloadType, - } -} + // File content of the client script for file / folder restore. + ScriptContent *string -// AzureWorkloadAutoProtectionIntent - Azure Recovery Services Vault specific protection intent item. -type AzureWorkloadAutoProtectionIntent struct { - // REQUIRED; backup protectionIntent type. - ProtectionIntentItemType *ProtectionIntentItemType + // File extension of the client script for file / folder restore - .ps1 , .sh , etc. + ScriptExtension *string - // Type of backup management for the backed up item. - BackupManagementType *BackupManagementType + // Mandatory suffix that should be added to the name of script that is given for download to user. If its null or empty then + // , ignore it. + ScriptNameSuffix *string - // ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId - ItemID *string + // URL of Executable from where to source the content. If this is not null then ScriptContent should not be used + URL *string +} - // ID of the backup policy with which this item is backed up. - PolicyID *string +type CrossRegionRestoreRequest struct { + // Access details for cross region restore + CrossRegionRestoreAccessDetails CrrAccessTokenClassification - // Backup state of this backup item. - ProtectionState *ProtectionStatus - - // ARM ID of the resource to be backed up. - SourceResourceID *string + // Request object for triggering restore + RestoreRequest RestoreRequestClassification } -// GetAzureRecoveryServiceVaultProtectionIntent implements the AzureRecoveryServiceVaultProtectionIntentClassification interface -// for type AzureWorkloadAutoProtectionIntent. -func (a *AzureWorkloadAutoProtectionIntent) GetAzureRecoveryServiceVaultProtectionIntent() *AzureRecoveryServiceVaultProtectionIntent { - return &AzureRecoveryServiceVaultProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, - } -} +type CrossRegionRestoreRequestResource struct { + // Optional ETag. + ETag *string -// GetAzureWorkloadAutoProtectionIntent implements the AzureWorkloadAutoProtectionIntentClassification interface for type -// AzureWorkloadAutoProtectionIntent. -func (a *AzureWorkloadAutoProtectionIntent) GetAzureWorkloadAutoProtectionIntent() *AzureWorkloadAutoProtectionIntent { - return a -} + // Resource location. + Location *string -// GetProtectionIntent implements the ProtectionIntentClassification interface for type AzureWorkloadAutoProtectionIntent. -func (a *AzureWorkloadAutoProtectionIntent) GetProtectionIntent() *ProtectionIntent { - return &ProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, - } + // CrossRegionRestoreRequestResource properties + Properties *CrossRegionRestoreRequest + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string + + // READ-ONLY; Resource name associated with the resource. + Name *string + + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string } -// AzureWorkloadBackupRequest - AzureWorkload workload-specific backup request. -type AzureWorkloadBackupRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. +type CrrAccessToken struct { + // REQUIRED; Type of the specific object - used for deserializing ObjectType *string - // Type of backup, viz. Full, Differential, Log or CopyOnlyFull - BackupType *BackupType + // Access token used for authentication + AccessTokenString *string - // Bool for Compression setting - EnableCompression *bool + // Active region name of BMS Stamp + BMSActiveRegion *string - // Backup copy will expire after the time specified (UTC). - RecoveryPointExpiryTimeInUTC *time.Time -} + // Backup Management Type + BackupManagementType *string -// GetBackupRequest implements the BackupRequestClassification interface for type AzureWorkloadBackupRequest. -func (a *AzureWorkloadBackupRequest) GetBackupRequest() *BackupRequest { - return &BackupRequest{ - ObjectType: a.ObjectType, - } -} + // Container Unique name + ContainerName *string -// AzureWorkloadContainer - Container for the workloads running inside Azure Compute or Classic Compute. -type AzureWorkloadContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType + // Container Type + ContainerType *string - // Type of backup management for the container. - BackupManagementType *BackupManagementType + // CoordinatorServiceStampId to be used by BCM in restore call + CoordinatorServiceStampID *string - // Additional details of a workload container. - ExtendedInfo *AzureWorkloadContainerExtendedInfo + // CoordinatorServiceStampUri to be used by BCM in restore call + CoordinatorServiceStampURI *string - // Friendly name of the container. - FriendlyName *string + // Datasource Container Unique Name + DatasourceContainerName *string - // Status of health of the container. - HealthStatus *string + // Datasource Id + DatasourceID *string - // Time stamp when this container was updated. - LastUpdatedTime *time.Time + // Datasource Friendly Name + DatasourceName *string - // Re-Do Operation - OperationType *OperationType + // Datasource Type + DatasourceType *string - // Type of the protectable object associated with this container - ProtectableObjectType *string + // Protected item container id + ProtectionContainerID *int64 - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string + // ProtectionServiceStampId to be used by BCM in restore call + ProtectionServiceStampID *string - // ARM ID of the virtual machine represented by this Azure Workload Container - SourceResourceID *string + // ProtectionServiceStampUri to be used by BCM in restore call + ProtectionServiceStampURI *string - // Workload type for which registration was sent. - WorkloadType *WorkloadType + // Recovery Point Id + RecoveryPointID *string + + // Recovery Point Time + RecoveryPointTime *string + + // Resource Group name of the source vault + ResourceGroupName *string + + // Resource Id of the source vault + ResourceID *string + + // Resource Name of the source vault + ResourceName *string + + // Recovery point information: Managed virtual machine + RpIsManagedVirtualMachine *bool + + // Recovery point information: Original SA option + RpOriginalSAOption *bool + + // Recovery point Tier Information + RpTierInformation map[string]*string + + // Recovery point information: VM size description + RpVMSizeDescription *string + + // Subscription Id of the source vault + SubscriptionID *string + + // Extended Information about the token like FileSpec etc. + TokenExtendedInformation *string } -// GetAzureWorkloadContainer implements the AzureWorkloadContainerClassification interface for type AzureWorkloadContainer. -func (a *AzureWorkloadContainer) GetAzureWorkloadContainer() *AzureWorkloadContainer { return a } +// GetCrrAccessToken implements the CrrAccessTokenClassification interface for type CrrAccessToken. +func (c *CrrAccessToken) GetCrrAccessToken() *CrrAccessToken { return c } -// GetProtectionContainer implements the ProtectionContainerClassification interface for type AzureWorkloadContainer. -func (a *AzureWorkloadContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: a.BackupManagementType, - ContainerType: a.ContainerType, - FriendlyName: a.FriendlyName, - HealthStatus: a.HealthStatus, - ProtectableObjectType: a.ProtectableObjectType, - RegistrationStatus: a.RegistrationStatus, - } +type CrrAccessTokenResource struct { + // Optional ETag. + ETag *string + + // Resource location. + Location *string + + // CrrAccessTokenResource properties + Properties CrrAccessTokenClassification + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string + + // READ-ONLY; Resource name associated with the resource. + Name *string + + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string +} + +// CrrJobRequest - Request object for fetching CRR jobs. +type CrrJobRequest struct { + // Job Name of the job to be fetched + JobName *string + + // Entire ARM resource id of the resource + ResourceID *string +} + +// CrrJobRequestResource - Request object for fetching CRR jobs. +type CrrJobRequestResource struct { + // Optional ETag. + ETag *string + + // Resource location. + Location *string + + // CrrJobRequestResource properties + Properties *CrrJobRequest + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string + + // READ-ONLY; Resource name associated with the resource. + Name *string + + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string } -// AzureWorkloadContainerAutoProtectionIntent - Azure workload specific protection intent item. -type AzureWorkloadContainerAutoProtectionIntent struct { - // REQUIRED; backup protectionIntent type. - ProtectionIntentItemType *ProtectionIntentItemType +// DPMProtectedItem - Additional information on Backup engine specific backup item. +type DPMProtectedItem struct { + // REQUIRED; backup item type. + ProtectedItemType *string + + // Backup Management server protecting this backup item + BackupEngineName *string // Type of backup management for the backed up item. BackupManagementType *BackupManagementType - // ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId - ItemID *string + // Name of the backup set the backup item belongs to + BackupSetName *string + + // Unique name of container + ContainerName *string + + // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. + CreateMode *CreateMode + + // Time for deferred deletion in UTC + DeferredDeleteTimeInUTC *time.Time + + // Time remaining before the DS marked for deferred delete is permanently deleted + DeferredDeleteTimeRemaining *string + + // Extended info of the backup item. + ExtendedInfo *DPMProtectedItemExtendedInfo + + // Friendly name of the managed item + FriendlyName *string + + // Flag to identify whether the deferred deleted DS is to be purged soon + IsDeferredDeleteScheduleUpcoming *bool + + // Flag to identify that deferred deleted DS is to be moved into Pause state + IsRehydrate *bool + + // Flag to identify whether the DS is scheduled for deferred delete + IsScheduledForDeferredDelete *bool + + // Timestamp when the last (latest) backup copy was created for this backup item. + LastRecoveryPoint *time.Time // ID of the backup policy with which this item is backed up. PolicyID *string - // Backup state of this backup item. - ProtectionState *ProtectionStatus + // Protection state of the backup engine + ProtectionState *ProtectedItemState + + // ResourceGuardOperationRequests on which LAC check will be performed + ResourceGuardOperationRequests []*string // ARM ID of the resource to be backed up. SourceResourceID *string + + // Type of workload this item represents. + WorkloadType *DataSourceType } -// GetProtectionIntent implements the ProtectionIntentClassification interface for type AzureWorkloadContainerAutoProtectionIntent. -func (a *AzureWorkloadContainerAutoProtectionIntent) GetProtectionIntent() *ProtectionIntent { - return &ProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, +// GetProtectedItem implements the ProtectedItemClassification interface for type DPMProtectedItem. +func (d *DPMProtectedItem) GetProtectedItem() *ProtectedItem { + return &ProtectedItem{ + BackupManagementType: d.BackupManagementType, + BackupSetName: d.BackupSetName, + ContainerName: d.ContainerName, + CreateMode: d.CreateMode, + DeferredDeleteTimeInUTC: d.DeferredDeleteTimeInUTC, + DeferredDeleteTimeRemaining: d.DeferredDeleteTimeRemaining, + IsDeferredDeleteScheduleUpcoming: d.IsDeferredDeleteScheduleUpcoming, + IsRehydrate: d.IsRehydrate, + IsScheduledForDeferredDelete: d.IsScheduledForDeferredDelete, + LastRecoveryPoint: d.LastRecoveryPoint, + PolicyID: d.PolicyID, + ProtectedItemType: d.ProtectedItemType, + ResourceGuardOperationRequests: d.ResourceGuardOperationRequests, + SourceResourceID: d.SourceResourceID, + WorkloadType: d.WorkloadType, } } -// AzureWorkloadContainerExtendedInfo - Extended information of the container. -type AzureWorkloadContainerExtendedInfo struct { - // Host Os Name in case of Stand Alone and Cluster Name in case of distributed container. - HostServerName *string +// DPMProtectedItemExtendedInfo - Additional information of DPM Protected item. +type DPMProtectedItemExtendedInfo struct { + // Used Disk storage in bytes. + DiskStorageUsedInBytes *string + + // To check if backup item is collocated. + IsCollocated *bool + + // To check if backup item is cloud protected. + IsPresentOnCloud *bool + + // Last backup status information on backup item. + LastBackupStatus *string + + // Last refresh time on backup item. + LastRefreshedAt *time.Time + + // Oldest cloud recovery point time. + OldestRecoveryPoint *time.Time + + // latest disk recovery point time. + OnPremiseLatestRecoveryPoint *time.Time + + // Oldest disk recovery point time. + OnPremiseOldestRecoveryPoint *time.Time + + // disk recovery point count. + OnPremiseRecoveryPointCount *int32 + + // Attribute to provide information on various DBs. + ProtectableObjectLoadPath map[string]*string + + // To check if backup item is disk protected. + Protected *bool + + // Protection group name of the backup item. + ProtectionGroupName *string - // Inquiry Status for the container. - InquiryInfo *InquiryInfo + // cloud recovery point count. + RecoveryPointCount *int32 - // List of the nodes in case of distributed container. - NodesList []*DistributedNodesInfo + // total Disk storage in bytes. + TotalDiskStorageSizeInBytes *string } -// AzureWorkloadErrorInfo - Azure storage specific error information -type AzureWorkloadErrorInfo struct { - // Additional details for above error code. - AdditionalDetails *string +type DiskExclusionProperties struct { + // List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. + DiskLunList []*int32 - // Error code. - ErrorCode *int32 + // Flag to indicate whether DiskLunList is to be included/ excluded from backup. + IsInclusionList *bool +} + +// DiskInformation - Disk information +type DiskInformation struct { + Lun *int32 + Name *string +} +// DpmErrorInfo - DPM workload-specific error information. +type DpmErrorInfo struct { // Localized error string. ErrorString *string - // Title: Typically, the entity that the error pertains to. - ErrorTitle *string - // List of localized recommendations for above error code. Recommendations []*string } -// AzureWorkloadJob - Azure storage specific job. -type AzureWorkloadJob struct { +// DpmJob - DPM workload-specific job object. +type DpmJob struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. JobType *string - // Gets or sets the state/actions applicable on this job like cancel/retry. + // The state/actions applicable on this job like cancel/retry. ActionsInfo []*JobSupportedAction // ActivityId of job. @@ -4145,7 +2661,16 @@ type AzureWorkloadJob struct { // Backup management type to execute the current job. BackupManagementType *BackupManagementType - // Time elapsed during the execution of this job. + // Name of cluster/server protecting current backup item, if any. + ContainerName *string + + // Type of container. + ContainerType *string + + // DPM server name managing the backup item or backup job. + DpmServerName *string + + // Time elapsed for job. Duration *string // The end time. @@ -4154,11 +2679,11 @@ type AzureWorkloadJob struct { // Friendly name of the entity on which the current job is executing. EntityFriendlyName *string - // Error details on execution of this job. - ErrorDetails []*AzureWorkloadErrorInfo + // The errors. + ErrorDetails []*DpmErrorInfo - // Additional information about the job. - ExtendedInfo *AzureWorkloadJobExtendedInfo + // Additional information for this job. + ExtendedInfo *DpmJobExtendedInfo // The operation name. Operation *string @@ -4169,38 +2694,47 @@ type AzureWorkloadJob struct { // Job status. Status *string - // Workload type of the job + // Type of backup item. WorkloadType *string } -// GetJob implements the JobClassification interface for type AzureWorkloadJob. -func (a *AzureWorkloadJob) GetJob() *Job { +// GetJob implements the JobClassification interface for type DpmJob. +func (d *DpmJob) GetJob() *Job { return &Job{ - ActivityID: a.ActivityID, - BackupManagementType: a.BackupManagementType, - EndTime: a.EndTime, - EntityFriendlyName: a.EntityFriendlyName, - JobType: a.JobType, - Operation: a.Operation, - StartTime: a.StartTime, - Status: a.Status, + ActivityID: d.ActivityID, + BackupManagementType: d.BackupManagementType, + EndTime: d.EndTime, + EntityFriendlyName: d.EntityFriendlyName, + JobType: d.JobType, + Operation: d.Operation, + StartTime: d.StartTime, + Status: d.Status, } } -// AzureWorkloadJobExtendedInfo - Azure VM workload-specific additional information for job. -type AzureWorkloadJobExtendedInfo struct { +// DpmJobExtendedInfo - Additional information on the DPM workload-specific job. +type DpmJobExtendedInfo struct { // Non localized error message on job execution. DynamicErrorMessage *string - // Job properties. + // The job properties. PropertyBag map[string]*string - // List of tasks for this job - TasksList []*AzureWorkloadJobTaskDetails + // List of tasks associated with this job. + TasksList []*DpmJobTaskDetails } -// AzureWorkloadJobTaskDetails - Azure VM workload specific job task details. -type AzureWorkloadJobTaskDetails struct { +// DpmJobTaskDetails - DPM workload-specific job task details. +type DpmJobTaskDetails struct { + // Time elapsed for task. + Duration *string + + // The end time. + EndTime *time.Time + + // The start time. + StartTime *time.Time + // The status. Status *string @@ -4208,205 +2742,188 @@ type AzureWorkloadJobTaskDetails struct { TaskID *string } -// AzureWorkloadPointInTimeRecoveryPoint - Recovery point specific to PointInTime -type AzureWorkloadPointInTimeRecoveryPoint struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string +// EncryptionDetails - Details needed if the VM was encrypted at the time of backup. +type EncryptionDetails struct { + // Identifies whether this backup copy represents an encrypted VM at the time of backup. + EncryptionEnabled *bool - // Eligibility of RP to be moved to another tier - RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo + // Key Url. + KekURL *string - // Properties of Recovery Point - RecoveryPointProperties *RecoveryPointProperties + // ID of Key Vault where KEK is stored. + KekVaultID *string - // Recovery point tier information. - RecoveryPointTierDetails []*RecoveryPointTierInformationV2 + // Secret Url. + SecretKeyURL *string - // UTC time at which recovery point was created - RecoveryPointTimeInUTC *time.Time + // ID of Key Vault where Secret is stored. + SecretKeyVaultID *string +} - // List of log ranges - TimeRanges []*PointInTimeRange +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any - // Type of restore point - Type *RestorePointType + // READ-ONLY; The additional info type. + Type *string } -// GetAzureWorkloadPointInTimeRecoveryPoint implements the AzureWorkloadPointInTimeRecoveryPointClassification interface for -// type AzureWorkloadPointInTimeRecoveryPoint. -func (a *AzureWorkloadPointInTimeRecoveryPoint) GetAzureWorkloadPointInTimeRecoveryPoint() *AzureWorkloadPointInTimeRecoveryPoint { - return a -} +// ErrorDetail - Error Detail class which encapsulates Code, Message and Recommendations. +type ErrorDetail struct { + // READ-ONLY; Error code. + Code *string -// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadPointInTimeRecoveryPoint. -func (a *AzureWorkloadPointInTimeRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { - return &AzureWorkloadRecoveryPoint{ - ObjectType: a.ObjectType, - RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, - RecoveryPointProperties: a.RecoveryPointProperties, - RecoveryPointTierDetails: a.RecoveryPointTierDetails, - RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, - Type: a.Type, - } + // READ-ONLY; Error Message related to the Code. + Message *string + + // READ-ONLY; List of recommendation strings. + Recommendations []*string } -// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadPointInTimeRecoveryPoint. -func (a *AzureWorkloadPointInTimeRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { - return &RecoveryPoint{ - ObjectType: a.ObjectType, - } +// ExtendedProperties - Extended Properties for Azure IaasVM Backup. +type ExtendedProperties struct { + // Extended Properties for Disk Exclusion. + DiskExclusionProperties *DiskExclusionProperties } -// AzureWorkloadPointInTimeRestoreRequest - AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore -type AzureWorkloadPointInTimeRestoreRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string +// GenericProtectedItem - Base class for backup items. +type GenericProtectedItem struct { + // REQUIRED; backup item type. + ProtectedItemType *string - // PointInTime value - PointInTime *time.Time + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType - // Workload specific property bag. - PropertyBag map[string]*string + // Name of the backup set the backup item belongs to + BackupSetName *string - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode + // Unique name of container + ContainerName *string - // Type of this recovery. - RecoveryType *RecoveryType + // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. + CreateMode *CreateMode - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string + // Time for deferred deletion in UTC + DeferredDeleteTimeInUTC *time.Time - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters + // Time remaining before the DS marked for deferred delete is permanently deleted + DeferredDeleteTimeRemaining *string - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string + // Name of this backup item's fabric. + FabricName *string - // Details of target database - TargetInfo *TargetRestoreInfo + // Friendly name of the container. + FriendlyName *string + + // Flag to identify whether the deferred deleted DS is to be purged soon + IsDeferredDeleteScheduleUpcoming *bool - // Defines the Resource group of the Target VM - TargetResourceGroupName *string + // Flag to identify that deferred deleted DS is to be moved into Pause state + IsRehydrate *bool - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string + // Flag to identify whether the DS is scheduled for deferred delete + IsScheduledForDeferredDelete *bool - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} + // Timestamp when the last (latest) backup copy was created for this backup item. + LastRecoveryPoint *time.Time -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadPointInTimeRestoreRequest. -func (a *AzureWorkloadPointInTimeRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } + // ID of the backup policy with which this item is backed up. + PolicyID *string + + // Indicates consistency of policy object and policy applied to this backup item. + PolicyState *string + + // Data Plane Service ID of the protected item. + ProtectedItemID *int64 + + // Backup state of this backup item. + ProtectionState *ProtectionState + + // ResourceGuardOperationRequests on which LAC check will be performed + ResourceGuardOperationRequests []*string + + // Loosely coupled (type, value) associations (example - parent of a protected item) + SourceAssociations map[string]*string + + // ARM ID of the resource to be backed up. + SourceResourceID *string + + // Type of workload this item represents. + WorkloadType *DataSourceType } -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadPointInTimeRestoreRequest. -func (a *AzureWorkloadPointInTimeRestoreRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, +// GetProtectedItem implements the ProtectedItemClassification interface for type GenericProtectedItem. +func (g *GenericProtectedItem) GetProtectedItem() *ProtectedItem { + return &ProtectedItem{ + BackupManagementType: g.BackupManagementType, + BackupSetName: g.BackupSetName, + ContainerName: g.ContainerName, + CreateMode: g.CreateMode, + DeferredDeleteTimeInUTC: g.DeferredDeleteTimeInUTC, + DeferredDeleteTimeRemaining: g.DeferredDeleteTimeRemaining, + IsDeferredDeleteScheduleUpcoming: g.IsDeferredDeleteScheduleUpcoming, + IsRehydrate: g.IsRehydrate, + IsScheduledForDeferredDelete: g.IsScheduledForDeferredDelete, + LastRecoveryPoint: g.LastRecoveryPoint, + PolicyID: g.PolicyID, + ProtectedItemType: g.ProtectedItemType, + ResourceGuardOperationRequests: g.ResourceGuardOperationRequests, + SourceResourceID: g.SourceResourceID, + WorkloadType: g.WorkloadType, } } -// AzureWorkloadRecoveryPoint - Workload specific recovery point, specifically encapsulates full/diff recovery point -type AzureWorkloadRecoveryPoint struct { +// GenericRecoveryPoint - Generic backup copy. +type GenericRecoveryPoint struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. ObjectType *string - // Eligibility of RP to be moved to another tier - RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo + // Friendly name of the backup copy. + FriendlyName *string + + // Additional information associated with this backup copy. + RecoveryPointAdditionalInfo *string // Properties of Recovery Point RecoveryPointProperties *RecoveryPointProperties - // Recovery point tier information. - RecoveryPointTierDetails []*RecoveryPointTierInformationV2 - - // UTC time at which recovery point was created - RecoveryPointTimeInUTC *time.Time - - // Type of restore point - Type *RestorePointType -} + // Time at which this backup copy was created. + RecoveryPointTime *time.Time -// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadRecoveryPoint. -func (a *AzureWorkloadRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { - return a + // Type of the backup copy. + RecoveryPointType *string } -// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadRecoveryPoint. -func (a *AzureWorkloadRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { +// GetRecoveryPoint implements the RecoveryPointClassification interface for type GenericRecoveryPoint. +func (g *GenericRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { return &RecoveryPoint{ - ObjectType: a.ObjectType, + ObjectType: g.ObjectType, } } -// AzureWorkloadRestoreRequest - AzureWorkload-specific restore. -type AzureWorkloadRestoreRequest struct { +// IaasVMRecoveryPoint - IaaS VM workload specific backup copy. +type IaasVMRecoveryPoint struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. ObjectType *string - // Workload specific property bag. - PropertyBag map[string]*string + // Is the session to recover items from this backup copy still active. + IsInstantIlrSessionActive *bool - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode + // Whether VM is with Managed Disks + IsManagedVirtualMachine *bool - // Type of this recovery. - RecoveryType *RecoveryType + // Required details for recovering an encrypted VM. Applicable only when IsSourceVMEncrypted is true. + KeyAndSecret *KeyAndSecretDetails - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string + // OS type + OSType *string - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters + // Original Storage Account Option + OriginalStorageAccountOption *bool - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string - - // Details of target database - TargetInfo *TargetRestoreInfo - - // Defines the Resource group of the Target VM - TargetResourceGroupName *string - - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string - - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} - -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadRestoreRequest. -func (a *AzureWorkloadRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return a -} - -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadRestoreRequest. -func (a *AzureWorkloadRestoreRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} - -// AzureWorkloadSAPHanaPointInTimeRecoveryPoint - Recovery point specific to PointInTime in SAPHana -type AzureWorkloadSAPHanaPointInTimeRecoveryPoint struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string + // Disk configuration + RecoveryPointDiskConfiguration *RecoveryPointDiskConfiguration // Eligibility of RP to be moved to another tier RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo @@ -4415,5201 +2932,1057 @@ type AzureWorkloadSAPHanaPointInTimeRecoveryPoint struct { RecoveryPointProperties *RecoveryPointProperties // Recovery point tier information. - RecoveryPointTierDetails []*RecoveryPointTierInformationV2 + RecoveryPointTierDetails []*RecoveryPointTierInformation - // UTC time at which recovery point was created - RecoveryPointTimeInUTC *time.Time + // Virtual Machine Size + VirtualMachineSize *string - // List of log ranges - TimeRanges []*PointInTimeRange + // Identifies the zone of the VM at the time of backup. Applicable only for zone-pinned Vms + Zones []*string - // Type of restore point - Type *RestorePointType -} + // READ-ONLY; Identifies whether the VM was encrypted when the backup copy is created. + IsSourceVMEncrypted *bool -// GetAzureWorkloadPointInTimeRecoveryPoint implements the AzureWorkloadPointInTimeRecoveryPointClassification interface for -// type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. -func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) GetAzureWorkloadPointInTimeRecoveryPoint() *AzureWorkloadPointInTimeRecoveryPoint { - return &AzureWorkloadPointInTimeRecoveryPoint{ - ObjectType: a.ObjectType, - RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, - RecoveryPointProperties: a.RecoveryPointProperties, - RecoveryPointTierDetails: a.RecoveryPointTierDetails, - RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, - TimeRanges: a.TimeRanges, - Type: a.Type, - } -} + // READ-ONLY; Additional information associated with this backup copy. + RecoveryPointAdditionalInfo *string -// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. -func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { - return &AzureWorkloadRecoveryPoint{ - ObjectType: a.ObjectType, - RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, - RecoveryPointProperties: a.RecoveryPointProperties, - RecoveryPointTierDetails: a.RecoveryPointTierDetails, - RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, - Type: a.Type, - } + // READ-ONLY; Time at which this backup copy was created. + RecoveryPointTime *time.Time + + // READ-ONLY; Type of the backup copy. + RecoveryPointType *string + + // READ-ONLY; Storage type of the VM whose backup copy is created. + SourceVMStorageType *string } -// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. -func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { +// GetRecoveryPoint implements the RecoveryPointClassification interface for type IaasVMRecoveryPoint. +func (i *IaasVMRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { return &RecoveryPoint{ - ObjectType: a.ObjectType, + ObjectType: i.ObjectType, } } -// AzureWorkloadSAPHanaPointInTimeRestoreRequest - AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log -// restore -type AzureWorkloadSAPHanaPointInTimeRestoreRequest struct { +// IaasVMRestoreRequest - IaaS VM workload-specific restore. +type IaasVMRestoreRequest struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. ObjectType *string - // PointInTime value - PointInTime *time.Time + // Affinity group associated to VM to be restored. Used only for Classic Compute Virtual Machines. + AffinityGroup *string - // Workload specific property bag. - PropertyBag map[string]*string + // Should a new cloud service be created while restoring the VM. If this is false, VM will be restored to the same cloud service + // as it was at the time of backup. + CreateNewCloudService *bool - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode + // DiskEncryptionSet's ID - needed if the VM needs to be encrypted at rest during restore with customer managed key. + DiskEncryptionSetID *string + + // Details needed if the VM was encrypted at the time of backup. + EncryptionDetails *EncryptionDetails + + // IaaS VM workload specific restore details for restores using managed identity. + IdentityBasedRestoreDetails *IdentityBasedRestoreDetails + + // Managed Identity information required to access customer storage account. + IdentityInfo *IdentityInfo + + // Original Storage Account Option + OriginalStorageAccountOption *bool + + // ID of the backup copy to be recovered. + RecoveryPointID *string // Type of this recovery. RecoveryType *RecoveryType - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string + // Region in which the virtual machine is restored. + Region *string + + // List of Disk LUNs for partial restore + RestoreDiskLunList []*int32 - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters + // Flag to denote of an Unmanaged disk VM should be restored with Managed disks. + RestoreWithManagedDisks *bool - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. + // Fully qualified ARM ID of the VM which is being recovered. SourceResourceID *string - // Details of target database - TargetInfo *TargetRestoreInfo + // Fully qualified ARM ID of the storage account to which the VM has to be restored. + StorageAccountID *string - // Defines the Resource group of the Target VM - TargetResourceGroupName *string + // Subnet ID, is the subnet ID associated with the to be restored VM. For Classic VMs it would be {VnetID}/Subnet/{SubnetName} + // and, for the Azure Resource Manager VMs it would be ARM resource ID used to + // represent the subnet. + SubnetID *string - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string + // Fully qualified ARM ID of the domain name to be associated to the VM being restored. This applies only to Classic Virtual + // Machines. + TargetDomainNameID *string - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} + // This is the ARM Id of the resource group that you want to create for this Virtual machine and other artifacts. For e.g. + // /subscriptions/{subId}/resourcegroups/{rg} + TargetResourceGroupID *string -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} + // This is the complete ARM Id of the VM that will be created. For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} + TargetVirtualMachineID *string -// GetAzureWorkloadSAPHanaPointInTimeRestoreRequest implements the AzureWorkloadSAPHanaPointInTimeRestoreRequestClassification -// interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) GetAzureWorkloadSAPHanaPointInTimeRestoreRequest() *AzureWorkloadSAPHanaPointInTimeRestoreRequest { - return a -} + // This is the virtual network Id of the vnet that will be attached to the virtual machine. User will be validated for join + // action permissions in the linked access. + VirtualNetworkID *string -// GetAzureWorkloadSAPHanaRestoreRequest implements the AzureWorkloadSAPHanaRestoreRequestClassification interface for type -// AzureWorkloadSAPHanaPointInTimeRestoreRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) GetAzureWorkloadSAPHanaRestoreRequest() *AzureWorkloadSAPHanaRestoreRequest { - return &AzureWorkloadSAPHanaRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } + // Target zone where the VM and its disks should be restored. + Zones []*string } -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) GetRestoreRequest() *RestoreRequest { +// GetRestoreRequest implements the RestoreRequestClassification interface for type IaasVMRestoreRequest. +func (i *IaasVMRestoreRequest) GetRestoreRequest() *RestoreRequest { return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, + ObjectType: i.ObjectType, } } -// AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest - AzureWorkload SAP Hana-specific restore with integrated rehydration -// of recovery point. -type AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. +// IdentityBasedRestoreDetails - IaaS VM workload specific restore details for restores using managed identity +type IdentityBasedRestoreDetails struct { + // Gets the class type. ObjectType *string - // PointInTime value - PointInTime *time.Time - - // Workload specific property bag. - PropertyBag map[string]*string - - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode - - // RP Rehydration Info - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo + // Fully qualified ARM ID of the target storage account. + TargetStorageAccountID *string +} - // Type of this recovery. - RecoveryType *RecoveryType +// IdentityInfo - Encapsulates Managed Identity related information +type IdentityInfo struct { + // To differentiate if the managed identity is system assigned or user assigned + IsSystemAssignedIdentity *bool - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string + // Managed Identity Resource Id Optional: Might not be required in the case of system assigned managed identity + ManagedIdentityResourceID *string +} - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters +// InstantItemRecoveryTarget - Target details for file / folder restore. +type InstantItemRecoveryTarget struct { + // List of client scripts. + ClientScripts []*ClientScriptForConnect +} - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string +// Job - Defines workload agnostic properties for a job. +type Job struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + JobType *string - // Details of target database - TargetInfo *TargetRestoreInfo + // ActivityId of job. + ActivityID *string - // Defines the Resource group of the Target VM - TargetResourceGroupName *string + // Backup management type to execute the current job. + BackupManagementType *BackupManagementType - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string + // The end time. + EndTime *time.Time - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} + // Friendly name of the entity on which the current job is executing. + EntityFriendlyName *string -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} + // The operation name. + Operation *string -// GetAzureWorkloadSAPHanaPointInTimeRestoreRequest implements the AzureWorkloadSAPHanaPointInTimeRestoreRequestClassification -// interface for type AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) GetAzureWorkloadSAPHanaPointInTimeRestoreRequest() *AzureWorkloadSAPHanaPointInTimeRestoreRequest { - return &AzureWorkloadSAPHanaPointInTimeRestoreRequest{ - ObjectType: a.ObjectType, - PointInTime: a.PointInTime, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} + // The start time. + StartTime *time.Time -// GetAzureWorkloadSAPHanaRestoreRequest implements the AzureWorkloadSAPHanaRestoreRequestClassification interface for type -// AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) GetAzureWorkloadSAPHanaRestoreRequest() *AzureWorkloadSAPHanaRestoreRequest { - return &AzureWorkloadSAPHanaRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } + // Job status. + Status *string } -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} +// GetJob implements the JobClassification interface for type Job. +func (j *Job) GetJob() *Job { return j } -// AzureWorkloadSAPHanaRecoveryPoint - SAPHana specific recoverypoint, specifically encapsulates full/diff recoverypoints -type AzureWorkloadSAPHanaRecoveryPoint struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string +// JobQueryObject - Filters to list the jobs. +type JobQueryObject struct { + // Type of backup management for the job. + BackupManagementType *BackupManagementType - // Eligibility of RP to be moved to another tier - RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo + // Job has ended at this time. Value is in UTC. + EndTime *time.Time - // Properties of Recovery Point - RecoveryPointProperties *RecoveryPointProperties + // JobID represents the job uniquely. + JobID *string - // Recovery point tier information. - RecoveryPointTierDetails []*RecoveryPointTierInformationV2 + // Type of operation. + Operation *JobOperationType - // UTC time at which recovery point was created - RecoveryPointTimeInUTC *time.Time + // Job has started at this time. Value is in UTC. + StartTime *time.Time - // Type of restore point - Type *RestorePointType + // Status of the job. + Status *JobStatus } -// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSAPHanaRecoveryPoint. -func (a *AzureWorkloadSAPHanaRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { - return &AzureWorkloadRecoveryPoint{ - ObjectType: a.ObjectType, - RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, - RecoveryPointProperties: a.RecoveryPointProperties, - RecoveryPointTierDetails: a.RecoveryPointTierDetails, - RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, - Type: a.Type, - } -} - -// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSAPHanaRecoveryPoint. -func (a *AzureWorkloadSAPHanaRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { - return &RecoveryPoint{ - ObjectType: a.ObjectType, - } -} +// JobResource - Defines workload agnostic properties for a job. +type JobResource struct { + // Optional ETag. + ETag *string -// AzureWorkloadSAPHanaRestoreRequest - AzureWorkload SAP Hana-specific restore. -type AzureWorkloadSAPHanaRestoreRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string + // Resource location. + Location *string - // Workload specific property bag. - PropertyBag map[string]*string + // JobResource properties + Properties JobClassification - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode + // Resource tags. + Tags map[string]*string - // Type of this recovery. - RecoveryType *RecoveryType + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string + // READ-ONLY; Resource name associated with the resource. + Name *string - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string +} - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string +// JobResourceList - List of Job resources +type JobResourceList struct { + // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. + NextLink *string - // Details of target database - TargetInfo *TargetRestoreInfo + // List of resources. + Value []*JobResource +} - // Defines the Resource group of the Target VM - TargetResourceGroupName *string +// KEKDetails - KEK is encryption key for BEK. +type KEKDetails struct { + // KEK data. + KeyBackupData *string - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string + // Key is KEK. + KeyURL *string - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails + // Key Vault ID where this Key is stored. + KeyVaultID *string } -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSAPHanaRestoreRequest. -func (a *AzureWorkloadSAPHanaRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} +// KPIResourceHealthDetails - KPI Resource Health Details +type KPIResourceHealthDetails struct { + // Resource Health Status + ResourceHealthDetails []*ResourceHealthDetails -// GetAzureWorkloadSAPHanaRestoreRequest implements the AzureWorkloadSAPHanaRestoreRequestClassification interface for type -// AzureWorkloadSAPHanaRestoreRequest. -func (a *AzureWorkloadSAPHanaRestoreRequest) GetAzureWorkloadSAPHanaRestoreRequest() *AzureWorkloadSAPHanaRestoreRequest { - return a + // Resource Health Status + ResourceHealthStatus *ResourceHealthStatus } -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSAPHanaRestoreRequest. -func (a *AzureWorkloadSAPHanaRestoreRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } +// KeyAndSecretDetails - BEK is bitlocker key. KEK is encryption key for BEK If the VM was encrypted then we will store following +// details : +// 1. Secret(BEK) - Url + Backup Data + vaultId. +// 2. Key(KEK) - Url + Backup Data + vaultId. +// 3. EncryptionMechanism BEK and KEK can potentially have different vault ids. +type KeyAndSecretDetails struct { + // BEK is bitlocker encryption key. + BekDetails *BEKDetails + + // Encryption mechanism: None/ SinglePass/ DoublePass + EncryptionMechanism *string + + // KEK is encryption key for BEK. + KekDetails *KEKDetails } -// AzureWorkloadSAPHanaRestoreWithRehydrateRequest - AzureWorkload SAP Hana-specific restore with integrated rehydration of -// recovery point. -type AzureWorkloadSAPHanaRestoreWithRehydrateRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string +// MabErrorInfo - MAB workload-specific error information. +type MabErrorInfo struct { + // READ-ONLY; Localized error string. + ErrorString *string - // Workload specific property bag. - PropertyBag map[string]*string + // READ-ONLY; List of localized recommendations. + Recommendations []*string +} - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode +// MabFileFolderProtectedItem - MAB workload-specific backup item. +type MabFileFolderProtectedItem struct { + // REQUIRED; backup item type. + ProtectedItemType *string - // RP Rehydration Info - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType - // Type of this recovery. - RecoveryType *RecoveryType + // Name of the backup set the backup item belongs to + BackupSetName *string - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string + // Name of the computer associated with this backup item. + ComputerName *string - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters + // Unique name of container + ContainerName *string - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string + // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. + CreateMode *CreateMode - // Details of target database - TargetInfo *TargetRestoreInfo + // Sync time for deferred deletion in UTC + DeferredDeleteSyncTimeInUTC *int64 - // Defines the Resource group of the Target VM - TargetResourceGroupName *string + // Time for deferred deletion in UTC + DeferredDeleteTimeInUTC *time.Time - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string + // Time remaining before the DS marked for deferred delete is permanently deleted + DeferredDeleteTimeRemaining *string - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} + // Additional information with this backup item. + ExtendedInfo *MabFileFolderProtectedItemExtendedInfo -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSAPHanaRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaRestoreWithRehydrateRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} + // Friendly name of this backup item. + FriendlyName *string -// GetAzureWorkloadSAPHanaRestoreRequest implements the AzureWorkloadSAPHanaRestoreRequestClassification interface for type -// AzureWorkloadSAPHanaRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaRestoreWithRehydrateRequest) GetAzureWorkloadSAPHanaRestoreRequest() *AzureWorkloadSAPHanaRestoreRequest { - return &AzureWorkloadSAPHanaRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} + // Flag to identify whether the deferred deleted DS is to be purged soon + IsDeferredDeleteScheduleUpcoming *bool -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSAPHanaRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaRestoreWithRehydrateRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} + // Flag to identify that deferred deleted DS is to be moved into Pause state + IsRehydrate *bool -// AzureWorkloadSQLAutoProtectionIntent - Azure Workload SQL Auto Protection intent item. -type AzureWorkloadSQLAutoProtectionIntent struct { - // REQUIRED; backup protectionIntent type. - ProtectionIntentItemType *ProtectionIntentItemType + // Flag to identify whether the DS is scheduled for deferred delete + IsScheduledForDeferredDelete *bool - // Type of backup management for the backed up item. - BackupManagementType *BackupManagementType + // Status of last backup operation. + LastBackupStatus *string + + // Timestamp of the last backup operation on this backup item. + LastBackupTime *time.Time - // ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId - ItemID *string + // Timestamp when the last (latest) backup copy was created for this backup item. + LastRecoveryPoint *time.Time // ID of the backup policy with which this item is backed up. PolicyID *string - // Backup state of this backup item. - ProtectionState *ProtectionStatus + // Protected, ProtectionStopped, IRPending or ProtectionError + ProtectionState *string + + // ResourceGuardOperationRequests on which LAC check will be performed + ResourceGuardOperationRequests []*string // ARM ID of the resource to be backed up. SourceResourceID *string - // Workload item type of the item for which intent is to be set - WorkloadItemType *WorkloadItemType + // Type of workload this item represents. + WorkloadType *DataSourceType } -// GetAzureRecoveryServiceVaultProtectionIntent implements the AzureRecoveryServiceVaultProtectionIntentClassification interface -// for type AzureWorkloadSQLAutoProtectionIntent. -func (a *AzureWorkloadSQLAutoProtectionIntent) GetAzureRecoveryServiceVaultProtectionIntent() *AzureRecoveryServiceVaultProtectionIntent { - return &AzureRecoveryServiceVaultProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, +// GetProtectedItem implements the ProtectedItemClassification interface for type MabFileFolderProtectedItem. +func (m *MabFileFolderProtectedItem) GetProtectedItem() *ProtectedItem { + return &ProtectedItem{ + BackupManagementType: m.BackupManagementType, + BackupSetName: m.BackupSetName, + ContainerName: m.ContainerName, + CreateMode: m.CreateMode, + DeferredDeleteTimeInUTC: m.DeferredDeleteTimeInUTC, + DeferredDeleteTimeRemaining: m.DeferredDeleteTimeRemaining, + IsDeferredDeleteScheduleUpcoming: m.IsDeferredDeleteScheduleUpcoming, + IsRehydrate: m.IsRehydrate, + IsScheduledForDeferredDelete: m.IsScheduledForDeferredDelete, + LastRecoveryPoint: m.LastRecoveryPoint, + PolicyID: m.PolicyID, + ProtectedItemType: m.ProtectedItemType, + ResourceGuardOperationRequests: m.ResourceGuardOperationRequests, + SourceResourceID: m.SourceResourceID, + WorkloadType: m.WorkloadType, } } -// GetAzureWorkloadAutoProtectionIntent implements the AzureWorkloadAutoProtectionIntentClassification interface for type -// AzureWorkloadSQLAutoProtectionIntent. -func (a *AzureWorkloadSQLAutoProtectionIntent) GetAzureWorkloadAutoProtectionIntent() *AzureWorkloadAutoProtectionIntent { - return &AzureWorkloadAutoProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, - } -} +// MabFileFolderProtectedItemExtendedInfo - Additional information on the backed up item. +type MabFileFolderProtectedItemExtendedInfo struct { + // Last time when the agent data synced to service. + LastRefreshedAt *time.Time -// GetProtectionIntent implements the ProtectionIntentClassification interface for type AzureWorkloadSQLAutoProtectionIntent. -func (a *AzureWorkloadSQLAutoProtectionIntent) GetProtectionIntent() *ProtectionIntent { - return &ProtectionIntent{ - BackupManagementType: a.BackupManagementType, - ItemID: a.ItemID, - PolicyID: a.PolicyID, - ProtectionIntentItemType: a.ProtectionIntentItemType, - ProtectionState: a.ProtectionState, - SourceResourceID: a.SourceResourceID, - } + // The oldest backup copy available. + OldestRecoveryPoint *time.Time + + // Number of backup copies associated with the backup item. + RecoveryPointCount *int32 } -// AzureWorkloadSQLPointInTimeRecoveryPoint - Recovery point specific to PointInTime -type AzureWorkloadSQLPointInTimeRecoveryPoint struct { +// MabJob - MAB workload-specific job. +type MabJob struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string + JobType *string - // Extended Info that provides data directory details. Will be populated in two cases: When a specific recovery point is accessed - // using GetRecoveryPoint Or when ListRecoveryPoints is called for Log RP - // only with ExtendedInfo query filter - ExtendedInfo *AzureWorkloadSQLRecoveryPointExtendedInfo + // The state/actions applicable on jobs like cancel/retry. + ActionsInfo []*JobSupportedAction - // Eligibility of RP to be moved to another tier - RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo + // ActivityId of job. + ActivityID *string - // Properties of Recovery Point - RecoveryPointProperties *RecoveryPointProperties + // Backup management type to execute the current job. + BackupManagementType *BackupManagementType - // Recovery point tier information. - RecoveryPointTierDetails []*RecoveryPointTierInformationV2 + // Time taken by job to run. + Duration *string - // UTC time at which recovery point was created - RecoveryPointTimeInUTC *time.Time + // The end time. + EndTime *time.Time - // List of log ranges - TimeRanges []*PointInTimeRange + // Friendly name of the entity on which the current job is executing. + EntityFriendlyName *string - // Type of restore point - Type *RestorePointType -} + // The errors. + ErrorDetails []*MabErrorInfo -// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. -func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { - return &AzureWorkloadRecoveryPoint{ - ObjectType: a.ObjectType, - RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, - RecoveryPointProperties: a.RecoveryPointProperties, - RecoveryPointTierDetails: a.RecoveryPointTierDetails, - RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, - Type: a.Type, - } -} - -// GetAzureWorkloadSQLRecoveryPoint implements the AzureWorkloadSQLRecoveryPointClassification interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. -func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) GetAzureWorkloadSQLRecoveryPoint() *AzureWorkloadSQLRecoveryPoint { - return &AzureWorkloadSQLRecoveryPoint{ - ExtendedInfo: a.ExtendedInfo, - ObjectType: a.ObjectType, - RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, - RecoveryPointProperties: a.RecoveryPointProperties, - RecoveryPointTierDetails: a.RecoveryPointTierDetails, - RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, - Type: a.Type, - } -} - -// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. -func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { - return &RecoveryPoint{ - ObjectType: a.ObjectType, - } -} - -// AzureWorkloadSQLPointInTimeRestoreRequest - AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore -type AzureWorkloadSQLPointInTimeRestoreRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Data directory details - AlternateDirectoryPaths []*SQLDataDirectoryMapping - - // SQL specific property where user can chose to set no-recovery when restore operation is tried - IsNonRecoverable *bool - - // PointInTime value - PointInTime *time.Time - - // Workload specific property bag. - PropertyBag map[string]*string - - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode - - // Type of this recovery. - RecoveryType *RecoveryType - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Default option set to true. If this is set to false, alternate data directory must be provided - ShouldUseAlternateTargetLocation *bool - - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters - - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string - - // Details of target database - TargetInfo *TargetRestoreInfo - - // Defines the Resource group of the Target VM - TargetResourceGroupName *string - - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string - - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} - -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetAzureWorkloadSQLPointInTimeRestoreRequest implements the AzureWorkloadSQLPointInTimeRestoreRequestClassification interface -// for type AzureWorkloadSQLPointInTimeRestoreRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreRequest) GetAzureWorkloadSQLPointInTimeRestoreRequest() *AzureWorkloadSQLPointInTimeRestoreRequest { - return a -} - -// GetAzureWorkloadSQLRestoreRequest implements the AzureWorkloadSQLRestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreRequest) GetAzureWorkloadSQLRestoreRequest() *AzureWorkloadSQLRestoreRequest { - return &AzureWorkloadSQLRestoreRequest{ - AlternateDirectoryPaths: a.AlternateDirectoryPaths, - IsNonRecoverable: a.IsNonRecoverable, - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - ShouldUseAlternateTargetLocation: a.ShouldUseAlternateTargetLocation, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} - -// AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest - AzureWorkload SQL-specific restore with integrated rehydration -// of recovery point. -type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Data directory details - AlternateDirectoryPaths []*SQLDataDirectoryMapping - - // SQL specific property where user can chose to set no-recovery when restore operation is tried - IsNonRecoverable *bool - - // PointInTime value - PointInTime *time.Time - - // Workload specific property bag. - PropertyBag map[string]*string - - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode - - // RP Rehydration Info - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo - - // Type of this recovery. - RecoveryType *RecoveryType - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Default option set to true. If this is set to false, alternate data directory must be provided - ShouldUseAlternateTargetLocation *bool - - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters - - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string - - // Details of target database - TargetInfo *TargetRestoreInfo - - // Defines the Resource group of the Target VM - TargetResourceGroupName *string - - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string - - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} - -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetAzureWorkloadSQLPointInTimeRestoreRequest implements the AzureWorkloadSQLPointInTimeRestoreRequestClassification interface -// for type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) GetAzureWorkloadSQLPointInTimeRestoreRequest() *AzureWorkloadSQLPointInTimeRestoreRequest { - return &AzureWorkloadSQLPointInTimeRestoreRequest{ - AlternateDirectoryPaths: a.AlternateDirectoryPaths, - IsNonRecoverable: a.IsNonRecoverable, - ObjectType: a.ObjectType, - PointInTime: a.PointInTime, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - ShouldUseAlternateTargetLocation: a.ShouldUseAlternateTargetLocation, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetAzureWorkloadSQLRestoreRequest implements the AzureWorkloadSQLRestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) GetAzureWorkloadSQLRestoreRequest() *AzureWorkloadSQLRestoreRequest { - return &AzureWorkloadSQLRestoreRequest{ - AlternateDirectoryPaths: a.AlternateDirectoryPaths, - IsNonRecoverable: a.IsNonRecoverable, - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - ShouldUseAlternateTargetLocation: a.ShouldUseAlternateTargetLocation, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} - -// AzureWorkloadSQLRecoveryPoint - SQL specific recoverypoint, specifically encapsulates full/diff recoverypoint along with -// extended info -type AzureWorkloadSQLRecoveryPoint struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Extended Info that provides data directory details. Will be populated in two cases: When a specific recovery point is accessed - // using GetRecoveryPoint Or when ListRecoveryPoints is called for Log RP - // only with ExtendedInfo query filter - ExtendedInfo *AzureWorkloadSQLRecoveryPointExtendedInfo - - // Eligibility of RP to be moved to another tier - RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo + // Additional information on the job. + ExtendedInfo *MabJobExtendedInfo - // Properties of Recovery Point - RecoveryPointProperties *RecoveryPointProperties + // Name of server protecting the DS. + MabServerName *string - // Recovery point tier information. - RecoveryPointTierDetails []*RecoveryPointTierInformationV2 + // Server type of MAB container. + MabServerType *MabServerType - // UTC time at which recovery point was created - RecoveryPointTimeInUTC *time.Time + // The operation name. + Operation *string - // Type of restore point - Type *RestorePointType -} + // The start time. + StartTime *time.Time -// GetAzureWorkloadRecoveryPoint implements the AzureWorkloadRecoveryPointClassification interface for type AzureWorkloadSQLRecoveryPoint. -func (a *AzureWorkloadSQLRecoveryPoint) GetAzureWorkloadRecoveryPoint() *AzureWorkloadRecoveryPoint { - return &AzureWorkloadRecoveryPoint{ - ObjectType: a.ObjectType, - RecoveryPointMoveReadinessInfo: a.RecoveryPointMoveReadinessInfo, - RecoveryPointProperties: a.RecoveryPointProperties, - RecoveryPointTierDetails: a.RecoveryPointTierDetails, - RecoveryPointTimeInUTC: a.RecoveryPointTimeInUTC, - Type: a.Type, - } -} + // Job status. + Status *string -// GetAzureWorkloadSQLRecoveryPoint implements the AzureWorkloadSQLRecoveryPointClassification interface for type AzureWorkloadSQLRecoveryPoint. -func (a *AzureWorkloadSQLRecoveryPoint) GetAzureWorkloadSQLRecoveryPoint() *AzureWorkloadSQLRecoveryPoint { - return a + // Workload type of backup item. + WorkloadType *WorkloadType } -// GetRecoveryPoint implements the RecoveryPointClassification interface for type AzureWorkloadSQLRecoveryPoint. -func (a *AzureWorkloadSQLRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { - return &RecoveryPoint{ - ObjectType: a.ObjectType, +// GetJob implements the JobClassification interface for type MabJob. +func (m *MabJob) GetJob() *Job { + return &Job{ + ActivityID: m.ActivityID, + BackupManagementType: m.BackupManagementType, + EndTime: m.EndTime, + EntityFriendlyName: m.EntityFriendlyName, + JobType: m.JobType, + Operation: m.Operation, + StartTime: m.StartTime, + Status: m.Status, } } -// AzureWorkloadSQLRecoveryPointExtendedInfo - Extended info class details -type AzureWorkloadSQLRecoveryPointExtendedInfo struct { - // List of data directory paths during restore operation. - DataDirectoryPaths []*SQLDataDirectory - - // UTC time at which data directory info was captured - DataDirectoryTimeInUTC *time.Time -} - -// AzureWorkloadSQLRestoreRequest - AzureWorkload SQL -specific restore. Specifically for full/diff restore -type AzureWorkloadSQLRestoreRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Data directory details - AlternateDirectoryPaths []*SQLDataDirectoryMapping - - // SQL specific property where user can chose to set no-recovery when restore operation is tried - IsNonRecoverable *bool +// MabJobExtendedInfo - Additional information for the MAB workload-specific job. +type MabJobExtendedInfo struct { + // Non localized error message specific to this job. + DynamicErrorMessage *string - // Workload specific property bag. + // The job properties. PropertyBag map[string]*string - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode - - // Type of this recovery. - RecoveryType *RecoveryType - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Default option set to true. If this is set to false, alternate data directory must be provided - ShouldUseAlternateTargetLocation *bool - - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters - - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string - - // Details of target database - TargetInfo *TargetRestoreInfo - - // Defines the Resource group of the Target VM - TargetResourceGroupName *string - - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string - - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} - -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSQLRestoreRequest. -func (a *AzureWorkloadSQLRestoreRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetAzureWorkloadSQLRestoreRequest implements the AzureWorkloadSQLRestoreRequestClassification interface for type AzureWorkloadSQLRestoreRequest. -func (a *AzureWorkloadSQLRestoreRequest) GetAzureWorkloadSQLRestoreRequest() *AzureWorkloadSQLRestoreRequest { - return a -} - -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSQLRestoreRequest. -func (a *AzureWorkloadSQLRestoreRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} - -// AzureWorkloadSQLRestoreWithRehydrateRequest - AzureWorkload SQL-specific restore with integrated rehydration of recovery -// point -type AzureWorkloadSQLRestoreWithRehydrateRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Data directory details - AlternateDirectoryPaths []*SQLDataDirectoryMapping - - // SQL specific property where user can chose to set no-recovery when restore operation is tried - IsNonRecoverable *bool - - // Workload specific property bag. - PropertyBag map[string]*string - - // Defines whether the current recovery mode is file restore or database restore - RecoveryMode *RecoveryMode - - // RP Rehydration Info - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo - - // Type of this recovery. - RecoveryType *RecoveryType - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Default option set to true. If this is set to false, alternate data directory must be provided - ShouldUseAlternateTargetLocation *bool - - // Additional details for snapshot recovery Currently used for snapshot for SAP Hana. - SnapshotRestoreParameters *SnapshotRestoreParameters - - // Fully qualified ARM ID of the VM on which workload that was running is being recovered. - SourceResourceID *string - - // Details of target database - TargetInfo *TargetRestoreInfo - - // Defines the Resource group of the Target VM - TargetResourceGroupName *string - - // This is the complete ARM Id of the target VM For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string - - // User Assigned managed identity details Currently used for snapshot. - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails -} - -// GetAzureWorkloadRestoreRequest implements the AzureWorkloadRestoreRequestClassification interface for type AzureWorkloadSQLRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLRestoreWithRehydrateRequest) GetAzureWorkloadRestoreRequest() *AzureWorkloadRestoreRequest { - return &AzureWorkloadRestoreRequest{ - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetAzureWorkloadSQLRestoreRequest implements the AzureWorkloadSQLRestoreRequestClassification interface for type AzureWorkloadSQLRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLRestoreWithRehydrateRequest) GetAzureWorkloadSQLRestoreRequest() *AzureWorkloadSQLRestoreRequest { - return &AzureWorkloadSQLRestoreRequest{ - AlternateDirectoryPaths: a.AlternateDirectoryPaths, - IsNonRecoverable: a.IsNonRecoverable, - ObjectType: a.ObjectType, - PropertyBag: a.PropertyBag, - RecoveryMode: a.RecoveryMode, - RecoveryType: a.RecoveryType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - ShouldUseAlternateTargetLocation: a.ShouldUseAlternateTargetLocation, - SnapshotRestoreParameters: a.SnapshotRestoreParameters, - SourceResourceID: a.SourceResourceID, - TargetInfo: a.TargetInfo, - TargetResourceGroupName: a.TargetResourceGroupName, - TargetVirtualMachineID: a.TargetVirtualMachineID, - UserAssignedManagedIdentityDetails: a.UserAssignedManagedIdentityDetails, - } -} - -// GetRestoreRequest implements the RestoreRequestClassification interface for type AzureWorkloadSQLRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLRestoreWithRehydrateRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: a.ObjectType, - ResourceGuardOperationRequests: a.ResourceGuardOperationRequests, - } -} - -// BEKDetails - BEK is bitlocker encryption key. -type BEKDetails struct { - // BEK data. - SecretData *string - - // Secret is BEK. - SecretURL *string - - // ID of the Key Vault where this Secret is stored. - SecretVaultID *string -} - -// BMSBackupEngineQueryObject - Query parameters to fetch list of backup engines. -type BMSBackupEngineQueryObject struct { - // attribute to add extended info - Expand *string -} - -// BMSBackupEnginesQueryObject - Query parameters to fetch list of backup engines. -type BMSBackupEnginesQueryObject struct { - // Backup management type for the backup engine. - BackupManagementType *BackupManagementType - - // Attribute to add extended info. - Expand *string - - // Friendly name of the backup engine. - FriendlyName *string -} - -// BMSBackupSummariesQueryObject - Query parameters to fetch backup summaries. -type BMSBackupSummariesQueryObject struct { - // Backup management type for this container. - Type *Type -} - -// BMSContainerQueryObject - The query filters that can be used with the list containers API. -type BMSContainerQueryObject struct { - // REQUIRED; Backup management type for this container. - BackupManagementType *BackupManagementType - - // Backup engine name - BackupEngineName *string - - // Type of container for filter - ContainerType *ContainerType - - // Fabric name for filter - FabricName *string - - // Friendly name of this container. - FriendlyName *string - - // Status of registration of this container with the Recovery Services Vault. - Status *string -} - -// BMSContainersInquiryQueryObject - The query filters that can be used with the inquire container API. -type BMSContainersInquiryQueryObject struct { - // Backup management type for this container. - BackupManagementType *BackupManagementType - - // Workload type for this container. - WorkloadType *WorkloadType -} - -// BMSPOQueryObject - Filters to list items that can be backed up. -type BMSPOQueryObject struct { - // Backup management type. - BackupManagementType *BackupManagementType - - // Full name of the container whose Protectable Objects should be returned. - ContainerName *string - - // Friendly name. - FriendlyName *string - - // Backup status query parameter. - Status *string - - // Workload type - WorkloadType *WorkloadType -} - -// BMSRPQueryObject - Filters to list backup copies. -type BMSRPQueryObject struct { - // Backup copies created before this time. - EndDate *time.Time - - // In Get Recovery Point, it tells whether extended information about recovery point is asked. - ExtendedInfo *bool - - // Flag to indicate whether Soft Deleted RPs should be included/excluded from result. - IncludeSoftDeletedRP *bool - - // Whether the RP can be moved to another tier - MoveReadyRPOnly *bool - - // RestorePoint type - RestorePointQueryType *RestorePointQueryType - - // Backup copies created after this time. - StartDate *time.Time -} - -// BMSRefreshContainersQueryObject - The query filters that can be used with the refresh container API. -type BMSRefreshContainersQueryObject struct { - // Backup management type for this container. - BackupManagementType *BackupManagementType -} - -// BMSWorkloadItemQueryObject - Filters to list items that can be backed up. -type BMSWorkloadItemQueryObject struct { - // Backup management type. - BackupManagementType *BackupManagementType - - // Backup status query parameter. - ProtectionStatus *ProtectionStatus - - // Workload Item type - WorkloadItemType *WorkloadItemType - - // Workload type - WorkloadType *WorkloadType -} - -// BackupEngineBase - The base backup engine class. All workload specific backup engines derive from this class. -type BackupEngineBase struct { - // REQUIRED; Type of the backup engine. - BackupEngineType *BackupEngineType - - // Backup agent version - AzureBackupAgentVersion *string - - // ID of the backup engine. - BackupEngineID *string - - // Status of the backup engine with the Recovery Services Vault. = {Active/Deleting/DeleteFailed} - BackupEngineState *string - - // Type of backup management for the backup engine. - BackupManagementType *BackupManagementType - - // Flag indicating if the backup engine be registered, once already registered. - CanReRegister *bool - - // Backup engine version - DpmVersion *string - - // Extended info of the backupengine - ExtendedInfo *BackupEngineExtendedInfo - - // Friendly name of the backup engine. - FriendlyName *string - - // Backup status of the backup engine. - HealthStatus *string - - // To check if backup agent upgrade available - IsAzureBackupAgentUpgradeAvailable *bool - - // To check if backup engine upgrade available - IsDpmUpgradeAvailable *bool - - // Registration status of the backup engine with the Recovery Services Vault. - RegistrationStatus *string -} - -// GetBackupEngineBase implements the BackupEngineBaseClassification interface for type BackupEngineBase. -func (b *BackupEngineBase) GetBackupEngineBase() *BackupEngineBase { return b } - -// BackupEngineBaseResource - The base backup engine class. All workload specific backup engines derive from this class. -type BackupEngineBaseResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // BackupEngineBaseResource properties - Properties BackupEngineBaseClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// BackupEngineBaseResourceList - List of BackupEngineBase resources -type BackupEngineBaseResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*BackupEngineBaseResource -} - -// BackupEngineExtendedInfo - Additional information on backup engine. -type BackupEngineExtendedInfo struct { - // Disk space currently available in the backup engine. - AvailableDiskSpace *float64 - - // Protected instances in the backup engine. - AzureProtectedInstances *int32 - - // Database name of backup engine. - DatabaseName *string - - // Number of disks in the backup engine. - DiskCount *int32 - - // Number of protected items in the backup engine. - ProtectedItemsCount *int32 - - // Number of protected servers in the backup engine. - ProtectedServersCount *int32 - - // Last refresh time in the backup engine. - RefreshedAt *time.Time - - // Disk space used in the backup engine. - UsedDiskSpace *float64 -} - -// BackupManagementUsage - Backup management usages of a vault. -type BackupManagementUsage struct { - // Current value of usage. - CurrentValue *int64 - - // Limit of usage. - Limit *int64 - - // Name of usage. - Name *NameInfo - - // Next reset time of usage. - NextResetTime *time.Time - - // Quota period of usage. - QuotaPeriod *string - - // Unit of the usage. - Unit *UsagesUnit -} - -// BackupManagementUsageList - Backup management usage for vault. -type BackupManagementUsageList struct { - // The list of backup management usages for the given vault. - Value []*BackupManagementUsage -} - -// BackupRequest - Base class for backup request. Workload-specific backup requests are derived from this class. -type BackupRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string -} - -// GetBackupRequest implements the BackupRequestClassification interface for type BackupRequest. -func (b *BackupRequest) GetBackupRequest() *BackupRequest { return b } - -// BackupRequestResource - Base class for backup request. Workload-specific backup requests are derived from this class. -type BackupRequestResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // BackupRequestResource properties - Properties BackupRequestClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// BackupResourceConfig - The resource storage details. -type BackupResourceConfig struct { - // Opt in details of Cross Region Restore feature. - CrossRegionRestoreFlag *bool - - // Vault Dedup state - DedupState *DedupState - - // Storage type - StorageModelType *StorageType - - // Storage type. - StorageType *StorageType - - // Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. - StorageTypeState *StorageTypeState - - // Vault x-cool state - XcoolState *XcoolState -} - -// BackupResourceConfigResource - The resource storage details. -type BackupResourceConfigResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // BackupResourceConfigResource properties - Properties *BackupResourceConfig - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -type BackupResourceEncryptionConfig struct { - // Encryption At Rest Type - EncryptionAtRestType *EncryptionAtRestType - InfrastructureEncryptionState *InfrastructureEncryptionState - - // Key Vault Key URI - KeyURI *string - LastUpdateStatus *LastUpdateStatus - - // Key Vault Subscription Id - SubscriptionID *string -} - -type BackupResourceEncryptionConfigExtended struct { - // Encryption At Rest Type - EncryptionAtRestType *EncryptionAtRestType - InfrastructureEncryptionState *InfrastructureEncryptionState - - // Key Vault Key URI - KeyURI *string - LastUpdateStatus *LastUpdateStatus - - // Key Vault Subscription Id - SubscriptionID *string - - // bool to indicate whether to use system Assigned Identity or not - UseSystemAssignedIdentity *bool - - // User Assigned Identity Id - UserAssignedIdentity *string -} - -type BackupResourceEncryptionConfigExtendedResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // BackupResourceEncryptionConfigExtendedResource properties - Properties *BackupResourceEncryptionConfigExtended - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -type BackupResourceEncryptionConfigResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // BackupResourceEncryptionConfigResource properties - Properties *BackupResourceEncryptionConfig - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// BackupResourceVaultConfig - Backup resource vault config details. -type BackupResourceVaultConfig struct { - // Enabled or Disabled. - EnhancedSecurityState *EnhancedSecurityState - - // This flag is no longer in use. Please use 'softDeleteFeatureState' to set the soft delete state for the vault - IsSoftDeleteFeatureStateEditable *bool - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string - - // Soft Delete feature state - SoftDeleteFeatureState *SoftDeleteFeatureState - - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - - // Storage type. - StorageModelType *StorageType - - // Storage type. - StorageType *StorageType - - // Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. - StorageTypeState *StorageTypeState -} - -// BackupResourceVaultConfigResource - Backup resource vault config details. -type BackupResourceVaultConfigResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // BackupResourceVaultConfigResource properties - Properties *BackupResourceVaultConfig - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// BackupStatusRequest - BackupStatus request. -type BackupStatusRequest struct { - // Protectable Item Logical Name - PoLogicalName *string - - // Entire ARM resource id of the resource - ResourceID *string - - // Container Type - VM, SQLPaaS, DPM, AzureFileShare… - ResourceType *DataSourceType -} - -// BackupStatusResponse - BackupStatus response. -type BackupStatusResponse struct { - // Specifies whether the storage account lock has been acquired or not - AcquireStorageAccountLock *AcquireStorageAccountLock - - // Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;csname;vmname. - ContainerName *string - - // ErrorCode in case of intent failed - ErrorCode *string - - // ErrorMessage in case of intent failed. - ErrorMessage *string - - // Specifies the fabric name - Azure or AD - FabricName *FabricName - - // Specifies the policy name which is used for protection - PolicyName *string - - // Specifies the product specific ds name. E.g. vm;iaasvmcontainer;csname;vmname. - ProtectedItemName *string - - // Number of protected items - ProtectedItemsCount *int32 - - // Specifies whether the container is registered or not - ProtectionStatus *ProtectionStatus - - // Container registration status - RegistrationStatus *string - - // Specifies the arm resource id of the vault - VaultID *string -} - -// ClientDiscoveryDisplay - Localized display information of an operation. -type ClientDiscoveryDisplay struct { - // Description of the operation having details of what operation is about. - Description *string - - // Operations Name itself. - Operation *string - - // Name of the provider for display purposes - Provider *string - - // ResourceType for which this Operation can be performed. - Resource *string -} - -// ClientDiscoveryForLogSpecification - Class to represent shoebox log specification in json client discovery. -type ClientDiscoveryForLogSpecification struct { - // blob duration of shoebox log specification - BlobDuration *string - - // Localized display name - DisplayName *string - - // Name for shoebox log specification. - Name *string -} - -// ClientDiscoveryForProperties - Class to represent shoebox properties in json client discovery. -type ClientDiscoveryForProperties struct { - // Operation properties. - ServiceSpecification *ClientDiscoveryForServiceSpecification -} - -// ClientDiscoveryForServiceSpecification - Class to represent shoebox service specification in json client discovery. -type ClientDiscoveryForServiceSpecification struct { - // List of log specifications of this operation. - LogSpecifications []*ClientDiscoveryForLogSpecification -} - -// ClientDiscoveryResponse - Operations List response which contains list of available APIs. -type ClientDiscoveryResponse struct { - // Link to the next chunk of Response. - NextLink *string - - // List of available operations. - Value []*ClientDiscoveryValueForSingleAPI -} - -// ClientDiscoveryValueForSingleAPI - Available operation details. -type ClientDiscoveryValueForSingleAPI struct { - // Contains the localized display information for this particular operation - Display *ClientDiscoveryDisplay - - // Name of the Operation. - Name *string - - // The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX - Origin *string - - // ShoeBox properties for the given operation. - Properties *ClientDiscoveryForProperties -} - -// ClientScriptForConnect - Client script details for file / folder restore. -type ClientScriptForConnect struct { - // OS type - Windows, Linux etc. for which this file / folder restore client script works. - OSType *string - - // File content of the client script for file / folder restore. - ScriptContent *string - - // File extension of the client script for file / folder restore - .ps1 , .sh , etc. - ScriptExtension *string - - // Mandatory suffix that should be added to the name of script that is given for download to user. If its null or empty then - // , ignore it. - ScriptNameSuffix *string - - // URL of Executable from where to source the content. If this is not null then ScriptContent should not be used - URL *string -} - -// ContainerIdentityInfo - Container identity information -type ContainerIdentityInfo struct { - // Protection container identity - AAD Tenant - AADTenantID *string - - // Protection container identity - Audience - Audience *string - - // Protection container identity - AAD Service Principal - ServicePrincipalClientID *string - - // Unique name of the container - UniqueName *string -} - -// DPMContainerExtendedInfo - Additional information of the DPMContainer. -type DPMContainerExtendedInfo struct { - // Last refresh time of the DPMContainer. - LastRefreshedAt *time.Time -} - -// DPMProtectedItem - Additional information on Backup engine specific backup item. -type DPMProtectedItem struct { - // REQUIRED; backup item type. - ProtectedItemType *string - - // Backup Management server protecting this backup item - BackupEngineName *string - - // Name of the backup set the backup item belongs to - BackupSetName *string - - // Unique name of container - ContainerName *string - - // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. - CreateMode *CreateMode - - // Time for deferred deletion in UTC - DeferredDeleteTimeInUTC *time.Time - - // Time remaining before the DS marked for deferred delete is permanently deleted - DeferredDeleteTimeRemaining *string - - // Extended info of the backup item. - ExtendedInfo *DPMProtectedItemExtendedInfo - - // Friendly name of the managed item - FriendlyName *string - - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool - - // Flag to identify whether the deferred deleted DS is to be purged soon - IsDeferredDeleteScheduleUpcoming *bool - - // Flag to identify that deferred deleted DS is to be moved into Pause state - IsRehydrate *bool - - // Flag to identify whether the DS is scheduled for deferred delete - IsScheduledForDeferredDelete *bool - - // Timestamp when the last (latest) backup copy was created for this backup item. - LastRecoveryPoint *time.Time - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Name of the policy used for protection - PolicyName *string - - // Protection state of the backup engine - ProtectionState *ProtectedItemState - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - - // ARM ID of the resource to be backed up. - SourceResourceID *string - - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. - WorkloadType *DataSourceType -} - -// GetProtectedItem implements the ProtectedItemClassification interface for type DPMProtectedItem. -func (d *DPMProtectedItem) GetProtectedItem() *ProtectedItem { - return &ProtectedItem{ - BackupManagementType: d.BackupManagementType, - BackupSetName: d.BackupSetName, - ContainerName: d.ContainerName, - CreateMode: d.CreateMode, - DeferredDeleteTimeInUTC: d.DeferredDeleteTimeInUTC, - DeferredDeleteTimeRemaining: d.DeferredDeleteTimeRemaining, - IsArchiveEnabled: d.IsArchiveEnabled, - IsDeferredDeleteScheduleUpcoming: d.IsDeferredDeleteScheduleUpcoming, - IsRehydrate: d.IsRehydrate, - IsScheduledForDeferredDelete: d.IsScheduledForDeferredDelete, - LastRecoveryPoint: d.LastRecoveryPoint, - PolicyID: d.PolicyID, - PolicyName: d.PolicyName, - ProtectedItemType: d.ProtectedItemType, - ResourceGuardOperationRequests: d.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: d.SoftDeleteRetentionPeriodInDays, - SourceResourceID: d.SourceResourceID, - VaultID: d.VaultID, - WorkloadType: d.WorkloadType, - } -} - -// DPMProtectedItemExtendedInfo - Additional information of DPM Protected item. -type DPMProtectedItemExtendedInfo struct { - // Used Disk storage in bytes. - DiskStorageUsedInBytes *string - - // To check if backup item is collocated. - IsCollocated *bool - - // To check if backup item is cloud protected. - IsPresentOnCloud *bool - - // Last backup status information on backup item. - LastBackupStatus *string - - // Last refresh time on backup item. - LastRefreshedAt *time.Time - - // Oldest cloud recovery point time. - OldestRecoveryPoint *time.Time - - // latest disk recovery point time. - OnPremiseLatestRecoveryPoint *time.Time - - // Oldest disk recovery point time. - OnPremiseOldestRecoveryPoint *time.Time - - // disk recovery point count. - OnPremiseRecoveryPointCount *int32 - - // Attribute to provide information on various DBs. - ProtectableObjectLoadPath map[string]*string - - // To check if backup item is disk protected. - Protected *bool - - // Protection group name of the backup item. - ProtectionGroupName *string - - // cloud recovery point count. - RecoveryPointCount *int32 - - // total Disk storage in bytes. - TotalDiskStorageSizeInBytes *string -} - -// DailyRetentionFormat - Daily retention format. -type DailyRetentionFormat struct { - // List of days of the month. - DaysOfTheMonth []*Day -} - -// DailyRetentionSchedule - Daily retention schedule. -type DailyRetentionSchedule struct { - // Retention duration of retention Policy. - RetentionDuration *RetentionDuration - - // Retention times of retention policy. - RetentionTimes []*time.Time -} - -type DailySchedule struct { - // List of times of day this schedule has to be run. - ScheduleRunTimes []*time.Time -} - -// Day of the week. -type Day struct { - // Date of the month - Date *int32 - - // Whether Date is last date of month - IsLast *bool -} - -type DiskExclusionProperties struct { - // List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. - DiskLunList []*int32 - - // Flag to indicate whether DiskLunList is to be included/ excluded from backup. - IsInclusionList *bool -} - -// DiskInformation - Disk information -type DiskInformation struct { - Lun *int32 - Name *string -} - -// DistributedNodesInfo - This is used to represent the various nodes of the distributed container. -type DistributedNodesInfo struct { - // Error Details if the Status is non-success. - ErrorDetail *ErrorDetail - - // Name of the node under a distributed container. - NodeName *string - - // ARM resource id of the node - SourceResourceID *string - - // Status of this Node. Failed | Succeeded - Status *string -} - -// DpmBackupEngine - Data Protection Manager (DPM) specific backup engine. -type DpmBackupEngine struct { - // REQUIRED; Type of the backup engine. - BackupEngineType *BackupEngineType - - // Backup agent version - AzureBackupAgentVersion *string - - // ID of the backup engine. - BackupEngineID *string - - // Status of the backup engine with the Recovery Services Vault. = {Active/Deleting/DeleteFailed} - BackupEngineState *string - - // Type of backup management for the backup engine. - BackupManagementType *BackupManagementType - - // Flag indicating if the backup engine be registered, once already registered. - CanReRegister *bool - - // Backup engine version - DpmVersion *string - - // Extended info of the backupengine - ExtendedInfo *BackupEngineExtendedInfo - - // Friendly name of the backup engine. - FriendlyName *string - - // Backup status of the backup engine. - HealthStatus *string - - // To check if backup agent upgrade available - IsAzureBackupAgentUpgradeAvailable *bool - - // To check if backup engine upgrade available - IsDpmUpgradeAvailable *bool - - // Registration status of the backup engine with the Recovery Services Vault. - RegistrationStatus *string -} - -// GetBackupEngineBase implements the BackupEngineBaseClassification interface for type DpmBackupEngine. -func (d *DpmBackupEngine) GetBackupEngineBase() *BackupEngineBase { - return &BackupEngineBase{ - AzureBackupAgentVersion: d.AzureBackupAgentVersion, - BackupEngineID: d.BackupEngineID, - BackupEngineState: d.BackupEngineState, - BackupEngineType: d.BackupEngineType, - BackupManagementType: d.BackupManagementType, - CanReRegister: d.CanReRegister, - DpmVersion: d.DpmVersion, - ExtendedInfo: d.ExtendedInfo, - FriendlyName: d.FriendlyName, - HealthStatus: d.HealthStatus, - IsAzureBackupAgentUpgradeAvailable: d.IsAzureBackupAgentUpgradeAvailable, - IsDpmUpgradeAvailable: d.IsDpmUpgradeAvailable, - RegistrationStatus: d.RegistrationStatus, - } -} - -// DpmContainer - DPM workload-specific protection container. -type DpmContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Specifies whether the container is re-registrable. - CanReRegister *bool - - // ID of container. - ContainerID *string - - // Backup engine Agent version - DpmAgentVersion *string - - // List of BackupEngines protecting the container - DpmServers []*string - - // Extended Info of the container. - ExtendedInfo *DPMContainerExtendedInfo - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Number of protected items in the BackupEngine - ProtectedItemCount *int64 - - // Protection status of the container. - ProtectionStatus *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // To check if upgrade available - UpgradeAvailable *bool -} - -// GetDpmContainer implements the DpmContainerClassification interface for type DpmContainer. -func (d *DpmContainer) GetDpmContainer() *DpmContainer { return d } - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type DpmContainer. -func (d *DpmContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: d.BackupManagementType, - ContainerType: d.ContainerType, - FriendlyName: d.FriendlyName, - HealthStatus: d.HealthStatus, - ProtectableObjectType: d.ProtectableObjectType, - RegistrationStatus: d.RegistrationStatus, - } -} - -// DpmErrorInfo - DPM workload-specific error information. -type DpmErrorInfo struct { - // Localized error string. - ErrorString *string - - // List of localized recommendations for above error code. - Recommendations []*string -} - -// DpmJob - DPM workload-specific job object. -type DpmJob struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - JobType *string - - // The state/actions applicable on this job like cancel/retry. - ActionsInfo []*JobSupportedAction - - // ActivityId of job. - ActivityID *string - - // Backup management type to execute the current job. - BackupManagementType *BackupManagementType - - // Name of cluster/server protecting current backup item, if any. - ContainerName *string - - // Type of container. - ContainerType *string - - // DPM server name managing the backup item or backup job. - DpmServerName *string - - // Time elapsed for job. - Duration *string - - // The end time. - EndTime *time.Time - - // Friendly name of the entity on which the current job is executing. - EntityFriendlyName *string - - // The errors. - ErrorDetails []*DpmErrorInfo - - // Additional information for this job. - ExtendedInfo *DpmJobExtendedInfo - - // The operation name. - Operation *string - - // The start time. - StartTime *time.Time - - // Job status. - Status *string - - // Type of backup item. - WorkloadType *string -} - -// GetJob implements the JobClassification interface for type DpmJob. -func (d *DpmJob) GetJob() *Job { - return &Job{ - ActivityID: d.ActivityID, - BackupManagementType: d.BackupManagementType, - EndTime: d.EndTime, - EntityFriendlyName: d.EntityFriendlyName, - JobType: d.JobType, - Operation: d.Operation, - StartTime: d.StartTime, - Status: d.Status, - } -} - -// DpmJobExtendedInfo - Additional information on the DPM workload-specific job. -type DpmJobExtendedInfo struct { - // Non localized error message on job execution. - DynamicErrorMessage *string - - // The job properties. - PropertyBag map[string]*string - - // List of tasks associated with this job. - TasksList []*DpmJobTaskDetails -} - -// DpmJobTaskDetails - DPM workload-specific job task details. -type DpmJobTaskDetails struct { - // Time elapsed for task. - Duration *string - - // The end time. - EndTime *time.Time - - // The start time. - StartTime *time.Time - - // The status. - Status *string - - // The task display name. - TaskID *string -} - -// EncryptionDetails - Details needed if the VM was encrypted at the time of backup. -type EncryptionDetails struct { - // Identifies whether this backup copy represents an encrypted VM at the time of backup. - EncryptionEnabled *bool - - // Key Url. - KekURL *string - - // ID of Key Vault where KEK is stored. - KekVaultID *string - - // Secret Url. - SecretKeyURL *string - - // ID of Key Vault where Secret is stored. - SecretKeyVaultID *string -} - -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorDetail - Error Detail class which encapsulates Code, Message and Recommendations. -type ErrorDetail struct { - // READ-ONLY; Error code. - Code *string - - // READ-ONLY; Error Message related to the Code. - Message *string - - // READ-ONLY; List of recommendation strings. - Recommendations []*string -} - -// ExportJobsOperationResultInfo - This class is used to send blob details after exporting jobs. -type ExportJobsOperationResultInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // SAS key to access the blob. It expires in 15 mins. - BlobSasKey *string - - // URL of the blob into which the serialized string of list of jobs is exported. - BlobURL *string - - // SAS key to access the blob. It expires in 15 mins. - ExcelFileBlobSasKey *string - - // URL of the blob into which the ExcelFile is uploaded. - ExcelFileBlobURL *string -} - -// GetOperationResultInfoBase implements the OperationResultInfoBaseClassification interface for type ExportJobsOperationResultInfo. -func (e *ExportJobsOperationResultInfo) GetOperationResultInfoBase() *OperationResultInfoBase { - return &OperationResultInfoBase{ - ObjectType: e.ObjectType, - } -} - -// ExtendedLocation - The extended location of Recovery point where VM was present. -type ExtendedLocation struct { - // Name of the extended location. - Name *string - - // Type of the extended location. Possible values include: 'EdgeZone' - Type *string -} - -// ExtendedProperties - Extended Properties for Azure IaasVM Backup. -type ExtendedProperties struct { - // Extended Properties for Disk Exclusion. - DiskExclusionProperties *DiskExclusionProperties - - // Linux VM name - LinuxVMApplicationName *string -} - -// FeatureSupportRequest - Base class for feature request -type FeatureSupportRequest struct { - // REQUIRED; backup support feature type. - FeatureType *string -} - -// GetFeatureSupportRequest implements the FeatureSupportRequestClassification interface for type FeatureSupportRequest. -func (f *FeatureSupportRequest) GetFeatureSupportRequest() *FeatureSupportRequest { return f } - -// FetchTieringCostInfoForRehydrationRequest - Request parameters for fetching cost info of rehydration -type FetchTieringCostInfoForRehydrationRequest struct { - // REQUIRED; Name of the protected item container - ContainerName *string - - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // REQUIRED; Name of the protectedItemName - ProtectedItemName *string - - // REQUIRED; ID of the backup copy for rehydration cost info needs to be fetched. - RecoveryPointID *string - - // REQUIRED; Rehydration Priority - RehydrationPriority *RehydrationPriority - - // REQUIRED; Source tier for the request - SourceTierType *RecoveryPointTierType - - // REQUIRED; target tier for the request - TargetTierType *RecoveryPointTierType -} - -// GetFetchTieringCostInfoRequest implements the FetchTieringCostInfoRequestClassification interface for type FetchTieringCostInfoForRehydrationRequest. -func (f *FetchTieringCostInfoForRehydrationRequest) GetFetchTieringCostInfoRequest() *FetchTieringCostInfoRequest { - return &FetchTieringCostInfoRequest{ - ObjectType: f.ObjectType, - SourceTierType: f.SourceTierType, - TargetTierType: f.TargetTierType, - } -} - -// FetchTieringCostInfoRequest - Base class for tiering cost request. Specific cost request types are derived from this class. -type FetchTieringCostInfoRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // REQUIRED; Source tier for the request - SourceTierType *RecoveryPointTierType - - // REQUIRED; target tier for the request - TargetTierType *RecoveryPointTierType -} - -// GetFetchTieringCostInfoRequest implements the FetchTieringCostInfoRequestClassification interface for type FetchTieringCostInfoRequest. -func (f *FetchTieringCostInfoRequest) GetFetchTieringCostInfoRequest() *FetchTieringCostInfoRequest { - return f -} - -// FetchTieringCostSavingsInfoForPolicyRequest - Request parameters for tiering cost info for policy -type FetchTieringCostSavingsInfoForPolicyRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // REQUIRED; Name of the backup policy for which the cost savings information is requested - PolicyName *string - - // REQUIRED; Source tier for the request - SourceTierType *RecoveryPointTierType - - // REQUIRED; target tier for the request - TargetTierType *RecoveryPointTierType -} - -// GetFetchTieringCostInfoRequest implements the FetchTieringCostInfoRequestClassification interface for type FetchTieringCostSavingsInfoForPolicyRequest. -func (f *FetchTieringCostSavingsInfoForPolicyRequest) GetFetchTieringCostInfoRequest() *FetchTieringCostInfoRequest { - return &FetchTieringCostInfoRequest{ - ObjectType: f.ObjectType, - SourceTierType: f.SourceTierType, - TargetTierType: f.TargetTierType, - } -} - -// FetchTieringCostSavingsInfoForProtectedItemRequest - Request parameters for tiering cost info for protected item -type FetchTieringCostSavingsInfoForProtectedItemRequest struct { - // REQUIRED; Name of the protected item container - ContainerName *string - - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // REQUIRED; Name of the protectedItemName - ProtectedItemName *string - - // REQUIRED; Source tier for the request - SourceTierType *RecoveryPointTierType - - // REQUIRED; target tier for the request - TargetTierType *RecoveryPointTierType -} - -// GetFetchTieringCostInfoRequest implements the FetchTieringCostInfoRequestClassification interface for type FetchTieringCostSavingsInfoForProtectedItemRequest. -func (f *FetchTieringCostSavingsInfoForProtectedItemRequest) GetFetchTieringCostInfoRequest() *FetchTieringCostInfoRequest { - return &FetchTieringCostInfoRequest{ - ObjectType: f.ObjectType, - SourceTierType: f.SourceTierType, - TargetTierType: f.TargetTierType, - } -} - -// FetchTieringCostSavingsInfoForVaultRequest - Request parameters for tiering cost info for vault -type FetchTieringCostSavingsInfoForVaultRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // REQUIRED; Source tier for the request - SourceTierType *RecoveryPointTierType - - // REQUIRED; target tier for the request - TargetTierType *RecoveryPointTierType -} - -// GetFetchTieringCostInfoRequest implements the FetchTieringCostInfoRequestClassification interface for type FetchTieringCostSavingsInfoForVaultRequest. -func (f *FetchTieringCostSavingsInfoForVaultRequest) GetFetchTieringCostInfoRequest() *FetchTieringCostInfoRequest { - return &FetchTieringCostInfoRequest{ - ObjectType: f.ObjectType, - SourceTierType: f.SourceTierType, - TargetTierType: f.TargetTierType, - } -} - -// GenericContainer - Base class for generic container of backup items -type GenericContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Extended information (not returned in List container API calls) - ExtendedInformation *GenericContainerExtendedInfo - - // Name of the container's fabric - FabricName *string - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type GenericContainer. -func (g *GenericContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: g.BackupManagementType, - ContainerType: g.ContainerType, - FriendlyName: g.FriendlyName, - HealthStatus: g.HealthStatus, - ProtectableObjectType: g.ProtectableObjectType, - RegistrationStatus: g.RegistrationStatus, - } -} - -// GenericContainerExtendedInfo - Container extended information -type GenericContainerExtendedInfo struct { - // Container identity information - ContainerIdentityInfo *ContainerIdentityInfo - - // Public key of container cert - RawCertData *string - - // Azure Backup Service Endpoints for the container - ServiceEndpoints map[string]*string -} - -// GenericProtectedItem - Base class for backup items. -type GenericProtectedItem struct { - // REQUIRED; backup item type. - ProtectedItemType *string - - // Name of the backup set the backup item belongs to - BackupSetName *string - - // Unique name of container - ContainerName *string - - // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. - CreateMode *CreateMode - - // Time for deferred deletion in UTC - DeferredDeleteTimeInUTC *time.Time - - // Time remaining before the DS marked for deferred delete is permanently deleted - DeferredDeleteTimeRemaining *string - - // Name of this backup item's fabric. - FabricName *string - - // Friendly name of the container. - FriendlyName *string - - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool - - // Flag to identify whether the deferred deleted DS is to be purged soon - IsDeferredDeleteScheduleUpcoming *bool - - // Flag to identify that deferred deleted DS is to be moved into Pause state - IsRehydrate *bool - - // Flag to identify whether the DS is scheduled for deferred delete - IsScheduledForDeferredDelete *bool - - // Timestamp when the last (latest) backup copy was created for this backup item. - LastRecoveryPoint *time.Time - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Name of the policy used for protection - PolicyName *string - - // Indicates consistency of policy object and policy applied to this backup item. - PolicyState *string - - // Data Plane Service ID of the protected item. - ProtectedItemID *int64 - - // Backup state of this backup item. - ProtectionState *ProtectionState - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - - // Loosely coupled (type, value) associations (example - parent of a protected item) - SourceAssociations map[string]*string - - // ARM ID of the resource to be backed up. - SourceResourceID *string - - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. - WorkloadType *DataSourceType -} - -// GetProtectedItem implements the ProtectedItemClassification interface for type GenericProtectedItem. -func (g *GenericProtectedItem) GetProtectedItem() *ProtectedItem { - return &ProtectedItem{ - BackupManagementType: g.BackupManagementType, - BackupSetName: g.BackupSetName, - ContainerName: g.ContainerName, - CreateMode: g.CreateMode, - DeferredDeleteTimeInUTC: g.DeferredDeleteTimeInUTC, - DeferredDeleteTimeRemaining: g.DeferredDeleteTimeRemaining, - IsArchiveEnabled: g.IsArchiveEnabled, - IsDeferredDeleteScheduleUpcoming: g.IsDeferredDeleteScheduleUpcoming, - IsRehydrate: g.IsRehydrate, - IsScheduledForDeferredDelete: g.IsScheduledForDeferredDelete, - LastRecoveryPoint: g.LastRecoveryPoint, - PolicyID: g.PolicyID, - PolicyName: g.PolicyName, - ProtectedItemType: g.ProtectedItemType, - ResourceGuardOperationRequests: g.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: g.SoftDeleteRetentionPeriodInDays, - SourceResourceID: g.SourceResourceID, - VaultID: g.VaultID, - WorkloadType: g.WorkloadType, - } -} - -// GenericProtectionPolicy - Azure VM (Mercury) workload-specific backup policy. -type GenericProtectionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - BackupManagementType *string - - // Name of this policy's fabric. - FabricName *string - - // Number of items associated with this policy. - ProtectedItemsCount *int32 - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string - - // List of sub-protection policies which includes schedule and retention - SubProtectionPolicy []*SubProtectionPolicy - - // TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". - TimeZone *string -} - -// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type GenericProtectionPolicy. -func (g *GenericProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { - return &ProtectionPolicy{ - BackupManagementType: g.BackupManagementType, - ProtectedItemsCount: g.ProtectedItemsCount, - ResourceGuardOperationRequests: g.ResourceGuardOperationRequests, - } -} - -// GenericRecoveryPoint - Generic backup copy. -type GenericRecoveryPoint struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Friendly name of the backup copy. - FriendlyName *string - - // Additional information associated with this backup copy. - RecoveryPointAdditionalInfo *string - - // Properties of Recovery Point - RecoveryPointProperties *RecoveryPointProperties - - // Time at which this backup copy was created. - RecoveryPointTime *time.Time - - // Type of the backup copy. - RecoveryPointType *string -} - -// GetRecoveryPoint implements the RecoveryPointClassification interface for type GenericRecoveryPoint. -func (g *GenericRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { - return &RecoveryPoint{ - ObjectType: g.ObjectType, - } -} - -// GetProtectedItemQueryObject - Filters to list backup items. -type GetProtectedItemQueryObject struct { - // Specifies if the additional information should be provided for this item. - Expand *string -} - -type HourlySchedule struct { - // Interval at which backup needs to be triggered. For hourly the value can be 4/6/8/12 - Interval *int32 - - // To specify duration of the backup window - ScheduleWindowDuration *int32 - - // To specify start time of the backup window - ScheduleWindowStartTime *time.Time -} - -// ILRRequest - Parameters to Provision ILR API. -type ILRRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string -} - -// GetILRRequest implements the ILRRequestClassification interface for type ILRRequest. -func (i *ILRRequest) GetILRRequest() *ILRRequest { return i } - -// ILRRequestResource - Parameters to Provision ILR API. -type ILRRequestResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // ILRRequestResource properties - Properties ILRRequestClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// IaaSVMContainer - IaaS VM workload-specific container. -type IaaSVMContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string - - // Resource group name of Recovery Services Vault. - ResourceGroup *string - - // Fully qualified ARM url of the virtual machine represented by this Azure IaaS VM container. - VirtualMachineID *string - - // Specifies whether the container represents a Classic or an Azure Resource Manager VM. - VirtualMachineVersion *string -} - -// GetIaaSVMContainer implements the IaaSVMContainerClassification interface for type IaaSVMContainer. -func (i *IaaSVMContainer) GetIaaSVMContainer() *IaaSVMContainer { return i } - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type IaaSVMContainer. -func (i *IaaSVMContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: i.BackupManagementType, - ContainerType: i.ContainerType, - FriendlyName: i.FriendlyName, - HealthStatus: i.HealthStatus, - ProtectableObjectType: i.ProtectableObjectType, - RegistrationStatus: i.RegistrationStatus, - } -} - -// IaaSVMProtectableItem - IaaS VM workload-specific backup item. -type IaaSVMProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string - - // Friendly name of the backup item. - FriendlyName *string - - // State of the back up item. - ProtectionState *ProtectionStatus - - // Resource group name of Recovery Services Vault. - ResourceGroup *string - - // Fully qualified ARM ID of the virtual machine. - VirtualMachineID *string - - // Specifies whether the container represents a Classic or an Azure Resource Manager VM. - VirtualMachineVersion *string - - // Type of workload for the backup management - WorkloadType *string -} - -// GetIaaSVMProtectableItem implements the IaaSVMProtectableItemClassification interface for type IaaSVMProtectableItem. -func (i *IaaSVMProtectableItem) GetIaaSVMProtectableItem() *IaaSVMProtectableItem { return i } - -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type IaaSVMProtectableItem. -func (i *IaaSVMProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { - return &WorkloadProtectableItem{ - BackupManagementType: i.BackupManagementType, - FriendlyName: i.FriendlyName, - ProtectableItemType: i.ProtectableItemType, - ProtectionState: i.ProtectionState, - WorkloadType: i.WorkloadType, - } -} - -// IaasVMBackupRequest - IaaS VM workload-specific backup request. -type IaasVMBackupRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Backup copy will expire after the time specified (UTC). - RecoveryPointExpiryTimeInUTC *time.Time -} - -// GetBackupRequest implements the BackupRequestClassification interface for type IaasVMBackupRequest. -func (i *IaasVMBackupRequest) GetBackupRequest() *BackupRequest { - return &BackupRequest{ - ObjectType: i.ObjectType, - } -} - -// IaasVMILRRegistrationRequest - Restore files/folders from a backup copy of IaaS VM. -type IaasVMILRRegistrationRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // iSCSI initiator name. - InitiatorName *string - - // ID of the IaaS VM backup copy from where the files/folders have to be restored. - RecoveryPointID *string - - // Whether to renew existing registration with the iSCSI server. - RenewExistingRegistration *bool - - // Fully qualified ARM ID of the virtual machine whose the files / folders have to be restored. - VirtualMachineID *string -} - -// GetILRRequest implements the ILRRequestClassification interface for type IaasVMILRRegistrationRequest. -func (i *IaasVMILRRegistrationRequest) GetILRRequest() *ILRRequest { - return &ILRRequest{ - ObjectType: i.ObjectType, - } -} - -// IaasVMRecoveryPoint - IaaS VM workload specific backup copy. -type IaasVMRecoveryPoint struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Extended location of the VM recovery point, should be null if VM is in public cloud - ExtendedLocation *ExtendedLocation - - // Is the session to recover items from this backup copy still active. - IsInstantIlrSessionActive *bool - - // Whether VM is with Managed Disks - IsManagedVirtualMachine *bool - - // This flag denotes if any of the disks in the VM are using Private access network setting - IsPrivateAccessEnabledOnAnyDisk *bool - - // Identifies whether the VM was encrypted when the backup copy is created. - IsSourceVMEncrypted *bool - - // Required details for recovering an encrypted VM. Applicable only when IsSourceVMEncrypted is true. - KeyAndSecret *KeyAndSecretDetails - - // OS type - OSType *string - - // Original Storage Account Option - OriginalStorageAccountOption *bool - - // Additional information associated with this backup copy. - RecoveryPointAdditionalInfo *string - - // Disk configuration - RecoveryPointDiskConfiguration *RecoveryPointDiskConfiguration - - // Eligibility of RP to be moved to another tier - RecoveryPointMoveReadinessInfo map[string]*RecoveryPointMoveReadinessInfo - - // Properties of Recovery Point - RecoveryPointProperties *RecoveryPointProperties - - // Recovery point tier information. - RecoveryPointTierDetails []*RecoveryPointTierInformationV2 - - // Time at which this backup copy was created. - RecoveryPointTime *time.Time - - // Type of the backup copy. - RecoveryPointType *string - - // Security Type of the Disk - SecurityType *string - - // Storage type of the VM whose backup copy is created. - SourceVMStorageType *string - - // Virtual Machine Size - VirtualMachineSize *string - - // Identifies the zone of the VM at the time of backup. Applicable only for zone-pinned Vms - Zones []*string -} - -// GetRecoveryPoint implements the RecoveryPointClassification interface for type IaasVMRecoveryPoint. -func (i *IaasVMRecoveryPoint) GetRecoveryPoint() *RecoveryPoint { - return &RecoveryPoint{ - ObjectType: i.ObjectType, - } -} - -// IaasVMRestoreRequest - IaaS VM workload-specific restore. -type IaasVMRestoreRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Affinity group associated to VM to be restored. Used only for Classic Compute Virtual Machines. - AffinityGroup *string - - // Should a new cloud service be created while restoring the VM. If this is false, VM will be restored to the same cloud service - // as it was at the time of backup. - CreateNewCloudService *bool - - // DiskEncryptionSet's ID - needed if the VM needs to be encrypted at rest during restore with customer managed key. - DiskEncryptionSetID *string - - // Details needed if the VM was encrypted at the time of backup. - EncryptionDetails *EncryptionDetails - - // Target extended location where the VM should be restored, should be null if restore is to be done in public cloud - ExtendedLocation *ExtendedLocation - - // IaaS VM workload specific restore details for restores using managed identity. - IdentityBasedRestoreDetails *IdentityBasedRestoreDetails - - // Managed Identity information required to access customer storage account. - IdentityInfo *IdentityInfo - - // Original Storage Account Option - OriginalStorageAccountOption *bool - - // ID of the backup copy to be recovered. - RecoveryPointID *string - - // Type of this recovery. - RecoveryType *RecoveryType - - // Region in which the virtual machine is restored. - Region *string - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // List of Disk LUNs for partial restore - RestoreDiskLunList []*int32 - - // Flag to denote of an Unmanaged disk VM should be restored with Managed disks. - RestoreWithManagedDisks *bool - - // Stores Secured VM Details - SecuredVMDetails *SecuredVMDetails - - // Fully qualified ARM ID of the VM which is being recovered. - SourceResourceID *string - - // Fully qualified ARM ID of the storage account to which the VM has to be restored. - StorageAccountID *string - - // Subnet ID, is the subnet ID associated with the to be restored VM. For Classic VMs it would be {VnetID}/Subnet/{SubnetName} - // and, for the Azure Resource Manager VMs it would be ARM resource ID used to - // represent the subnet. - SubnetID *string - - // Specifies target network access settings for disks of VM to be restored, - TargetDiskNetworkAccessSettings *TargetDiskNetworkAccessSettings - - // Fully qualified ARM ID of the domain name to be associated to the VM being restored. This applies only to Classic Virtual - // Machines. - TargetDomainNameID *string - - // This is the ARM Id of the resource group that you want to create for this Virtual machine and other artifacts. For e.g. - // /subscriptions/{subId}/resourcegroups/{rg} - TargetResourceGroupID *string - - // This is the complete ARM Id of the VM that will be created. For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string - - // This is the virtual network Id of the vnet that will be attached to the virtual machine. User will be validated for join - // action permissions in the linked access. - VirtualNetworkID *string - - // Target zone where the VM and its disks should be restored. - Zones []*string -} - -// GetIaasVMRestoreRequest implements the IaasVMRestoreRequestClassification interface for type IaasVMRestoreRequest. -func (i *IaasVMRestoreRequest) GetIaasVMRestoreRequest() *IaasVMRestoreRequest { return i } - -// GetRestoreRequest implements the RestoreRequestClassification interface for type IaasVMRestoreRequest. -func (i *IaasVMRestoreRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: i.ObjectType, - ResourceGuardOperationRequests: i.ResourceGuardOperationRequests, - } -} - -// IaasVMRestoreWithRehydrationRequest - IaaS VM workload-specific restore with integrated rehydration of recovery point. -type IaasVMRestoreWithRehydrationRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Affinity group associated to VM to be restored. Used only for Classic Compute Virtual Machines. - AffinityGroup *string - - // Should a new cloud service be created while restoring the VM. If this is false, VM will be restored to the same cloud service - // as it was at the time of backup. - CreateNewCloudService *bool - - // DiskEncryptionSet's ID - needed if the VM needs to be encrypted at rest during restore with customer managed key. - DiskEncryptionSetID *string - - // Details needed if the VM was encrypted at the time of backup. - EncryptionDetails *EncryptionDetails - - // Target extended location where the VM should be restored, should be null if restore is to be done in public cloud - ExtendedLocation *ExtendedLocation - - // IaaS VM workload specific restore details for restores using managed identity. - IdentityBasedRestoreDetails *IdentityBasedRestoreDetails - - // Managed Identity information required to access customer storage account. - IdentityInfo *IdentityInfo - - // Original Storage Account Option - OriginalStorageAccountOption *bool - - // ID of the backup copy to be recovered. - RecoveryPointID *string - - // RP Rehydration Info - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo - - // Type of this recovery. - RecoveryType *RecoveryType - - // Region in which the virtual machine is restored. - Region *string - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // List of Disk LUNs for partial restore - RestoreDiskLunList []*int32 - - // Flag to denote of an Unmanaged disk VM should be restored with Managed disks. - RestoreWithManagedDisks *bool - - // Stores Secured VM Details - SecuredVMDetails *SecuredVMDetails - - // Fully qualified ARM ID of the VM which is being recovered. - SourceResourceID *string - - // Fully qualified ARM ID of the storage account to which the VM has to be restored. - StorageAccountID *string - - // Subnet ID, is the subnet ID associated with the to be restored VM. For Classic VMs it would be {VnetID}/Subnet/{SubnetName} - // and, for the Azure Resource Manager VMs it would be ARM resource ID used to - // represent the subnet. - SubnetID *string - - // Specifies target network access settings for disks of VM to be restored, - TargetDiskNetworkAccessSettings *TargetDiskNetworkAccessSettings - - // Fully qualified ARM ID of the domain name to be associated to the VM being restored. This applies only to Classic Virtual - // Machines. - TargetDomainNameID *string - - // This is the ARM Id of the resource group that you want to create for this Virtual machine and other artifacts. For e.g. - // /subscriptions/{subId}/resourcegroups/{rg} - TargetResourceGroupID *string - - // This is the complete ARM Id of the VM that will be created. For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} - TargetVirtualMachineID *string - - // This is the virtual network Id of the vnet that will be attached to the virtual machine. User will be validated for join - // action permissions in the linked access. - VirtualNetworkID *string - - // Target zone where the VM and its disks should be restored. - Zones []*string -} - -// GetIaasVMRestoreRequest implements the IaasVMRestoreRequestClassification interface for type IaasVMRestoreWithRehydrationRequest. -func (i *IaasVMRestoreWithRehydrationRequest) GetIaasVMRestoreRequest() *IaasVMRestoreRequest { - return &IaasVMRestoreRequest{ - AffinityGroup: i.AffinityGroup, - CreateNewCloudService: i.CreateNewCloudService, - DiskEncryptionSetID: i.DiskEncryptionSetID, - EncryptionDetails: i.EncryptionDetails, - ExtendedLocation: i.ExtendedLocation, - IdentityBasedRestoreDetails: i.IdentityBasedRestoreDetails, - IdentityInfo: i.IdentityInfo, - ObjectType: i.ObjectType, - OriginalStorageAccountOption: i.OriginalStorageAccountOption, - RecoveryPointID: i.RecoveryPointID, - RecoveryType: i.RecoveryType, - Region: i.Region, - ResourceGuardOperationRequests: i.ResourceGuardOperationRequests, - RestoreDiskLunList: i.RestoreDiskLunList, - RestoreWithManagedDisks: i.RestoreWithManagedDisks, - SecuredVMDetails: i.SecuredVMDetails, - SourceResourceID: i.SourceResourceID, - StorageAccountID: i.StorageAccountID, - SubnetID: i.SubnetID, - TargetDiskNetworkAccessSettings: i.TargetDiskNetworkAccessSettings, - TargetDomainNameID: i.TargetDomainNameID, - TargetResourceGroupID: i.TargetResourceGroupID, - TargetVirtualMachineID: i.TargetVirtualMachineID, - VirtualNetworkID: i.VirtualNetworkID, - Zones: i.Zones, - } -} - -// GetRestoreRequest implements the RestoreRequestClassification interface for type IaasVMRestoreWithRehydrationRequest. -func (i *IaasVMRestoreWithRehydrationRequest) GetRestoreRequest() *RestoreRequest { - return &RestoreRequest{ - ObjectType: i.ObjectType, - ResourceGuardOperationRequests: i.ResourceGuardOperationRequests, - } -} - -// IdentityBasedRestoreDetails - IaaS VM workload specific restore details for restores using managed identity -type IdentityBasedRestoreDetails struct { - // Gets the class type. - ObjectType *string - - // Fully qualified ARM ID of the target storage account. - TargetStorageAccountID *string -} - -// IdentityInfo - Encapsulates Managed Identity related information -type IdentityInfo struct { - // To differentiate if the managed identity is system assigned or user assigned - IsSystemAssignedIdentity *bool - - // Managed Identity Resource Id Optional: Might not be required in the case of system assigned managed identity - ManagedIdentityResourceID *string -} - -// InquiryInfo - Details about inquired protectable items under a given container. -type InquiryInfo struct { - // Error Details if the Status is non-success. - ErrorDetail *ErrorDetail - - // Inquiry Details which will have workload specific details. For e.g. - For SQL and oracle this will contain different details. - InquiryDetails []*WorkloadInquiryDetails - - // Inquiry Status for this container such as InProgress | Failed | Succeeded - Status *string -} - -// InquiryValidation - Validation for inquired protectable items under a given container. -type InquiryValidation struct { - // Error Detail in case the status is non-success. - ErrorDetail *ErrorDetail - - // Status for the Inquiry Validation. - Status *string - - // READ-ONLY; Error Additional Detail in case the status is non-success. - AdditionalDetail *string - - // READ-ONLY; Dictionary to store the count of ProtectableItems with key POType. - ProtectableItemCount any -} - -// InstantItemRecoveryTarget - Target details for file / folder restore. -type InstantItemRecoveryTarget struct { - // List of client scripts. - ClientScripts []*ClientScriptForConnect -} - -type InstantRPAdditionalDetails struct { - AzureBackupRGNamePrefix *string - AzureBackupRGNameSuffix *string -} - -// Job - Defines workload agnostic properties for a job. -type Job struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - JobType *string - - // ActivityId of job. - ActivityID *string - - // Backup management type to execute the current job. - BackupManagementType *BackupManagementType - - // The end time. - EndTime *time.Time - - // Friendly name of the entity on which the current job is executing. - EntityFriendlyName *string - - // The operation name. - Operation *string - - // The start time. - StartTime *time.Time - - // Job status. - Status *string -} - -// GetJob implements the JobClassification interface for type Job. -func (j *Job) GetJob() *Job { return j } - -// JobQueryObject - Filters to list the jobs. -type JobQueryObject struct { - // Type of backup management for the job. - BackupManagementType *BackupManagementType - - // Job has ended at this time. Value is in UTC. - EndTime *time.Time - - // JobID represents the job uniquely. - JobID *string - - // Type of operation. - Operation *JobOperationType - - // Job has started at this time. Value is in UTC. - StartTime *time.Time - - // Status of the job. - Status *JobStatus -} - -// JobResource - Defines workload agnostic properties for a job. -type JobResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // JobResource properties - Properties JobClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// JobResourceList - List of Job resources -type JobResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*JobResource -} - -// KEKDetails - KEK is encryption key for BEK. -type KEKDetails struct { - // KEK data. - KeyBackupData *string - - // Key is KEK. - KeyURL *string - - // Key Vault ID where this Key is stored. - KeyVaultID *string -} - -// KPIResourceHealthDetails - KPI Resource Health Details -type KPIResourceHealthDetails struct { - // Resource Health Status - ResourceHealthDetails []*ResourceHealthDetails - - // Resource Health Status - ResourceHealthStatus *ResourceHealthStatus -} - -// KeyAndSecretDetails - BEK is bitlocker key. KEK is encryption key for BEK If the VM was encrypted then we will store following -// details : -// 1. Secret(BEK) - Url + Backup Data + vaultId. -// 2. Key(KEK) - Url + Backup Data + vaultId. -// 3. EncryptionMechanism BEK and KEK can potentially have different vault ids. -type KeyAndSecretDetails struct { - // BEK is bitlocker encryption key. - BekDetails *BEKDetails - - // Encryption mechanism: None/ SinglePass/ DoublePass - EncryptionMechanism *string - - // KEK is encryption key for BEK. - KekDetails *KEKDetails -} - -// ListRecoveryPointsRecommendedForMoveRequest Request -type ListRecoveryPointsRecommendedForMoveRequest struct { - // List of Recovery Points excluded from Move - ExcludedRPList []*string - - // Gets the class type. - ObjectType *string -} - -// LogSchedulePolicy - Log policy schedule. -type LogSchedulePolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - SchedulePolicyType *string - - // Frequency of the log schedule operation of this policy in minutes. - ScheduleFrequencyInMins *int32 -} - -// GetSchedulePolicy implements the SchedulePolicyClassification interface for type LogSchedulePolicy. -func (l *LogSchedulePolicy) GetSchedulePolicy() *SchedulePolicy { - return &SchedulePolicy{ - SchedulePolicyType: l.SchedulePolicyType, - } -} - -// LongTermRetentionPolicy - Long term retention policy. -type LongTermRetentionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - RetentionPolicyType *string - - // Daily retention schedule of the protection policy. - DailySchedule *DailyRetentionSchedule - - // Monthly retention schedule of the protection policy. - MonthlySchedule *MonthlyRetentionSchedule - - // Weekly retention schedule of the protection policy. - WeeklySchedule *WeeklyRetentionSchedule - - // Yearly retention schedule of the protection policy. - YearlySchedule *YearlyRetentionSchedule -} - -// GetRetentionPolicy implements the RetentionPolicyClassification interface for type LongTermRetentionPolicy. -func (l *LongTermRetentionPolicy) GetRetentionPolicy() *RetentionPolicy { - return &RetentionPolicy{ - RetentionPolicyType: l.RetentionPolicyType, - } -} - -// LongTermSchedulePolicy - Long term policy schedule. -type LongTermSchedulePolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - SchedulePolicyType *string -} - -// GetSchedulePolicy implements the SchedulePolicyClassification interface for type LongTermSchedulePolicy. -func (l *LongTermSchedulePolicy) GetSchedulePolicy() *SchedulePolicy { - return &SchedulePolicy{ - SchedulePolicyType: l.SchedulePolicyType, - } -} - -// MABContainerHealthDetails - MAB workload-specific Health Details. -type MABContainerHealthDetails struct { - // Health Code - Code *int32 - - // Health Message - Message *string - - // Health Recommended Actions - Recommendations []*string - - // Health Title - Title *string -} - -// MabContainer - Container with items backed up using MAB backup engine. -type MabContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Agent version of this container. - AgentVersion *string - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Can the container be registered one more time. - CanReRegister *bool - - // Health state of mab container. - ContainerHealthState *string - - // ContainerID represents the container. - ContainerID *int64 - - // Additional information for this container - ExtendedInfo *MabContainerExtendedInfo - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Health details on this mab container. - MabContainerHealthDetails []*MABContainerHealthDetails - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Number of items backed up in this container. - ProtectedItemCount *int64 - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type MabContainer. -func (m *MabContainer) GetProtectionContainer() *ProtectionContainer { - return &ProtectionContainer{ - BackupManagementType: m.BackupManagementType, - ContainerType: m.ContainerType, - FriendlyName: m.FriendlyName, - HealthStatus: m.HealthStatus, - ProtectableObjectType: m.ProtectableObjectType, - RegistrationStatus: m.RegistrationStatus, - } -} - -// MabContainerExtendedInfo - Additional information of the container. -type MabContainerExtendedInfo struct { - // Type of backup items associated with this container. - BackupItemType *BackupItemType - - // List of backup items associated with this container. - BackupItems []*string - - // Latest backup status of this container. - LastBackupStatus *string - - // Time stamp when this container was refreshed. - LastRefreshedAt *time.Time - - // Backup policy associated with this container. - PolicyName *string -} - -// MabErrorInfo - MAB workload-specific error information. -type MabErrorInfo struct { - // READ-ONLY; Localized error string. - ErrorString *string - - // READ-ONLY; List of localized recommendations. - Recommendations []*string -} - -// MabFileFolderProtectedItem - MAB workload-specific backup item. -type MabFileFolderProtectedItem struct { - // REQUIRED; backup item type. - ProtectedItemType *string - - // Name of the backup set the backup item belongs to - BackupSetName *string - - // Name of the computer associated with this backup item. - ComputerName *string - - // Unique name of container - ContainerName *string - - // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. - CreateMode *CreateMode - - // Sync time for deferred deletion in UTC - DeferredDeleteSyncTimeInUTC *int64 - - // Time for deferred deletion in UTC - DeferredDeleteTimeInUTC *time.Time - - // Time remaining before the DS marked for deferred delete is permanently deleted - DeferredDeleteTimeRemaining *string - - // Additional information with this backup item. - ExtendedInfo *MabFileFolderProtectedItemExtendedInfo - - // Friendly name of this backup item. - FriendlyName *string - - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool - - // Flag to identify whether the deferred deleted DS is to be purged soon - IsDeferredDeleteScheduleUpcoming *bool - - // Flag to identify that deferred deleted DS is to be moved into Pause state - IsRehydrate *bool - - // Flag to identify whether the DS is scheduled for deferred delete - IsScheduledForDeferredDelete *bool - - // Status of last backup operation. - LastBackupStatus *string - - // Timestamp of the last backup operation on this backup item. - LastBackupTime *time.Time - - // Timestamp when the last (latest) backup copy was created for this backup item. - LastRecoveryPoint *time.Time - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Name of the policy used for protection - PolicyName *string - - // Protected, ProtectionStopped, IRPending or ProtectionError - ProtectionState *string - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - - // ARM ID of the resource to be backed up. - SourceResourceID *string - - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. - WorkloadType *DataSourceType -} - -// GetProtectedItem implements the ProtectedItemClassification interface for type MabFileFolderProtectedItem. -func (m *MabFileFolderProtectedItem) GetProtectedItem() *ProtectedItem { - return &ProtectedItem{ - BackupManagementType: m.BackupManagementType, - BackupSetName: m.BackupSetName, - ContainerName: m.ContainerName, - CreateMode: m.CreateMode, - DeferredDeleteTimeInUTC: m.DeferredDeleteTimeInUTC, - DeferredDeleteTimeRemaining: m.DeferredDeleteTimeRemaining, - IsArchiveEnabled: m.IsArchiveEnabled, - IsDeferredDeleteScheduleUpcoming: m.IsDeferredDeleteScheduleUpcoming, - IsRehydrate: m.IsRehydrate, - IsScheduledForDeferredDelete: m.IsScheduledForDeferredDelete, - LastRecoveryPoint: m.LastRecoveryPoint, - PolicyID: m.PolicyID, - PolicyName: m.PolicyName, - ProtectedItemType: m.ProtectedItemType, - ResourceGuardOperationRequests: m.ResourceGuardOperationRequests, - SoftDeleteRetentionPeriodInDays: m.SoftDeleteRetentionPeriodInDays, - SourceResourceID: m.SourceResourceID, - VaultID: m.VaultID, - WorkloadType: m.WorkloadType, - } -} - -// MabFileFolderProtectedItemExtendedInfo - Additional information on the backed up item. -type MabFileFolderProtectedItemExtendedInfo struct { - // Last time when the agent data synced to service. - LastRefreshedAt *time.Time - - // The oldest backup copy available. - OldestRecoveryPoint *time.Time - - // Number of backup copies associated with the backup item. - RecoveryPointCount *int32 -} - -// MabJob - MAB workload-specific job. -type MabJob struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - JobType *string - - // The state/actions applicable on jobs like cancel/retry. - ActionsInfo []*JobSupportedAction - - // ActivityId of job. - ActivityID *string - - // Backup management type to execute the current job. - BackupManagementType *BackupManagementType - - // Time taken by job to run. - Duration *string - - // The end time. - EndTime *time.Time - - // Friendly name of the entity on which the current job is executing. - EntityFriendlyName *string - - // The errors. - ErrorDetails []*MabErrorInfo - - // Additional information on the job. - ExtendedInfo *MabJobExtendedInfo - - // Name of server protecting the DS. - MabServerName *string - - // Server type of MAB container. - MabServerType *MabServerType - - // The operation name. - Operation *string - - // The start time. - StartTime *time.Time - - // Job status. - Status *string - - // Workload type of backup item. - WorkloadType *WorkloadType -} - -// GetJob implements the JobClassification interface for type MabJob. -func (m *MabJob) GetJob() *Job { - return &Job{ - ActivityID: m.ActivityID, - BackupManagementType: m.BackupManagementType, - EndTime: m.EndTime, - EntityFriendlyName: m.EntityFriendlyName, - JobType: m.JobType, - Operation: m.Operation, - StartTime: m.StartTime, - Status: m.Status, - } -} - -// MabJobExtendedInfo - Additional information for the MAB workload-specific job. -type MabJobExtendedInfo struct { - // Non localized error message specific to this job. - DynamicErrorMessage *string - - // The job properties. - PropertyBag map[string]*string - - // List of tasks for this job. - TasksList []*MabJobTaskDetails -} - -// MabJobTaskDetails - MAB workload-specific job task details. -type MabJobTaskDetails struct { - // Time elapsed for task. - Duration *string - - // The end time. - EndTime *time.Time - - // The start time. - StartTime *time.Time - - // The status. - Status *string - - // The task display name. - TaskID *string -} - -// MabProtectionPolicy - Mab container-specific backup policy. -type MabProtectionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - BackupManagementType *string - - // Number of items associated with this policy. - ProtectedItemsCount *int32 - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string - - // Retention policy details. - RetentionPolicy RetentionPolicyClassification - - // Backup schedule of backup policy. - SchedulePolicy SchedulePolicyClassification -} - -// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type MabProtectionPolicy. -func (m *MabProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { - return &ProtectionPolicy{ - BackupManagementType: m.BackupManagementType, - ProtectedItemsCount: m.ProtectedItemsCount, - ResourceGuardOperationRequests: m.ResourceGuardOperationRequests, - } -} - -// MonthlyRetentionSchedule - Monthly retention schedule. -type MonthlyRetentionSchedule struct { - // Retention duration of retention Policy. - RetentionDuration *RetentionDuration - - // Daily retention format for monthly retention policy. - RetentionScheduleDaily *DailyRetentionFormat - - // Retention schedule format type for monthly retention policy. - RetentionScheduleFormatType *RetentionScheduleFormat - - // Weekly retention format for monthly retention policy. - RetentionScheduleWeekly *WeeklyRetentionFormat - - // Retention times of retention policy. - RetentionTimes []*time.Time -} - -type MoveRPAcrossTiersRequest struct { - // Gets the class type. - ObjectType *string - - // Source tier from where RP needs to be moved - SourceTierType *RecoveryPointTierType - - // Target tier where RP needs to be moved - TargetTierType *RecoveryPointTierType -} - -// NameInfo - The name of usage. -type NameInfo struct { - // Localized value of usage. - LocalizedValue *string - - // Value of usage. - Value *string -} - -// NewErrorResponse - The resource management error response. -type NewErrorResponse struct { - // The error object. - Error *NewErrorResponseError -} - -// NewErrorResponseError - The error object. -type NewErrorResponseError struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*NewErrorResponse - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// OperationResultInfo - Operation result info. -type OperationResultInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // List of jobs created by this operation. - JobList []*string -} - -// GetOperationResultInfoBase implements the OperationResultInfoBaseClassification interface for type OperationResultInfo. -func (o *OperationResultInfo) GetOperationResultInfoBase() *OperationResultInfoBase { - return &OperationResultInfoBase{ - ObjectType: o.ObjectType, - } -} - -// OperationResultInfoBase - Base class for operation result info. -type OperationResultInfoBase struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string -} - -// GetOperationResultInfoBase implements the OperationResultInfoBaseClassification interface for type OperationResultInfoBase. -func (o *OperationResultInfoBase) GetOperationResultInfoBase() *OperationResultInfoBase { return o } - -// OperationResultInfoBaseResource - Base class for operation result info. -type OperationResultInfoBaseResource struct { - // HTTP headers associated with this operation. - Headers map[string][]*string - - // OperationResultInfoBaseResource operation - Operation OperationResultInfoBaseClassification - - // HTTP Status Code of the operation. - StatusCode *HTTPStatusCode -} - -// OperationStatus - Operation status. -type OperationStatus struct { - // Operation end time. Format: ISO-8601. - EndTime *time.Time - - // Error information related to this operation. - Error *OperationStatusError - - // ID of the operation. - ID *string - - // Name of the operation. - Name *string - - // Additional information associated with this operation. - Properties OperationStatusExtendedInfoClassification - - // Operation start time. Format: ISO-8601. - StartTime *time.Time - - // Operation status. - Status *OperationStatusValues -} - -// OperationStatusError - Error information associated with operation status call. -type OperationStatusError struct { - // Error code of the operation failure. - Code *string - - // Error message displayed if the operation failure. - Message *string -} - -// OperationStatusExtendedInfo - Base class for additional information of operation status. -type OperationStatusExtendedInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string -} - -// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusExtendedInfo. -func (o *OperationStatusExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { - return o -} - -// OperationStatusJobExtendedInfo - Operation status job extended info. -type OperationStatusJobExtendedInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // ID of the job created for this protected item. - JobID *string -} - -// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusJobExtendedInfo. -func (o *OperationStatusJobExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { - return &OperationStatusExtendedInfo{ - ObjectType: o.ObjectType, - } -} - -// OperationStatusJobsExtendedInfo - Operation status extended info for list of jobs. -type OperationStatusJobsExtendedInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Stores all the failed jobs along with the corresponding error codes. - FailedJobsError map[string]*string - - // IDs of the jobs created for the protected item. - JobIDs []*string -} - -// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusJobsExtendedInfo. -func (o *OperationStatusJobsExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { - return &OperationStatusExtendedInfo{ - ObjectType: o.ObjectType, - } -} - -// OperationStatusProvisionILRExtendedInfo - Operation status extended info for ILR provision action. -type OperationStatusProvisionILRExtendedInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Target details for file / folder restore. - RecoveryTarget *InstantItemRecoveryTarget -} - -// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusProvisionILRExtendedInfo. -func (o *OperationStatusProvisionILRExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { - return &OperationStatusExtendedInfo{ - ObjectType: o.ObjectType, - } -} - -// OperationStatusValidateOperationExtendedInfo - Operation status extended info for ValidateOperation action. -type OperationStatusValidateOperationExtendedInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Gets the validation operation response - ValidateOperationResponse *ValidateOperationResponse -} - -// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusValidateOperationExtendedInfo. -func (o *OperationStatusValidateOperationExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { - return &OperationStatusExtendedInfo{ - ObjectType: o.ObjectType, - } -} - -// OperationWorkerResponse - This is the base class for operation result responses. -type OperationWorkerResponse struct { - // HTTP headers associated with this operation. - Headers map[string][]*string - - // HTTP Status Code of the operation. - StatusCode *HTTPStatusCode -} - -// PointInTimeRange - Provides details for log ranges -type PointInTimeRange struct { - // End time of the time range for log recovery. - EndTime *time.Time - - // Start time of the time range for log recovery. - StartTime *time.Time -} - -// PreBackupValidation - Pre-backup validation for Azure VM Workload provider. -type PreBackupValidation struct { - // Error code of protectable item - Code *string - - // Message corresponding to the error code for the protectable item - Message *string - - // Status of protectable item, i.e. InProgress,Succeeded,Failed - Status *InquiryStatus -} - -// PreValidateEnableBackupRequest - Contract to validate if backup can be enabled on the given resource in a given vault and -// given configuration. It will validate followings -// 1. Vault capacity -// 2. VM is already protected -// 3. Any VM related configuration passed in properties. -type PreValidateEnableBackupRequest struct { - // Configuration of VM if any needs to be validated like OS type etc - Properties *string - - // ARM Virtual Machine Id - ResourceID *string - - // ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc - ResourceType *DataSourceType - - // ARM id of the Recovery Services Vault - VaultID *string -} - -// PreValidateEnableBackupResponse - Response contract for enable backup validation request -type PreValidateEnableBackupResponse struct { - // Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;rgname;vmname. This is required for - // portal - ContainerName *string - - // Response error code - ErrorCode *string - - // Response error message - ErrorMessage *string - - // Specifies the product specific ds name. E.g. vm;iaasvmcontainer;rgname;vmname. This is required for portal - ProtectedItemName *string - - // Recommended action for user - Recommendation *string - - // Validation Status - Status *ValidationStatus -} - -// PrepareDataMoveRequest - Prepare DataMove Request -type PrepareDataMoveRequest struct { - // REQUIRED; DataMove Level - DataMoveLevel *DataMoveLevel - - // REQUIRED; Target Region - TargetRegion *string - - // REQUIRED; ARM Id of target vault - TargetResourceID *string - - // Ignore the artifacts which are already moved. - IgnoreMoved *bool - - // Source Container ArmIds This needs to be populated only if DataMoveLevel is set to container - SourceContainerArmIDs []*string -} - -// PrepareDataMoveResponse - Prepare DataMove Response -type PrepareDataMoveResponse struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // Co-relationId for move operation - CorrelationID *string - - // Source Vault Properties - SourceVaultProperties map[string]*string -} - -// GetVaultStorageConfigOperationResultResponse implements the VaultStorageConfigOperationResultResponseClassification interface -// for type PrepareDataMoveResponse. -func (p *PrepareDataMoveResponse) GetVaultStorageConfigOperationResultResponse() *VaultStorageConfigOperationResultResponse { - return &VaultStorageConfigOperationResultResponse{ - ObjectType: p.ObjectType, - } -} - -// PrivateEndpoint - The Private Endpoint network resource that is linked to the Private Endpoint connection -type PrivateEndpoint struct { - // Gets or sets id - ID *string -} - -// PrivateEndpointConnection - Private Endpoint Connection Response Properties -type PrivateEndpointConnection struct { - // Group Ids for the Private Endpoint - GroupIDs []*VaultSubResourceType - - // Gets or sets private endpoint associated with the private endpoint connection - PrivateEndpoint *PrivateEndpoint - - // Gets or sets private link service connection state - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState - - // Gets or sets provisioning state of the private endpoint connection - ProvisioningState *ProvisioningState -} - -// PrivateEndpointConnectionResource - Private Endpoint Connection Response Properties -type PrivateEndpointConnectionResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // PrivateEndpointConnectionResource properties - Properties *PrivateEndpointConnection - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// PrivateLinkServiceConnectionState - Private Link Service Connection State -type PrivateLinkServiceConnectionState struct { - // Gets or sets actions required - ActionsRequired *string - - // Gets or sets description - Description *string - - // Gets or sets the status - Status *PrivateEndpointConnectionStatus -} - -// ProtectableContainer - Protectable Container Class. -type ProtectableContainer struct { - // REQUIRED; Type of the container. The value of this property for - // 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines - ProtectableContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Fabric Id of the container such as ARM Id. - ContainerID *string - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string -} - -// GetProtectableContainer implements the ProtectableContainerClassification interface for type ProtectableContainer. -func (p *ProtectableContainer) GetProtectableContainer() *ProtectableContainer { return p } - -// ProtectableContainerResource - Protectable Container Class. -type ProtectableContainerResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // ProtectableContainerResource properties - Properties ProtectableContainerClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// ProtectableContainerResourceList - List of ProtectableContainer resources -type ProtectableContainerResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*ProtectableContainerResource -} - -// ProtectedItem - Base class for backup items. -type ProtectedItem struct { - // REQUIRED; backup item type. - ProtectedItemType *string - - // Name of the backup set the backup item belongs to - BackupSetName *string - - // Unique name of container - ContainerName *string - - // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. - CreateMode *CreateMode - - // Time for deferred deletion in UTC - DeferredDeleteTimeInUTC *time.Time - - // Time remaining before the DS marked for deferred delete is permanently deleted - DeferredDeleteTimeRemaining *string - - // Flag to identify whether datasource is protected in archive - IsArchiveEnabled *bool - - // Flag to identify whether the deferred deleted DS is to be purged soon - IsDeferredDeleteScheduleUpcoming *bool - - // Flag to identify that deferred deleted DS is to be moved into Pause state - IsRehydrate *bool - - // Flag to identify whether the DS is scheduled for deferred delete - IsScheduledForDeferredDelete *bool - - // Timestamp when the last (latest) backup copy was created for this backup item. - LastRecoveryPoint *time.Time - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Name of the policy used for protection - PolicyName *string - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string - - // Soft delete retention period in days - SoftDeleteRetentionPeriodInDays *int32 - - // ARM ID of the resource to be backed up. - SourceResourceID *string - - // READ-ONLY; Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // READ-ONLY; ID of the vault which protects this item - VaultID *string - - // READ-ONLY; Type of workload this item represents. - WorkloadType *DataSourceType -} - -// GetProtectedItem implements the ProtectedItemClassification interface for type ProtectedItem. -func (p *ProtectedItem) GetProtectedItem() *ProtectedItem { return p } - -// ProtectedItemQueryObject - Filters to list backup items. -type ProtectedItemQueryObject struct { - // Backup Engine name - BackupEngineName *string - - // Backup management type for the backed up item. - BackupManagementType *BackupManagementType - - // Name of the backup set. - BackupSetName *string - - // Name of the container. - ContainerName *string - - // Name of the fabric. - FabricName *string - - // Friendly name of protected item - FriendlyName *string - - // Health State for the backed up item. - HealthState *HealthState - - // Type of workload this item represents. - ItemType *DataSourceType - - // Backup policy name associated with the backup item. - PolicyName *string -} - -// ProtectedItemResource - Base class for backup items. -type ProtectedItemResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // ProtectedItemResource properties - Properties ProtectedItemClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// ProtectedItemResourceList - List of ProtectedItem resources -type ProtectedItemResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*ProtectedItemResource -} - -// ProtectionContainer - Base class for container with backup items. Containers with specific workloads are derived from this -// class. -type ProtectionContainer struct { - // REQUIRED; Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines - // 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows - // machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. - // 6. Azure workload Backup is VMAppContainer - ContainerType *ProtectableContainerType - - // Type of backup management for the container. - BackupManagementType *BackupManagementType - - // Friendly name of the container. - FriendlyName *string - - // Status of health of the container. - HealthStatus *string - - // Type of the protectable object associated with this container - ProtectableObjectType *string - - // Status of registration of the container with the Recovery Services Vault. - RegistrationStatus *string -} - -// GetProtectionContainer implements the ProtectionContainerClassification interface for type ProtectionContainer. -func (p *ProtectionContainer) GetProtectionContainer() *ProtectionContainer { return p } - -// ProtectionContainerResource - Base class for container with backup items. Containers with specific workloads are derived -// from this class. -type ProtectionContainerResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // ProtectionContainerResource properties - Properties ProtectionContainerClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// ProtectionContainerResourceList - List of ProtectionContainer resources -type ProtectionContainerResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*ProtectionContainerResource -} - -// ProtectionIntent - Base class for backup ProtectionIntent. -type ProtectionIntent struct { - // REQUIRED; backup protectionIntent type. - ProtectionIntentItemType *ProtectionIntentItemType - - // Type of backup management for the backed up item. - BackupManagementType *BackupManagementType - - // ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId - ItemID *string - - // ID of the backup policy with which this item is backed up. - PolicyID *string - - // Backup state of this backup item. - ProtectionState *ProtectionStatus - - // ARM ID of the resource to be backed up. - SourceResourceID *string -} - -// GetProtectionIntent implements the ProtectionIntentClassification interface for type ProtectionIntent. -func (p *ProtectionIntent) GetProtectionIntent() *ProtectionIntent { return p } - -// ProtectionIntentQueryObject - Filters to list protection intent. -type ProtectionIntentQueryObject struct { - // Backup management type for the backed up item - BackupManagementType *BackupManagementType - - // Item name of the intent - ItemName *string - - // Type of workload this item represents - ItemType *IntentItemType - - // Parent name of the intent - ParentName *string -} - -// ProtectionIntentResource - Base class for backup ProtectionIntent. -type ProtectionIntentResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // ProtectionIntentResource properties - Properties ProtectionIntentClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// ProtectionIntentResourceList - List of ProtectionIntent resources -type ProtectionIntentResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*ProtectionIntentResource -} - -// ProtectionPolicy - Base class for backup policy. Workload-specific backup policies are derived from this class. -type ProtectionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - BackupManagementType *string - - // Number of items associated with this policy. - ProtectedItemsCount *int32 - - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string -} - -// GetProtectionPolicy implements the ProtectionPolicyClassification interface for type ProtectionPolicy. -func (p *ProtectionPolicy) GetProtectionPolicy() *ProtectionPolicy { return p } - -// ProtectionPolicyQueryObject - Filters the list backup policies API. -type ProtectionPolicyQueryObject struct { - // Backup management type for the backup policy. - BackupManagementType *BackupManagementType - - // Fabric name for filter - FabricName *string - - // Workload type for the backup policy. - WorkloadType *WorkloadType -} - -// ProtectionPolicyResource - Base class for backup policy. Workload-specific backup policies are derived from this class. -type ProtectionPolicyResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // ProtectionPolicyResource properties - Properties ProtectionPolicyClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// ProtectionPolicyResourceList - List of ProtectionPolicy resources -type ProtectionPolicyResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*ProtectionPolicyResource -} - -// RecoveryPoint - Base class for backup copies. Workload-specific backup copies are derived from this class. -type RecoveryPoint struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string -} - -// GetRecoveryPoint implements the RecoveryPointClassification interface for type RecoveryPoint. -func (r *RecoveryPoint) GetRecoveryPoint() *RecoveryPoint { return r } - -// RecoveryPointDiskConfiguration - Disk configuration -type RecoveryPointDiskConfiguration struct { - // Information of disks excluded from backup - ExcludedDiskList []*DiskInformation - - // Information of disks included in backup - IncludedDiskList []*DiskInformation - - // Number of disks attached to the VM - NumberOfDisksAttachedToVM *int32 - - // Number of disks included in backup - NumberOfDisksIncludedInBackup *int32 -} - -type RecoveryPointMoveReadinessInfo struct { - AdditionalInfo *string - IsReadyForMove *bool -} - -// RecoveryPointProperties - Properties of Recovery Point -type RecoveryPointProperties struct { - // Expiry time of Recovery Point in UTC. - ExpiryTime *string - - // Bool to indicate whether RP is in soft delete state or not - IsSoftDeleted *bool - - // Rule name tagged on Recovery Point that governs life cycle - RuleName *string -} - -// RecoveryPointRehydrationInfo - RP Rehydration Info -type RecoveryPointRehydrationInfo struct { - // Rehydration Priority - RehydrationPriority *RehydrationPriority - - // How long the rehydrated RP should be kept Should be ISO8601 Duration format e.g. "P7D" - RehydrationRetentionDuration *string -} - -// RecoveryPointResource - Base class for backup copies. Workload-specific backup copies are derived from this class. -type RecoveryPointResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // RecoveryPointResource properties - Properties RecoveryPointClassification - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// RecoveryPointResourceList - List of RecoveryPoint resources -type RecoveryPointResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*RecoveryPointResource -} - -// RecoveryPointTierInformation - Recovery point tier information. -type RecoveryPointTierInformation struct { - // Recovery point tier status. - ExtendedInfo map[string]*string - - // Recovery point tier status. - Status *RecoveryPointTierStatus - - // Recovery point tier type. - Type *RecoveryPointTierType -} - -// RecoveryPointTierInformationV2 - RecoveryPoint Tier Information V2 -type RecoveryPointTierInformationV2 struct { - // Recovery point tier status. - ExtendedInfo map[string]*string - - // Recovery point tier status. - Status *RecoveryPointTierStatus - - // Recovery point tier type. - Type *RecoveryPointTierType -} - -// Resource - ARM Resource. -type Resource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -type ResourceGuardOperationDetail struct { - DefaultResourceRequest *string - VaultCriticalOperation *string -} - -type ResourceGuardProxyBase struct { - // REQUIRED - ResourceGuardResourceID *string - Description *string - LastUpdatedTime *string - ResourceGuardOperationDetails []*ResourceGuardOperationDetail -} - -type ResourceGuardProxyBaseResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string - - // ResourceGuardProxyBaseResource properties - Properties *ResourceGuardProxyBase - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string - - // READ-ONLY; Resource name associated with the resource. - Name *string - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} - -// ResourceGuardProxyBaseResourceList - List of ResourceGuardProxyBase resources -type ResourceGuardProxyBaseResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string - - // List of resources. - Value []*ResourceGuardProxyBaseResource -} - -// ResourceHealthDetails - Health Details for backup items. -type ResourceHealthDetails struct { - // READ-ONLY; Health Code - Code *int32 - - // READ-ONLY; Health Message - Message *string - - // READ-ONLY; Health Recommended Actions - Recommendations []*string - - // READ-ONLY; Health Title - Title *string -} - -// ResourceList - Base for all lists of resources. -type ResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string -} - -// RestoreFileSpecs - Restore file specs like file path, type and target folder path info. -type RestoreFileSpecs struct { - // Indicates what the Path variable stands for - FileSpecType *string - - // Source File/Folder path - Path *string - - // Destination folder path in target FileShare - TargetFolderPath *string -} - -// RestoreRequest - Base class for restore request. Workload-specific restore requests are derived from this class. -type RestoreRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string - - // ResourceGuardOperationRequests on which LAC check will be performed - ResourceGuardOperationRequests []*string -} - -// GetRestoreRequest implements the RestoreRequestClassification interface for type RestoreRequest. -func (r *RestoreRequest) GetRestoreRequest() *RestoreRequest { return r } - -// RestoreRequestResource - Base class for restore request. Workload-specific restore requests are derived from this class. -type RestoreRequestResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string + // List of tasks for this job. + TasksList []*MabJobTaskDetails +} - // RestoreRequestResource properties - Properties RestoreRequestClassification +// MabJobTaskDetails - MAB workload-specific job task details. +type MabJobTaskDetails struct { + // Time elapsed for task. + Duration *string - // Resource tags. - Tags map[string]*string + // The end time. + EndTime *time.Time - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string + // The start time. + StartTime *time.Time - // READ-ONLY; Resource name associated with the resource. - Name *string + // The status. + Status *string - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string + // The task display name. + TaskID *string } -// RetentionDuration - Retention duration. -type RetentionDuration struct { - // Count of duration types. Retention duration is obtained by the counting the duration type Count times. For example, when - // Count = 3 and DurationType = Weeks, retention duration will be three weeks. - Count *int32 +// NameInfo - The name of usage. +type NameInfo struct { + // Localized value of usage. + LocalizedValue *string - // Retention duration type of retention policy. - DurationType *RetentionDurationType + // Value of usage. + Value *string } -// RetentionPolicy - Base class for retention policy. -type RetentionPolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - RetentionPolicyType *string +// NewErrorResponse - The resource management error response. +type NewErrorResponse struct { + // The error object. + Error *NewErrorResponseError } -// GetRetentionPolicy implements the RetentionPolicyClassification interface for type RetentionPolicy. -func (r *RetentionPolicy) GetRetentionPolicy() *RetentionPolicy { return r } +// NewErrorResponseError - The error object. +type NewErrorResponseError struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo -// SQLDataDirectory info -type SQLDataDirectory struct { - // Logical name of the file - LogicalName *string + // READ-ONLY; The error code. + Code *string - // File path - Path *string + // READ-ONLY; The error details. + Details []*NewErrorResponse - // Type of data directory mapping - Type *SQLDataDirectoryType -} + // READ-ONLY; The error message. + Message *string -// SQLDataDirectoryMapping - Encapsulates information regarding data directory -type SQLDataDirectoryMapping struct { - // Type of data directory mapping - MappingType *SQLDataDirectoryType + // READ-ONLY; The error target. + Target *string +} - // Restore source logical name path - SourceLogicalName *string +// OperationStatus - Operation status. +type OperationStatus struct { + // Operation end time. Format: ISO-8601. + EndTime *time.Time - // Restore source path - SourcePath *string + // Error information related to this operation. + Error *OperationStatusError - // Target path - TargetPath *string -} + // ID of the operation. + ID *string -// SchedulePolicy - Base class for backup schedule. -type SchedulePolicy struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - SchedulePolicyType *string -} + // Name of the operation. + Name *string -// GetSchedulePolicy implements the SchedulePolicyClassification interface for type SchedulePolicy. -func (s *SchedulePolicy) GetSchedulePolicy() *SchedulePolicy { return s } + // Additional information associated with this operation. + Properties OperationStatusExtendedInfoClassification -// SecuredVMDetails - Restore request parameters for Secured VMs -type SecuredVMDetails struct { - // Gets or Sets Disk Encryption Set Id for Secured VM OS Disk - SecuredVMOsDiskEncryptionSetID *string -} + // Operation start time. Format: ISO-8601. + StartTime *time.Time -// SecurityPinBase - Base class for get security pin request body -type SecurityPinBase struct { - // ResourceGuard Operation Requests - ResourceGuardOperationRequests []*string + // Operation status. + Status *OperationStatusValues } -// Settings - Common settings field for backup management -type Settings struct { - // Workload compression flag. This has been added so that 'isSqlCompression' will be deprecated once clients upgrade to consider - // this flag. - IsCompression *bool - - // SQL compression flag - Issqlcompression *bool +// OperationStatusError - Error information associated with operation status call. +type OperationStatusError struct { + // Error code of the operation failure. + Code *string - // TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". - TimeZone *string + // Error message displayed if the operation failure. + Message *string } -// SimpleRetentionPolicy - Simple policy retention. -type SimpleRetentionPolicy struct { +// OperationStatusExtendedInfo - Base class for additional information of operation status. +type OperationStatusExtendedInfo struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - RetentionPolicyType *string - - // Retention duration of the protection policy. - RetentionDuration *RetentionDuration + ObjectType *string } -// GetRetentionPolicy implements the RetentionPolicyClassification interface for type SimpleRetentionPolicy. -func (s *SimpleRetentionPolicy) GetRetentionPolicy() *RetentionPolicy { - return &RetentionPolicy{ - RetentionPolicyType: s.RetentionPolicyType, - } +// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusExtendedInfo. +func (o *OperationStatusExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { + return o } -// SimpleSchedulePolicy - Simple policy schedule. -type SimpleSchedulePolicy struct { +// OperationStatusJobExtendedInfo - Operation status job extended info. +type OperationStatusJobExtendedInfo struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - SchedulePolicyType *string - - // Hourly Schedule of this Policy - HourlySchedule *HourlySchedule - - // List of days of week this schedule has to be run. - ScheduleRunDays []*DayOfWeek - - // Frequency of the schedule operation of this policy. - ScheduleRunFrequency *ScheduleRunType - - // List of times of day this schedule has to be run. - ScheduleRunTimes []*time.Time + ObjectType *string - // At every number weeks this schedule has to be run. - ScheduleWeeklyFrequency *int32 + // ID of the job created for this protected item. + JobID *string } -// GetSchedulePolicy implements the SchedulePolicyClassification interface for type SimpleSchedulePolicy. -func (s *SimpleSchedulePolicy) GetSchedulePolicy() *SchedulePolicy { - return &SchedulePolicy{ - SchedulePolicyType: s.SchedulePolicyType, +// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusJobExtendedInfo. +func (o *OperationStatusJobExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { + return &OperationStatusExtendedInfo{ + ObjectType: o.ObjectType, } } -// SimpleSchedulePolicyV2 - The V2 policy schedule for IaaS that supports hourly backups. -type SimpleSchedulePolicyV2 struct { +// OperationStatusJobsExtendedInfo - Operation status extended info for list of jobs. +type OperationStatusJobsExtendedInfo struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - SchedulePolicyType *string - - // Daily schedule of this policy - DailySchedule *DailySchedule - - // hourly schedule of this policy - HourlySchedule *HourlySchedule + ObjectType *string - // Frequency of the schedule operation of this policy. - ScheduleRunFrequency *ScheduleRunType + // Stores all the failed jobs along with the corresponding error codes. + FailedJobsError map[string]*string - // Weekly schedule of this policy - WeeklySchedule *WeeklySchedule + // IDs of the jobs created for the protected item. + JobIDs []*string } -// GetSchedulePolicy implements the SchedulePolicyClassification interface for type SimpleSchedulePolicyV2. -func (s *SimpleSchedulePolicyV2) GetSchedulePolicy() *SchedulePolicy { - return &SchedulePolicy{ - SchedulePolicyType: s.SchedulePolicyType, +// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusJobsExtendedInfo. +func (o *OperationStatusJobsExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { + return &OperationStatusExtendedInfo{ + ObjectType: o.ObjectType, } } -// SnapshotBackupAdditionalDetails - Snapshot Backup related fields for WorkloadType SaPHanaSystem -type SnapshotBackupAdditionalDetails struct { - InstantRPDetails *string - InstantRpRetentionRangeInDays *int32 +// OperationStatusProvisionILRExtendedInfo - Operation status extended info for ILR provision action. +type OperationStatusProvisionILRExtendedInfo struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // User assigned managed identity details - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails + // Target details for file / folder restore. + RecoveryTarget *InstantItemRecoveryTarget } -// SnapshotRestoreParameters - Encapsulates information regarding snapshot recovery for SAP Hana -type SnapshotRestoreParameters struct { - LogPointInTimeForDBRecovery *string - SkipAttachAndMount *bool +// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusProvisionILRExtendedInfo. +func (o *OperationStatusProvisionILRExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { + return &OperationStatusExtendedInfo{ + ObjectType: o.ObjectType, + } } -// SubProtectionPolicy - Sub-protection policy which includes schedule and retention -type SubProtectionPolicy struct { - // Type of backup policy type - PolicyType *PolicyType - - // Retention policy with the details on backup copy retention ranges. - RetentionPolicy RetentionPolicyClassification - - // Backup schedule specified as part of backup policy. - SchedulePolicy SchedulePolicyClassification +// OperationStatusRecoveryPointExtendedInfo - Operation status extended info for Updated Recovery Point. +type OperationStatusRecoveryPointExtendedInfo struct { + // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + ObjectType *string - // Snapshot Backup related fields for WorkloadType SaPHanaSystem - SnapshotBackupAdditionalDetails *SnapshotBackupAdditionalDetails + // In case the share is in soft-deleted state, populate this field with deleted backup item + DeletedBackupItemVersion *string - // Tiering policy to automatically move RPs to another tier. Key is Target Tier, defined in RecoveryPointTierType enum. Tiering - // policy specifies the criteria to move RP to the target tier. - TieringPolicy map[string]*TieringPolicy + // Recovery Point info with updated source snapshot URI + UpdatedRecoveryPoint RecoveryPointClassification } -// TargetAFSRestoreInfo - Target Azure File Share Info. -type TargetAFSRestoreInfo struct { - // File share name - Name *string - - // Target file share resource ARM ID - TargetResourceID *string +// GetOperationStatusExtendedInfo implements the OperationStatusExtendedInfoClassification interface for type OperationStatusRecoveryPointExtendedInfo. +func (o *OperationStatusRecoveryPointExtendedInfo) GetOperationStatusExtendedInfo() *OperationStatusExtendedInfo { + return &OperationStatusExtendedInfo{ + ObjectType: o.ObjectType, + } } -// TargetDiskNetworkAccessSettings - Specifies target network access settings for disks of VM to be restored. -type TargetDiskNetworkAccessSettings struct { - // Gets or sets the ARM resource ID of the target disk access to be used when TargetDiskNetworkAccessOption is set to TargetDiskNetworkAccessOption.UseNew - TargetDiskAccessID *string +// PointInTimeRange - Provides details for log ranges +type PointInTimeRange struct { + // End time of the time range for log recovery. + EndTime *time.Time - // Network access settings to be used for restored disks - TargetDiskNetworkAccessOption *TargetDiskNetworkAccessOption + // Start time of the time range for log recovery. + StartTime *time.Time } -// TargetRestoreInfo - Details about target workload during restore operation. -type TargetRestoreInfo struct { - // Resource Id name of the container in which Target DataBase resides - ContainerID *string +// ProtectedItem - Base class for backup items. +type ProtectedItem struct { + // REQUIRED; backup item type. + ProtectedItemType *string - // Database name InstanceName/DataBaseName for SQL or System/DbName for SAP Hana - DatabaseName *string + // Type of backup management for the backed up item. + BackupManagementType *BackupManagementType - // Can Overwrite if Target DataBase already exists - OverwriteOption *OverwriteOptions + // Name of the backup set the backup item belongs to + BackupSetName *string - // Target directory location for restore as files. - TargetDirectoryForFileRestore *string -} + // Unique name of container + ContainerName *string -// TieringCostInfo - Base class for tiering cost response -type TieringCostInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string -} + // Create mode to indicate recovery of existing soft deleted data source or creation of new data source. + CreateMode *CreateMode -// GetTieringCostInfo implements the TieringCostInfoClassification interface for type TieringCostInfo. -func (t *TieringCostInfo) GetTieringCostInfo() *TieringCostInfo { return t } + // Time for deferred deletion in UTC + DeferredDeleteTimeInUTC *time.Time -// TieringCostRehydrationInfo - Response parameters for tiering cost info for rehydration -type TieringCostRehydrationInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string + // Time remaining before the DS marked for deferred delete is permanently deleted + DeferredDeleteTimeRemaining *string - // REQUIRED; Rehydration size in bytes - RehydrationSizeInBytes *int64 + // Flag to identify whether the deferred deleted DS is to be purged soon + IsDeferredDeleteScheduleUpcoming *bool - // REQUIRED; Source tier to target tier rehydration cost per GB per month - RetailRehydrationCostPerGBPerMonth *float64 -} + // Flag to identify that deferred deleted DS is to be moved into Pause state + IsRehydrate *bool -// GetTieringCostInfo implements the TieringCostInfoClassification interface for type TieringCostRehydrationInfo. -func (t *TieringCostRehydrationInfo) GetTieringCostInfo() *TieringCostInfo { - return &TieringCostInfo{ - ObjectType: t.ObjectType, - } -} + // Flag to identify whether the DS is scheduled for deferred delete + IsScheduledForDeferredDelete *bool -// TieringCostSavingInfo - Response parameters for tiering cost info for savings -type TieringCostSavingInfo struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string + // Timestamp when the last (latest) backup copy was created for this backup item. + LastRecoveryPoint *time.Time - // REQUIRED; Source tier retail cost per GB per month - RetailSourceTierCostPerGBPerMonth *float64 + // ID of the backup policy with which this item is backed up. + PolicyID *string - // REQUIRED; Target tier retail cost per GB per month - RetailTargetTierCostPerGBPerMonth *float64 + // ResourceGuardOperationRequests on which LAC check will be performed + ResourceGuardOperationRequests []*string - // REQUIRED; Source tier size reduction in bytes after moving all the recommended backup points to target tier - SourceTierSizeReductionInBytes *int64 + // ARM ID of the resource to be backed up. + SourceResourceID *string - // REQUIRED; Target tier size increase in bytes after moving all the recommended backup points to target tier - TargetTierSizeIncreaseInBytes *int64 + // Type of workload this item represents. + WorkloadType *DataSourceType } -// GetTieringCostInfo implements the TieringCostInfoClassification interface for type TieringCostSavingInfo. -func (t *TieringCostSavingInfo) GetTieringCostInfo() *TieringCostInfo { - return &TieringCostInfo{ - ObjectType: t.ObjectType, - } -} +// GetProtectedItem implements the ProtectedItemClassification interface for type ProtectedItem. +func (p *ProtectedItem) GetProtectedItem() *ProtectedItem { return p } -// TieringPolicy - Tiering Policy for a target tier. If the policy is not specified for a given target tier, service retains -// the existing configured tiering policy for that tier -type TieringPolicy struct { - // Number of days/weeks/months/years to retain backups in current tier before tiering. Used only if TieringMode is set to - // TierAfter - Duration *int32 +// ProtectedItemQueryObject - Filters to list backup items. +type ProtectedItemQueryObject struct { + // Backup Engine name + BackupEngineName *string - // Retention duration type: days/weeks/months/years Used only if TieringMode is set to TierAfter - DurationType *RetentionDurationType + // Backup management type for the backed up item. + BackupManagementType *BackupManagementType - // Tiering Mode to control automatic tiering of recovery points. Supported values are: - // 1. TierRecommended: Tier all recovery points recommended to be tiered - // 2. TierAfter: Tier all recovery points after a fixed period, as specified in duration + durationType below. - // 3. DoNotTier: Do not tier any recovery points - TieringMode *TieringMode -} + // Name of the backup set. + BackupSetName *string -// TokenInformation - The token information details. -type TokenInformation struct { - // Expiry time of token. - ExpiryTimeInUTCTicks *int64 + // Name of the container. + ContainerName *string - // Security PIN - SecurityPIN *string + // Name of the fabric. + FabricName *string - // Token value. - Token *string -} + // Friendly name of protected item + FriendlyName *string -// TriggerDataMoveRequest - Trigger DataMove Request -type TriggerDataMoveRequest struct { - // REQUIRED; Correlation Id - CorrelationID *string + // Health State for the backed up item. + HealthState *HealthState - // REQUIRED; DataMove Level - DataMoveLevel *DataMoveLevel + // Type of workload this item represents. + ItemType *DataSourceType - // REQUIRED; Source Region - SourceRegion *string + // Backup policy name associated with the backup item. + PolicyName *string +} - // REQUIRED; ARM Id of source vault - SourceResourceID *string +// ProtectedItemResource - Base class for backup items. +type ProtectedItemResource struct { + // Optional ETag. + ETag *string - // Pause GC - PauseGC *bool + // Resource location. + Location *string - // Source Container ArmIds - SourceContainerArmIDs []*string -} + // ProtectedItemResource properties + Properties ProtectedItemClassification -// UnlockDeleteRequest - Request body of unlock delete API. -type UnlockDeleteRequest struct { - ResourceGuardOperationRequests []*string - ResourceToBeDeleted *string -} + // Resource tags. + Tags map[string]*string -// UnlockDeleteResponse - Response of Unlock Delete API. -type UnlockDeleteResponse struct { - // This is the time when unlock delete privileges will get expired. - UnlockDeleteExpiryTime *string -} + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string -// UserAssignedIdentityProperties - User assigned managed identity properties -type UserAssignedIdentityProperties struct { - // The client ID of the assigned identity. - ClientID *string + // READ-ONLY; Resource name associated with the resource. + Name *string - // The principal ID of the assigned identity. - PrincipalID *string + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string } -// UserAssignedManagedIdentityDetails - User assigned managed identity details -type UserAssignedManagedIdentityDetails struct { - // The ARM id of the assigned identity. - IdentityArmID *string - - // The name of the assigned identity. - IdentityName *string +// ProtectedItemResourceList - List of ProtectedItem resources +type ProtectedItemResourceList struct { + // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. + NextLink *string - // User assigned managed identity properties - UserAssignedIdentityProperties *UserAssignedIdentityProperties + // List of resources. + Value []*ProtectedItemResource } -// ValidateIaasVMRestoreOperationRequest - AzureRestoreValidation request. -type ValidateIaasVMRestoreOperationRequest struct { +// RecoveryPoint - Base class for backup copies. Workload-specific backup copies are derived from this class. +type RecoveryPoint struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. ObjectType *string - - // Sets restore request to be validated - RestoreRequest RestoreRequestClassification -} - -// GetValidateOperationRequest implements the ValidateOperationRequestClassification interface for type ValidateIaasVMRestoreOperationRequest. -func (v *ValidateIaasVMRestoreOperationRequest) GetValidateOperationRequest() *ValidateOperationRequest { - return &ValidateOperationRequest{ - ObjectType: v.ObjectType, - } } -// GetValidateRestoreOperationRequest implements the ValidateRestoreOperationRequestClassification interface for type ValidateIaasVMRestoreOperationRequest. -func (v *ValidateIaasVMRestoreOperationRequest) GetValidateRestoreOperationRequest() *ValidateRestoreOperationRequest { - return &ValidateRestoreOperationRequest{ - ObjectType: v.ObjectType, - RestoreRequest: v.RestoreRequest, - } -} +// GetRecoveryPoint implements the RecoveryPointClassification interface for type RecoveryPoint. +func (r *RecoveryPoint) GetRecoveryPoint() *RecoveryPoint { return r } -// ValidateOperationRequest - Base class for validate operation request. -type ValidateOperationRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string -} +// RecoveryPointDiskConfiguration - Disk configuration +type RecoveryPointDiskConfiguration struct { + // Information of disks excluded from backup + ExcludedDiskList []*DiskInformation -// GetValidateOperationRequest implements the ValidateOperationRequestClassification interface for type ValidateOperationRequest. -func (v *ValidateOperationRequest) GetValidateOperationRequest() *ValidateOperationRequest { return v } + // Information of disks included in backup + IncludedDiskList []*DiskInformation -// ValidateOperationRequestResource - Base class for validate operation request. -type ValidateOperationRequestResource struct { - // REQUIRED; Recovery point ID. - ID *string + // Number of disks attached to the VM + NumberOfDisksAttachedToVM *int32 - // REQUIRED; ValidateOperationRequestResource properties - Properties ValidateOperationRequestClassification + // Number of disks included in backup + NumberOfDisksIncludedInBackup *int32 } -// ValidateOperationResponse - Base class for validate operation response. -type ValidateOperationResponse struct { - // Gets the validation result - ValidationResults []*ErrorDetail +type RecoveryPointMoveReadinessInfo struct { + AdditionalInfo *string + IsReadyForMove *bool } -type ValidateOperationsResponse struct { - // Base class for validate operation response. - ValidateOperationResponse *ValidateOperationResponse -} +// RecoveryPointProperties - Properties of Recovery Point +type RecoveryPointProperties struct { + // Expiry time of Recovery Point in UTC. + ExpiryTime *string -// ValidateRestoreOperationRequest - AzureRestoreValidation request. -type ValidateRestoreOperationRequest struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - ObjectType *string + // Bool to indicate whether RP is in soft delete state or not + IsSoftDeleted *bool - // Sets restore request to be validated - RestoreRequest RestoreRequestClassification + // Rule name tagged on Recovery Point that governs life cycle + RuleName *string } -// GetValidateOperationRequest implements the ValidateOperationRequestClassification interface for type ValidateRestoreOperationRequest. -func (v *ValidateRestoreOperationRequest) GetValidateOperationRequest() *ValidateOperationRequest { - return &ValidateOperationRequest{ - ObjectType: v.ObjectType, - } -} +// RecoveryPointResource - Base class for backup copies. Workload-specific backup copies are derived from this class. +type RecoveryPointResource struct { + // Optional ETag. + ETag *string -// GetValidateRestoreOperationRequest implements the ValidateRestoreOperationRequestClassification interface for type ValidateRestoreOperationRequest. -func (v *ValidateRestoreOperationRequest) GetValidateRestoreOperationRequest() *ValidateRestoreOperationRequest { - return v -} + // Resource location. + Location *string -// VaultJob - Vault level Job -type VaultJob struct { - // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. - JobType *string + // RecoveryPointResource properties + Properties RecoveryPointClassification - // Gets or sets the state/actions applicable on this job like cancel/retry. - ActionsInfo []*JobSupportedAction + // Resource tags. + Tags map[string]*string - // ActivityId of job. - ActivityID *string + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string - // Backup management type to execute the current job. - BackupManagementType *BackupManagementType + // READ-ONLY; Resource name associated with the resource. + Name *string - // Time elapsed during the execution of this job. - Duration *string + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string +} - // The end time. - EndTime *time.Time +// RecoveryPointResourceList - List of RecoveryPoint resources +type RecoveryPointResourceList struct { + // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. + NextLink *string - // Friendly name of the entity on which the current job is executing. - EntityFriendlyName *string + // List of resources. + Value []*RecoveryPointResource +} - // Error details on execution of this job. - ErrorDetails []*VaultJobErrorInfo +// RecoveryPointTierInformation - Recovery point tier information. +type RecoveryPointTierInformation struct { + // Recovery point tier status. + ExtendedInfo map[string]*string - // Additional information about the job. - ExtendedInfo *VaultJobExtendedInfo + // Recovery point tier status. + Status *RecoveryPointTierStatus - // The operation name. - Operation *string + // Recovery point tier type. + Type *RecoveryPointTierType +} - // The start time. - StartTime *time.Time +// Resource - ARM Resource. +type Resource struct { + // Optional ETag. + ETag *string - // Job status. - Status *string -} + // Resource location. + Location *string -// GetJob implements the JobClassification interface for type VaultJob. -func (v *VaultJob) GetJob() *Job { - return &Job{ - ActivityID: v.ActivityID, - BackupManagementType: v.BackupManagementType, - EndTime: v.EndTime, - EntityFriendlyName: v.EntityFriendlyName, - JobType: v.JobType, - Operation: v.Operation, - StartTime: v.StartTime, - Status: v.Status, - } + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string + + // READ-ONLY; Resource name associated with the resource. + Name *string + + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string } -// VaultJobErrorInfo - Vault Job specific error information -type VaultJobErrorInfo struct { - // Error code. - ErrorCode *int32 +// ResourceHealthDetails - Health Details for backup items. +type ResourceHealthDetails struct { + // READ-ONLY; Health Code + Code *int32 - // Localized error string. - ErrorString *string + // READ-ONLY; Health Message + Message *string - // List of localized recommendations for above error code. + // READ-ONLY; Health Recommended Actions Recommendations []*string + + // READ-ONLY; Health Title + Title *string } -// VaultJobExtendedInfo - Vault Job for CMK - has CMK specific info. -type VaultJobExtendedInfo struct { - // Job properties. - PropertyBag map[string]*string +// ResourceList - Base for all lists of resources. +type ResourceList struct { + // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. + NextLink *string } -// VaultRetentionPolicy - Vault retention policy for AzureFileShare -type VaultRetentionPolicy struct { - // REQUIRED - SnapshotRetentionInDays *int32 +// RestoreFileSpecs - Restore file specs like file path, type and target folder path info. +type RestoreFileSpecs struct { + // Indicates what the Path variable stands for + FileSpecType *string + + // Source File/Folder path + Path *string - // REQUIRED; Base class for retention policy. - VaultRetention RetentionPolicyClassification + // Destination folder path in target FileShare + TargetFolderPath *string } -// VaultStorageConfigOperationResultResponse - Operation result response for Vault Storage Config -type VaultStorageConfigOperationResultResponse struct { +// RestoreRequest - Base class for restore request. Workload-specific restore requests are derived from this class. +type RestoreRequest struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. ObjectType *string } -// GetVaultStorageConfigOperationResultResponse implements the VaultStorageConfigOperationResultResponseClassification interface -// for type VaultStorageConfigOperationResultResponse. -func (v *VaultStorageConfigOperationResultResponse) GetVaultStorageConfigOperationResultResponse() *VaultStorageConfigOperationResultResponse { - return v -} +// GetRestoreRequest implements the RestoreRequestClassification interface for type RestoreRequest. +func (r *RestoreRequest) GetRestoreRequest() *RestoreRequest { return r } -// WeeklyRetentionFormat - Weekly retention format. -type WeeklyRetentionFormat struct { - // List of days of the week. - DaysOfTheWeek []*DayOfWeek +// SQLDataDirectory info +type SQLDataDirectory struct { + // Logical name of the file + LogicalName *string - // List of weeks of month. - WeeksOfTheMonth []*WeekOfMonth -} + // File path + Path *string -// WeeklyRetentionSchedule - Weekly retention schedule. -type WeeklyRetentionSchedule struct { - // List of days of week for weekly retention policy. - DaysOfTheWeek []*DayOfWeek + // Type of data directory mapping + Type *SQLDataDirectoryType +} - // Retention duration of retention Policy. - RetentionDuration *RetentionDuration +// SQLDataDirectoryMapping - Encapsulates information regarding data directory +type SQLDataDirectoryMapping struct { + // Type of data directory mapping + MappingType *SQLDataDirectoryType - // Retention times of retention policy. - RetentionTimes []*time.Time -} + // Restore source logical name path + SourceLogicalName *string -type WeeklySchedule struct { - ScheduleRunDays []*DayOfWeek + // Restore source path + SourcePath *string - // List of times of day this schedule has to be run. - ScheduleRunTimes []*time.Time + // Target path + TargetPath *string } -// WorkloadInquiryDetails - Details of an inquired protectable item. -type WorkloadInquiryDetails struct { - // Inquiry validation such as permissions and other backup validations. - InquiryValidation *InquiryValidation - - // Contains the protectable item Count inside this Container. - ItemCount *int64 +// TargetAFSRestoreInfo - Target Azure File Share Info. +type TargetAFSRestoreInfo struct { + // File share name + Name *string - // Type of the Workload such as SQL, Oracle etc. - Type *string + // Target file share resource ARM ID + TargetResourceID *string } -// WorkloadItem - Base class for backup item. Workload-specific backup items are derived from this class. -type WorkloadItem struct { - // REQUIRED; Type of the backup item. - WorkloadItemType *string - - // Type of backup management to backup an item. - BackupManagementType *string +// TargetRestoreInfo - Details about target workload during restore operation. +type TargetRestoreInfo struct { + // Resource Id name of the container in which Target DataBase resides + ContainerID *string - // Friendly name of the backup item. - FriendlyName *string + // Database name InstanceName/DataBaseName for SQL or System/DbName for SAP Hana + DatabaseName *string - // State of the back up item. - ProtectionState *ProtectionStatus + // Can Overwrite if Target DataBase already exists + OverwriteOption *OverwriteOptions - // Type of workload for the backup management - WorkloadType *string + // Target directory location for restore as files. + TargetDirectoryForFileRestore *string } -// GetWorkloadItem implements the WorkloadItemClassification interface for type WorkloadItem. -func (w *WorkloadItem) GetWorkloadItem() *WorkloadItem { return w } - -// WorkloadItemResource - Base class for backup item. Workload-specific backup items are derived from this class. -type WorkloadItemResource struct { - // Optional ETag. - ETag *string - - // Resource location. - Location *string +type WorkloadCrrAccessToken struct { + // REQUIRED; Type of the specific object - used for deserializing + ObjectType *string - // WorkloadItemResource properties - Properties WorkloadItemClassification + // Access token used for authentication + AccessTokenString *string - // Resource tags. - Tags map[string]*string + // Active region name of BMS Stamp + BMSActiveRegion *string - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string + // Backup Management Type + BackupManagementType *string - // READ-ONLY; Resource name associated with the resource. - Name *string + // Container Id + ContainerID *string - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} + // Container Unique name + ContainerName *string -// WorkloadItemResourceList - List of WorkloadItem resources -type WorkloadItemResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string + // Container Type + ContainerType *string - // List of resources. - Value []*WorkloadItemResource -} + // CoordinatorServiceStampId to be used by BCM in restore call + CoordinatorServiceStampID *string -// WorkloadProtectableItem - Base class for backup item. Workload-specific backup items are derived from this class. -type WorkloadProtectableItem struct { - // REQUIRED; Type of the backup item. - ProtectableItemType *string + // CoordinatorServiceStampUri to be used by BCM in restore call + CoordinatorServiceStampURI *string - // Type of backup management to backup an item. - BackupManagementType *string + // Datasource Container Unique Name + DatasourceContainerName *string - // Friendly name of the backup item. - FriendlyName *string + // Datasource Id + DatasourceID *string - // State of the back up item. - ProtectionState *ProtectionStatus + // Datasource Friendly Name + DatasourceName *string - // Type of workload for the backup management - WorkloadType *string -} + // Datasource Type + DatasourceType *string -// GetWorkloadProtectableItem implements the WorkloadProtectableItemClassification interface for type WorkloadProtectableItem. -func (w *WorkloadProtectableItem) GetWorkloadProtectableItem() *WorkloadProtectableItem { return w } + // Policy Id + PolicyID *string -// WorkloadProtectableItemResource - Base class for backup item. Workload-specific backup items are derived from this class. -type WorkloadProtectableItemResource struct { - // Optional ETag. - ETag *string + // Policy Name + PolicyName *string + ProtectableObjectContainerHostOsName *string + ProtectableObjectFriendlyName *string + ProtectableObjectParentLogicalContainerName *string + ProtectableObjectProtectionState *string + ProtectableObjectUniqueName *string + ProtectableObjectWorkloadType *string - // Resource location. - Location *string + // Protected item container id + ProtectionContainerID *int64 - // WorkloadProtectableItemResource properties - Properties WorkloadProtectableItemClassification + // ProtectionServiceStampId to be used by BCM in restore call + ProtectionServiceStampID *string - // Resource tags. - Tags map[string]*string + // ProtectionServiceStampUri to be used by BCM in restore call + ProtectionServiceStampURI *string - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string + // Recovery Point Id + RecoveryPointID *string - // READ-ONLY; Resource name associated with the resource. - Name *string + // Recovery Point Time + RecoveryPointTime *string - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string -} + // Resource Group name of the source vault + ResourceGroupName *string -// WorkloadProtectableItemResourceList - List of WorkloadProtectableItem resources -type WorkloadProtectableItemResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string + // Resource Id of the source vault + ResourceID *string - // List of resources. - Value []*WorkloadProtectableItemResource -} + // Resource Name of the source vault + ResourceName *string -// YearlyRetentionSchedule - Yearly retention schedule. -type YearlyRetentionSchedule struct { - // List of months of year of yearly retention policy. - MonthsOfYear []*MonthOfYear + // Recovery point information: Managed virtual machine + RpIsManagedVirtualMachine *bool - // Retention duration of retention Policy. - RetentionDuration *RetentionDuration + // Recovery point information: Original SA option + RpOriginalSAOption *bool - // Daily retention format for yearly retention policy. - RetentionScheduleDaily *DailyRetentionFormat + // Recovery point Tier Information + RpTierInformation map[string]*string - // Retention schedule format for yearly retention policy. - RetentionScheduleFormatType *RetentionScheduleFormat + // Recovery point information: VM size description + RpVMSizeDescription *string - // Weekly retention format for yearly retention policy. - RetentionScheduleWeekly *WeeklyRetentionFormat + // Subscription Id of the source vault + SubscriptionID *string - // Retention times of retention policy. - RetentionTimes []*time.Time + // Extended Information about the token like FileSpec etc. + TokenExtendedInformation *string +} + +// GetCrrAccessToken implements the CrrAccessTokenClassification interface for type WorkloadCrrAccessToken. +func (w *WorkloadCrrAccessToken) GetCrrAccessToken() *CrrAccessToken { + return &CrrAccessToken{ + AccessTokenString: w.AccessTokenString, + BMSActiveRegion: w.BMSActiveRegion, + BackupManagementType: w.BackupManagementType, + ContainerName: w.ContainerName, + ContainerType: w.ContainerType, + CoordinatorServiceStampID: w.CoordinatorServiceStampID, + CoordinatorServiceStampURI: w.CoordinatorServiceStampURI, + DatasourceContainerName: w.DatasourceContainerName, + DatasourceID: w.DatasourceID, + DatasourceName: w.DatasourceName, + DatasourceType: w.DatasourceType, + ObjectType: w.ObjectType, + ProtectionContainerID: w.ProtectionContainerID, + ProtectionServiceStampID: w.ProtectionServiceStampID, + ProtectionServiceStampURI: w.ProtectionServiceStampURI, + RecoveryPointID: w.RecoveryPointID, + RecoveryPointTime: w.RecoveryPointTime, + ResourceGroupName: w.ResourceGroupName, + ResourceID: w.ResourceID, + ResourceName: w.ResourceName, + RpIsManagedVirtualMachine: w.RpIsManagedVirtualMachine, + RpOriginalSAOption: w.RpOriginalSAOption, + RpTierInformation: w.RpTierInformation, + RpVMSizeDescription: w.RpVMSizeDescription, + SubscriptionID: w.SubscriptionID, + TokenExtendedInformation: w.TokenExtendedInformation, + } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models_serde.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models_serde.go index 905c62732003..4a971e575c80 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models_serde.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/models_serde.go @@ -13,18 +13,21 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" - "time" ) -// MarshalJSON implements the json.Marshaller interface for type AzureBackupGoalFeatureSupportRequest. -func (a AzureBackupGoalFeatureSupportRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AADProperties. +func (a AADProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["featureType"] = "AzureBackupGoals" + populate(objectMap, "audience", a.Audience) + populate(objectMap, "authority", a.Authority) + populate(objectMap, "servicePrincipalClientId", a.ServicePrincipalClientID) + populate(objectMap, "servicePrincipalObjectId", a.ServicePrincipalObjectID) + populate(objectMap, "tenantId", a.TenantID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupGoalFeatureSupportRequest. -func (a *AzureBackupGoalFeatureSupportRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AADProperties. +func (a *AADProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -32,248 +35,20 @@ func (a *AzureBackupGoalFeatureSupportRequest) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "featureType": - err = unpopulate(val, "FeatureType", &a.FeatureType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupServerContainer. -func (a AzureBackupServerContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "canReRegister", a.CanReRegister) - populate(objectMap, "containerId", a.ContainerID) - objectMap["containerType"] = ProtectableContainerTypeAzureBackupServerContainer - populate(objectMap, "dpmAgentVersion", a.DpmAgentVersion) - populate(objectMap, "dpmServers", a.DpmServers) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "protectedItemCount", a.ProtectedItemCount) - populate(objectMap, "protectionStatus", a.ProtectionStatus) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - populate(objectMap, "upgradeAvailable", a.UpgradeAvailable) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupServerContainer. -func (a *AzureBackupServerContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "canReRegister": - err = unpopulate(val, "CanReRegister", &a.CanReRegister) - delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &a.ContainerID) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) - delete(rawMsg, key) - case "dpmAgentVersion": - err = unpopulate(val, "DpmAgentVersion", &a.DpmAgentVersion) - delete(rawMsg, key) - case "dpmServers": - err = unpopulate(val, "DpmServers", &a.DpmServers) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) - delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) - delete(rawMsg, key) - case "protectedItemCount": - err = unpopulate(val, "ProtectedItemCount", &a.ProtectedItemCount) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) - delete(rawMsg, key) - case "upgradeAvailable": - err = unpopulate(val, "UpgradeAvailable", &a.UpgradeAvailable) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupServerEngine. -func (a AzureBackupServerEngine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureBackupAgentVersion", a.AzureBackupAgentVersion) - populate(objectMap, "backupEngineId", a.BackupEngineID) - populate(objectMap, "backupEngineState", a.BackupEngineState) - objectMap["backupEngineType"] = BackupEngineTypeAzureBackupServerEngine - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "canReRegister", a.CanReRegister) - populate(objectMap, "dpmVersion", a.DpmVersion) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "isAzureBackupAgentUpgradeAvailable", a.IsAzureBackupAgentUpgradeAvailable) - populate(objectMap, "isDpmUpgradeAvailable", a.IsDpmUpgradeAvailable) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupServerEngine. -func (a *AzureBackupServerEngine) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureBackupAgentVersion": - err = unpopulate(val, "AzureBackupAgentVersion", &a.AzureBackupAgentVersion) - delete(rawMsg, key) - case "backupEngineId": - err = unpopulate(val, "BackupEngineID", &a.BackupEngineID) - delete(rawMsg, key) - case "backupEngineState": - err = unpopulate(val, "BackupEngineState", &a.BackupEngineState) - delete(rawMsg, key) - case "backupEngineType": - err = unpopulate(val, "BackupEngineType", &a.BackupEngineType) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "canReRegister": - err = unpopulate(val, "CanReRegister", &a.CanReRegister) - delete(rawMsg, key) - case "dpmVersion": - err = unpopulate(val, "DpmVersion", &a.DpmVersion) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) - delete(rawMsg, key) - case "isAzureBackupAgentUpgradeAvailable": - err = unpopulate(val, "IsAzureBackupAgentUpgradeAvailable", &a.IsAzureBackupAgentUpgradeAvailable) - delete(rawMsg, key) - case "isDpmUpgradeAvailable": - err = unpopulate(val, "IsDpmUpgradeAvailable", &a.IsDpmUpgradeAvailable) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureFileShareBackupRequest. -func (a AzureFileShareBackupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureFileShareBackupRequest" - populateDateTimeRFC3339(objectMap, "recoveryPointExpiryTimeInUTC", a.RecoveryPointExpiryTimeInUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileShareBackupRequest. -func (a *AzureFileShareBackupRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointExpiryTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointExpiryTimeInUTC", &a.RecoveryPointExpiryTimeInUTC) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureFileShareProtectableItem. -func (a AzureFileShareProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureFileShareType", a.AzureFileShareType) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "parentContainerFabricId", a.ParentContainerFabricID) - populate(objectMap, "parentContainerFriendlyName", a.ParentContainerFriendlyName) - objectMap["protectableItemType"] = "AzureFileShare" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileShareProtectableItem. -func (a *AzureFileShareProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureFileShareType": - err = unpopulate(val, "AzureFileShareType", &a.AzureFileShareType) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "parentContainerFabricId": - err = unpopulate(val, "ParentContainerFabricID", &a.ParentContainerFabricID) + case "audience": + err = unpopulate(val, "Audience", &a.Audience) delete(rawMsg, key) - case "parentContainerFriendlyName": - err = unpopulate(val, "ParentContainerFriendlyName", &a.ParentContainerFriendlyName) + case "authority": + err = unpopulate(val, "Authority", &a.Authority) delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) + case "servicePrincipalClientId": + err = unpopulate(val, "ServicePrincipalClientID", &a.ServicePrincipalClientID) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) + case "servicePrincipalObjectId": + err = unpopulate(val, "ServicePrincipalObjectID", &a.ServicePrincipalObjectID) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) delete(rawMsg, key) } if err != nil { @@ -283,22 +58,21 @@ func (a *AzureFileShareProtectableItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureFileShareProtectionPolicy. -func (a AzureFileShareProtectionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AADPropertiesResource. +func (a AADPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["backupManagementType"] = "AzureStorage" - populate(objectMap, "protectedItemsCount", a.ProtectedItemsCount) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "retentionPolicy", a.RetentionPolicy) - populate(objectMap, "schedulePolicy", a.SchedulePolicy) - populate(objectMap, "timeZone", a.TimeZone) - populate(objectMap, "vaultRetentionPolicy", a.VaultRetentionPolicy) - populate(objectMap, "workLoadType", a.WorkLoadType) + populate(objectMap, "eTag", a.ETag) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileShareProtectionPolicy. -func (a *AzureFileShareProtectionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AADPropertiesResource. +func (a *AADPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -306,64 +80,26 @@ func (a *AzureFileShareProtectionPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &a.ProtectedItemsCount) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "retentionPolicy": - a.RetentionPolicy, err = unmarshalRetentionPolicyClassification(val) - delete(rawMsg, key) - case "schedulePolicy": - a.SchedulePolicy, err = unmarshalSchedulePolicyClassification(val) + case "eTag": + err = unpopulate(val, "ETag", &a.ETag) delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &a.TimeZone) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "vaultRetentionPolicy": - err = unpopulate(val, "VaultRetentionPolicy", &a.VaultRetentionPolicy) + case "location": + err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) - case "workLoadType": - err = unpopulate(val, "WorkLoadType", &a.WorkLoadType) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureFileShareProvisionILRRequest. -func (a AzureFileShareProvisionILRRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureFileShareProvisionILRRequest" - populate(objectMap, "recoveryPointId", a.RecoveryPointID) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileShareProvisionILRRequest. -func (a *AzureFileShareProvisionILRRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -376,6 +112,7 @@ func (a *AzureFileShareProvisionILRRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureFileShareRecoveryPoint. func (a AzureFileShareRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "crossRegionRestoreState", a.CrossRegionRestoreState) populate(objectMap, "fileShareSnapshotUri", a.FileShareSnapshotURI) objectMap["objectType"] = "AzureFileShareRecoveryPoint" populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) @@ -394,6 +131,9 @@ func (a *AzureFileShareRecoveryPoint) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "crossRegionRestoreState": + err = unpopulate(val, "CrossRegionRestoreState", &a.CrossRegionRestoreState) + delete(rawMsg, key) case "fileShareSnapshotUri": err = unpopulate(val, "FileShareSnapshotURI", &a.FileShareSnapshotURI) delete(rawMsg, key) @@ -426,7 +166,6 @@ func (a AzureFileShareRestoreRequest) MarshalJSON() ([]byte, error) { populate(objectMap, "copyOptions", a.CopyOptions) objectMap["objectType"] = "AzureFileShareRestoreRequest" populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) populate(objectMap, "restoreFileSpecs", a.RestoreFileSpecs) populate(objectMap, "restoreRequestType", a.RestoreRequestType) populate(objectMap, "sourceResourceId", a.SourceResourceID) @@ -452,9 +191,6 @@ func (a *AzureFileShareRestoreRequest) UnmarshalJSON(data []byte) error { case "recoveryType": err = unpopulate(val, "RecoveryType", &a.RecoveryType) delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) case "restoreFileSpecs": err = unpopulate(val, "RestoreFileSpecs", &a.RestoreFileSpecs) delete(rawMsg, key) @@ -486,7 +222,7 @@ func (a AzureFileshareProtectedItem) MarshalJSON() ([]byte, error) { populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) populate(objectMap, "extendedInfo", a.ExtendedInfo) populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) + populate(objectMap, "healthStatus", a.HealthStatus) populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) populate(objectMap, "isRehydrate", a.IsRehydrate) populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) @@ -495,14 +231,11 @@ func (a AzureFileshareProtectedItem) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) objectMap["protectedItemType"] = "AzureFileShareProtectedItem" populate(objectMap, "protectionState", a.ProtectionState) populate(objectMap, "protectionStatus", a.ProtectionStatus) populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } @@ -540,8 +273,8 @@ func (a *AzureFileshareProtectedItem) UnmarshalJSON(data []byte) error { case "friendlyName": err = unpopulate(val, "FriendlyName", &a.FriendlyName) delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) + case "healthStatus": + err = unpopulate(val, "HealthStatus", &a.HealthStatus) delete(rawMsg, key) case "isDeferredDeleteScheduleUpcoming": err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) @@ -567,9 +300,6 @@ func (a *AzureFileshareProtectedItem) UnmarshalJSON(data []byte) error { case "policyId": err = unpopulate(val, "PolicyID", &a.PolicyID) delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) case "protectedItemType": err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) delete(rawMsg, key) @@ -582,15 +312,9 @@ func (a *AzureFileshareProtectedItem) UnmarshalJSON(data []byte) error { case "resourceGuardOperationRequests": err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) case "sourceResourceId": err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) case "workloadType": err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) @@ -645,23 +369,41 @@ func (a *AzureFileshareProtectedItemExtendedInfo) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSClassicComputeVMContainer. -func (a AzureIaaSClassicComputeVMContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureIaaSClassicComputeVMProtectedItem. +func (a AzureIaaSClassicComputeVMProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "backupManagementType", a.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeMicrosoftClassicComputeVirtualMachines + populate(objectMap, "backupSetName", a.BackupSetName) + populate(objectMap, "containerName", a.ContainerName) + populate(objectMap, "createMode", a.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) + populate(objectMap, "extendedInfo", a.ExtendedInfo) + populate(objectMap, "extendedProperties", a.ExtendedProperties) populate(objectMap, "friendlyName", a.FriendlyName) + populate(objectMap, "healthDetails", a.HealthDetails) populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - populate(objectMap, "resourceGroup", a.ResourceGroup) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", a.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) + populate(objectMap, "kpisHealths", a.KpisHealths) + populate(objectMap, "lastBackupStatus", a.LastBackupStatus) + populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) + populate(objectMap, "policyId", a.PolicyID) + populate(objectMap, "protectedItemDataId", a.ProtectedItemDataID) + objectMap["protectedItemType"] = "Microsoft.ClassicCompute/virtualMachines" + populate(objectMap, "protectionState", a.ProtectionState) + populate(objectMap, "protectionStatus", a.ProtectionStatus) + populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) + populate(objectMap, "sourceResourceId", a.SourceResourceID) populate(objectMap, "virtualMachineId", a.VirtualMachineID) - populate(objectMap, "virtualMachineVersion", a.VirtualMachineVersion) + populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSClassicComputeVMContainer. -func (a *AzureIaaSClassicComputeVMContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSClassicComputeVMProtectedItem. +func (a *AzureIaaSClassicComputeVMProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -672,159 +414,23 @@ func (a *AzureIaaSClassicComputeVMContainer) UnmarshalJSON(data []byte) error { case "backupManagementType": err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &a.BackupSetName) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) + case "containerName": + err = unpopulate(val, "ContainerName", &a.ContainerName) delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) + case "createMode": + err = unpopulate(val, "CreateMode", &a.CreateMode) delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &a.ResourceGroup) - delete(rawMsg, key) - case "virtualMachineId": - err = unpopulate(val, "VirtualMachineID", &a.VirtualMachineID) - delete(rawMsg, key) - case "virtualMachineVersion": - err = unpopulate(val, "VirtualMachineVersion", &a.VirtualMachineVersion) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSClassicComputeVMProtectableItem. -func (a AzureIaaSClassicComputeVMProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - objectMap["protectableItemType"] = "Microsoft.ClassicCompute/virtualMachines" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "resourceGroup", a.ResourceGroup) - populate(objectMap, "virtualMachineId", a.VirtualMachineID) - populate(objectMap, "virtualMachineVersion", a.VirtualMachineVersion) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSClassicComputeVMProtectableItem. -func (a *AzureIaaSClassicComputeVMProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &a.ResourceGroup) - delete(rawMsg, key) - case "virtualMachineId": - err = unpopulate(val, "VirtualMachineID", &a.VirtualMachineID) - delete(rawMsg, key) - case "virtualMachineVersion": - err = unpopulate(val, "VirtualMachineVersion", &a.VirtualMachineVersion) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSClassicComputeVMProtectedItem. -func (a AzureIaaSClassicComputeVMProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "backupSetName", a.BackupSetName) - populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "createMode", a.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "extendedProperties", a.ExtendedProperties) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthDetails", a.HealthDetails) - populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", a.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) - populate(objectMap, "kpisHealths", a.KpisHealths) - populate(objectMap, "lastBackupStatus", a.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "protectedItemDataId", a.ProtectedItemDataID) - objectMap["protectedItemType"] = "Microsoft.ClassicCompute/virtualMachines" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "protectionStatus", a.ProtectionStatus) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) - populate(objectMap, "virtualMachineId", a.VirtualMachineID) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSClassicComputeVMProtectedItem. -func (a *AzureIaaSClassicComputeVMProtectedItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &a.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &a.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) delete(rawMsg, key) case "extendedProperties": err = unpopulate(val, "ExtendedProperties", &a.ExtendedProperties) @@ -838,9 +444,6 @@ func (a *AzureIaaSClassicComputeVMProtectedItem) UnmarshalJSON(data []byte) erro case "healthStatus": err = unpopulate(val, "HealthStatus", &a.HealthStatus) delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) case "isDeferredDeleteScheduleUpcoming": err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) delete(rawMsg, key) @@ -865,9 +468,6 @@ func (a *AzureIaaSClassicComputeVMProtectedItem) UnmarshalJSON(data []byte) erro case "policyId": err = unpopulate(val, "PolicyID", &a.PolicyID) delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) case "protectedItemDataId": err = unpopulate(val, "ProtectedItemDataID", &a.ProtectedItemDataID) delete(rawMsg, key) @@ -883,132 +483,12 @@ func (a *AzureIaaSClassicComputeVMProtectedItem) UnmarshalJSON(data []byte) erro case "resourceGuardOperationRequests": err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) case "sourceResourceId": err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) - case "virtualMachineId": - err = unpopulate(val, "VirtualMachineID", &a.VirtualMachineID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSComputeVMContainer. -func (a AzureIaaSComputeVMContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeMicrosoftComputeVirtualMachines - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - populate(objectMap, "resourceGroup", a.ResourceGroup) - populate(objectMap, "virtualMachineId", a.VirtualMachineID) - populate(objectMap, "virtualMachineVersion", a.VirtualMachineVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSComputeVMContainer. -func (a *AzureIaaSComputeVMContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) - delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) - delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &a.ResourceGroup) - delete(rawMsg, key) - case "virtualMachineId": - err = unpopulate(val, "VirtualMachineID", &a.VirtualMachineID) - delete(rawMsg, key) - case "virtualMachineVersion": - err = unpopulate(val, "VirtualMachineVersion", &a.VirtualMachineVersion) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSComputeVMProtectableItem. -func (a AzureIaaSComputeVMProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - objectMap["protectableItemType"] = "Microsoft.Compute/virtualMachines" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "resourceGroup", a.ResourceGroup) - populate(objectMap, "virtualMachineId", a.VirtualMachineID) - populate(objectMap, "virtualMachineVersion", a.VirtualMachineVersion) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSComputeVMProtectableItem. -func (a *AzureIaaSComputeVMProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &a.ResourceGroup) - delete(rawMsg, key) case "virtualMachineId": err = unpopulate(val, "VirtualMachineID", &a.VirtualMachineID) delete(rawMsg, key) - case "virtualMachineVersion": - err = unpopulate(val, "VirtualMachineVersion", &a.VirtualMachineVersion) - delete(rawMsg, key) case "workloadType": err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) @@ -1034,7 +514,6 @@ func (a AzureIaaSComputeVMProtectedItem) MarshalJSON() ([]byte, error) { populate(objectMap, "friendlyName", a.FriendlyName) populate(objectMap, "healthDetails", a.HealthDetails) populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) populate(objectMap, "isRehydrate", a.IsRehydrate) populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) @@ -1043,15 +522,12 @@ func (a AzureIaaSComputeVMProtectedItem) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) populate(objectMap, "protectedItemDataId", a.ProtectedItemDataID) objectMap["protectedItemType"] = "Microsoft.Compute/virtualMachines" populate(objectMap, "protectionState", a.ProtectionState) populate(objectMap, "protectionStatus", a.ProtectionStatus) populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) populate(objectMap, "virtualMachineId", a.VirtualMachineID) populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) @@ -1099,9 +575,6 @@ func (a *AzureIaaSComputeVMProtectedItem) UnmarshalJSON(data []byte) error { case "healthStatus": err = unpopulate(val, "HealthStatus", &a.HealthStatus) delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) case "isDeferredDeleteScheduleUpcoming": err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) delete(rawMsg, key) @@ -1126,9 +599,6 @@ func (a *AzureIaaSComputeVMProtectedItem) UnmarshalJSON(data []byte) error { case "policyId": err = unpopulate(val, "PolicyID", &a.PolicyID) delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) case "protectedItemDataId": err = unpopulate(val, "ProtectedItemDataID", &a.ProtectedItemDataID) delete(rawMsg, key) @@ -1144,15 +614,9 @@ func (a *AzureIaaSComputeVMProtectedItem) UnmarshalJSON(data []byte) error { case "resourceGuardOperationRequests": err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) case "sourceResourceId": err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) case "virtualMachineId": err = unpopulate(val, "VirtualMachineID", &a.VirtualMachineID) delete(rawMsg, key) @@ -1251,13 +715,11 @@ func (a AzureIaaSVMJob) MarshalJSON() ([]byte, error) { populate(objectMap, "actionsInfo", a.ActionsInfo) populate(objectMap, "activityId", a.ActivityID) populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "containerName", a.ContainerName) populate(objectMap, "duration", a.Duration) populateDateTimeRFC3339(objectMap, "endTime", a.EndTime) populate(objectMap, "entityFriendlyName", a.EntityFriendlyName) populate(objectMap, "errorDetails", a.ErrorDetails) populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "isUserTriggered", a.IsUserTriggered) objectMap["jobType"] = "AzureIaaSVMJob" populate(objectMap, "operation", a.Operation) populateDateTimeRFC3339(objectMap, "startTime", a.StartTime) @@ -1284,9 +746,6 @@ func (a *AzureIaaSVMJob) UnmarshalJSON(data []byte) error { case "backupManagementType": err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) case "duration": err = unpopulate(val, "Duration", &a.Duration) delete(rawMsg, key) @@ -1302,9 +761,6 @@ func (a *AzureIaaSVMJob) UnmarshalJSON(data []byte) error { case "extendedInfo": err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) delete(rawMsg, key) - case "isUserTriggered": - err = unpopulate(val, "IsUserTriggered", &a.IsUserTriggered) - delete(rawMsg, key) case "jobType": err = unpopulate(val, "JobType", &a.JobType) delete(rawMsg, key) @@ -1430,100 +886,20 @@ func (a *AzureIaaSVMJobTaskDetails) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSVMJobV2. -func (a AzureIaaSVMJobV2) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureIaaSVMProtectedItem. +func (a AzureIaaSVMProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsInfo", a.ActionsInfo) - populate(objectMap, "activityId", a.ActivityID) populate(objectMap, "backupManagementType", a.BackupManagementType) + populate(objectMap, "backupSetName", a.BackupSetName) populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "duration", a.Duration) - populateDateTimeRFC3339(objectMap, "endTime", a.EndTime) - populate(objectMap, "entityFriendlyName", a.EntityFriendlyName) - populate(objectMap, "errorDetails", a.ErrorDetails) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - objectMap["jobType"] = "AzureIaaSVMJobV2" - populate(objectMap, "operation", a.Operation) - populateDateTimeRFC3339(objectMap, "startTime", a.StartTime) - populate(objectMap, "status", a.Status) - populate(objectMap, "virtualMachineVersion", a.VirtualMachineVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSVMJobV2. -func (a *AzureIaaSVMJobV2) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsInfo": - err = unpopulate(val, "ActionsInfo", &a.ActionsInfo) - delete(rawMsg, key) - case "activityId": - err = unpopulate(val, "ActivityID", &a.ActivityID) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) - case "duration": - err = unpopulate(val, "Duration", &a.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &a.EndTime) - delete(rawMsg, key) - case "entityFriendlyName": - err = unpopulate(val, "EntityFriendlyName", &a.EntityFriendlyName) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "jobType": - err = unpopulate(val, "JobType", &a.JobType) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &a.Operation) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &a.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - case "virtualMachineVersion": - err = unpopulate(val, "VirtualMachineVersion", &a.VirtualMachineVersion) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSVMProtectedItem. -func (a AzureIaaSVMProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "backupSetName", a.BackupSetName) - populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "createMode", a.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) + populate(objectMap, "createMode", a.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) populate(objectMap, "extendedInfo", a.ExtendedInfo) populate(objectMap, "extendedProperties", a.ExtendedProperties) populate(objectMap, "friendlyName", a.FriendlyName) populate(objectMap, "healthDetails", a.HealthDetails) populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) populate(objectMap, "isRehydrate", a.IsRehydrate) populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) @@ -1532,15 +908,12 @@ func (a AzureIaaSVMProtectedItem) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) populate(objectMap, "protectedItemDataId", a.ProtectedItemDataID) objectMap["protectedItemType"] = "AzureIaaSVMProtectedItem" populate(objectMap, "protectionState", a.ProtectionState) populate(objectMap, "protectionStatus", a.ProtectionStatus) populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) populate(objectMap, "virtualMachineId", a.VirtualMachineID) populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) @@ -1588,9 +961,6 @@ func (a *AzureIaaSVMProtectedItem) UnmarshalJSON(data []byte) error { case "healthStatus": err = unpopulate(val, "HealthStatus", &a.HealthStatus) delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) case "isDeferredDeleteScheduleUpcoming": err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) delete(rawMsg, key) @@ -1615,9 +985,6 @@ func (a *AzureIaaSVMProtectedItem) UnmarshalJSON(data []byte) error { case "policyId": err = unpopulate(val, "PolicyID", &a.PolicyID) delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) case "protectedItemDataId": err = unpopulate(val, "ProtectedItemDataID", &a.ProtectedItemDataID) delete(rawMsg, key) @@ -1633,15 +1000,9 @@ func (a *AzureIaaSVMProtectedItem) UnmarshalJSON(data []byte) error { case "resourceGuardOperationRequests": err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) case "sourceResourceId": err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) case "virtualMachineId": err = unpopulate(val, "VirtualMachineID", &a.VirtualMachineID) delete(rawMsg, key) @@ -1659,10 +1020,7 @@ func (a *AzureIaaSVMProtectedItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureIaaSVMProtectedItemExtendedInfo. func (a AzureIaaSVMProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "newestRecoveryPointInArchive", a.NewestRecoveryPointInArchive) populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", a.OldestRecoveryPoint) - populateDateTimeRFC3339(objectMap, "oldestRecoveryPointInArchive", a.OldestRecoveryPointInArchive) - populateDateTimeRFC3339(objectMap, "oldestRecoveryPointInVault", a.OldestRecoveryPointInVault) populate(objectMap, "policyInconsistent", a.PolicyInconsistent) populate(objectMap, "recoveryPointCount", a.RecoveryPointCount) return json.Marshal(objectMap) @@ -1677,18 +1035,9 @@ func (a *AzureIaaSVMProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "newestRecoveryPointInArchive": - err = unpopulateDateTimeRFC3339(val, "NewestRecoveryPointInArchive", &a.NewestRecoveryPointInArchive) - delete(rawMsg, key) case "oldestRecoveryPoint": err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPoint", &a.OldestRecoveryPoint) delete(rawMsg, key) - case "oldestRecoveryPointInArchive": - err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPointInArchive", &a.OldestRecoveryPointInArchive) - delete(rawMsg, key) - case "oldestRecoveryPointInVault": - err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPointInVault", &a.OldestRecoveryPointInVault) - delete(rawMsg, key) case "policyInconsistent": err = unpopulate(val, "PolicyInconsistent", &a.PolicyInconsistent) delete(rawMsg, key) @@ -1703,25 +1052,32 @@ func (a *AzureIaaSVMProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureIaaSVMProtectionPolicy. -func (a AzureIaaSVMProtectionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureSQLProtectedItem. +func (a AzureSQLProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["backupManagementType"] = "AzureIaasVM" - populate(objectMap, "instantRPDetails", a.InstantRPDetails) - populate(objectMap, "instantRpRetentionRangeInDays", a.InstantRpRetentionRangeInDays) - populate(objectMap, "policyType", a.PolicyType) - populate(objectMap, "protectedItemsCount", a.ProtectedItemsCount) + populate(objectMap, "backupManagementType", a.BackupManagementType) + populate(objectMap, "backupSetName", a.BackupSetName) + populate(objectMap, "containerName", a.ContainerName) + populate(objectMap, "createMode", a.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) + populate(objectMap, "extendedInfo", a.ExtendedInfo) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", a.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) + populate(objectMap, "policyId", a.PolicyID) + populate(objectMap, "protectedItemDataId", a.ProtectedItemDataID) + objectMap["protectedItemType"] = "Microsoft.Sql/servers/databases" + populate(objectMap, "protectionState", a.ProtectionState) populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "retentionPolicy", a.RetentionPolicy) - populate(objectMap, "schedulePolicy", a.SchedulePolicy) - populate(objectMap, "snapshotConsistencyType", a.SnapshotConsistencyType) - populate(objectMap, "tieringPolicy", a.TieringPolicy) - populate(objectMap, "timeZone", a.TimeZone) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureIaaSVMProtectionPolicy. -func (a *AzureIaaSVMProtectionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLProtectedItem. +func (a *AzureSQLProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1732,35 +1088,56 @@ func (a *AzureIaaSVMProtectionPolicy) UnmarshalJSON(data []byte) error { case "backupManagementType": err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) delete(rawMsg, key) - case "instantRPDetails": - err = unpopulate(val, "InstantRPDetails", &a.InstantRPDetails) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &a.BackupSetName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &a.ContainerName) delete(rawMsg, key) - case "instantRpRetentionRangeInDays": - err = unpopulate(val, "InstantRpRetentionRangeInDays", &a.InstantRpRetentionRangeInDays) + case "createMode": + err = unpopulate(val, "CreateMode", &a.CreateMode) delete(rawMsg, key) - case "policyType": - err = unpopulate(val, "PolicyType", &a.PolicyType) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &a.ProtectedItemsCount) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) + delete(rawMsg, key) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &a.PolicyID) + delete(rawMsg, key) + case "protectedItemDataId": + err = unpopulate(val, "ProtectedItemDataID", &a.ProtectedItemDataID) delete(rawMsg, key) - case "retentionPolicy": - a.RetentionPolicy, err = unmarshalRetentionPolicyClassification(val) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) delete(rawMsg, key) - case "schedulePolicy": - a.SchedulePolicy, err = unmarshalSchedulePolicyClassification(val) + case "protectionState": + err = unpopulate(val, "ProtectionState", &a.ProtectionState) delete(rawMsg, key) - case "snapshotConsistencyType": - err = unpopulate(val, "SnapshotConsistencyType", &a.SnapshotConsistencyType) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "tieringPolicy": - err = unpopulate(val, "TieringPolicy", &a.TieringPolicy) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &a.TimeZone) + case "workloadType": + err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) } if err != nil { @@ -1770,20 +1147,17 @@ func (a *AzureIaaSVMProtectionPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureRecoveryServiceVaultProtectionIntent. -func (a AzureRecoveryServiceVaultProtectionIntent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureSQLProtectedItemExtendedInfo. +func (a AzureSQLProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "itemId", a.ItemID) - populate(objectMap, "policyId", a.PolicyID) - objectMap["protectionIntentItemType"] = ProtectionIntentItemTypeRecoveryServiceVaultItem - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "sourceResourceId", a.SourceResourceID) + populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", a.OldestRecoveryPoint) + populate(objectMap, "policyState", a.PolicyState) + populate(objectMap, "recoveryPointCount", a.RecoveryPointCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureRecoveryServiceVaultProtectionIntent. -func (a *AzureRecoveryServiceVaultProtectionIntent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLProtectedItemExtendedInfo. +func (a *AzureSQLProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1791,23 +1165,14 @@ func (a *AzureRecoveryServiceVaultProtectionIntent) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "itemId": - err = unpopulate(val, "ItemID", &a.ItemID) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "protectionIntentItemType": - err = unpopulate(val, "ProtectionIntentItemType", &a.ProtectionIntentItemType) + case "oldestRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPoint", &a.OldestRecoveryPoint) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) + case "policyState": + err = unpopulate(val, "PolicyState", &a.PolicyState) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + case "recoveryPointCount": + err = unpopulate(val, "RecoveryPointCount", &a.RecoveryPointCount) delete(rawMsg, key) } if err != nil { @@ -1817,21 +1182,17 @@ func (a *AzureRecoveryServiceVaultProtectionIntent) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureResourceProtectionIntent. -func (a AzureResourceProtectionIntent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureStorageErrorInfo. +func (a AzureStorageErrorInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "itemId", a.ItemID) - populate(objectMap, "policyId", a.PolicyID) - objectMap["protectionIntentItemType"] = ProtectionIntentItemTypeAzureResourceItem - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "errorCode", a.ErrorCode) + populate(objectMap, "errorString", a.ErrorString) + populate(objectMap, "recommendations", a.Recommendations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceProtectionIntent. -func (a *AzureResourceProtectionIntent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageErrorInfo. +func (a *AzureStorageErrorInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1839,26 +1200,14 @@ func (a *AzureResourceProtectionIntent) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "itemId": - err = unpopulate(val, "ItemID", &a.ItemID) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "protectionIntentItemType": - err = unpopulate(val, "ProtectionIntentItemType", &a.ProtectionIntentItemType) + case "errorCode": + err = unpopulate(val, "ErrorCode", &a.ErrorCode) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) + case "errorString": + err = unpopulate(val, "ErrorString", &a.ErrorString) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + case "recommendations": + err = unpopulate(val, "Recommendations", &a.Recommendations) delete(rawMsg, key) } if err != nil { @@ -1868,25 +1217,28 @@ func (a *AzureResourceProtectionIntent) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureSQLAGWorkloadContainerProtectionContainer. -func (a AzureSQLAGWorkloadContainerProtectionContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureStorageJob. +func (a AzureStorageJob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actionsInfo", a.ActionsInfo) + populate(objectMap, "activityId", a.ActivityID) populate(objectMap, "backupManagementType", a.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeSQLAGWorkLoadContainer + populate(objectMap, "duration", a.Duration) + populateDateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "entityFriendlyName", a.EntityFriendlyName) + populate(objectMap, "errorDetails", a.ErrorDetails) populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) - populate(objectMap, "operationType", a.OperationType) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "workloadType", a.WorkloadType) + objectMap["jobType"] = "AzureStorageJob" + populate(objectMap, "operation", a.Operation) + populateDateTimeRFC3339(objectMap, "startTime", a.StartTime) + populate(objectMap, "status", a.Status) + populate(objectMap, "storageAccountName", a.StorageAccountName) + populate(objectMap, "storageAccountVersion", a.StorageAccountVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLAGWorkloadContainerProtectionContainer. -func (a *AzureSQLAGWorkloadContainerProtectionContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageJob. +func (a *AzureStorageJob) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1894,38 +1246,47 @@ func (a *AzureSQLAGWorkloadContainerProtectionContainer) UnmarshalJSON(data []by for key, val := range rawMsg { var err error switch key { + case "actionsInfo": + err = unpopulate(val, "ActionsInfo", &a.ActionsInfo) + delete(rawMsg, key) + case "activityId": + err = unpopulate(val, "ActivityID", &a.ActivityID) + delete(rawMsg, key) case "backupManagementType": err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) + case "duration": + err = unpopulate(val, "Duration", &a.Duration) delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &a.EndTime) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) + case "entityFriendlyName": + err = unpopulate(val, "EntityFriendlyName", &a.EntityFriendlyName) delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) delete(rawMsg, key) - case "operationType": - err = unpopulate(val, "OperationType", &a.OperationType) + case "jobType": + err = unpopulate(val, "JobType", &a.JobType) delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) + case "operation": + err = unpopulate(val, "Operation", &a.Operation) delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &a.StartTime) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "storageAccountName": + err = unpopulate(val, "StorageAccountName", &a.StorageAccountName) + delete(rawMsg, key) + case "storageAccountVersion": + err = unpopulate(val, "StorageAccountVersion", &a.StorageAccountVersion) delete(rawMsg, key) } if err != nil { @@ -1935,20 +1296,17 @@ func (a *AzureSQLAGWorkloadContainerProtectionContainer) UnmarshalJSON(data []by return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureSQLContainer. -func (a AzureSQLContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureStorageJobExtendedInfo. +func (a AzureStorageJobExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeAzureSQLContainer - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "registrationStatus", a.RegistrationStatus) + populate(objectMap, "dynamicErrorMessage", a.DynamicErrorMessage) + populate(objectMap, "propertyBag", a.PropertyBag) + populate(objectMap, "tasksList", a.TasksList) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLContainer. -func (a *AzureSQLContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageJobExtendedInfo. +func (a *AzureStorageJobExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -1956,23 +1314,45 @@ func (a *AzureSQLContainer) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) + case "dynamicErrorMessage": + err = unpopulate(val, "DynamicErrorMessage", &a.DynamicErrorMessage) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &a.PropertyBag) delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) + case "tasksList": + err = unpopulate(val, "TasksList", &a.TasksList) delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureStorageJobTaskDetails. +func (a AzureStorageJobTaskDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", a.Status) + populate(objectMap, "taskId", a.TaskID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageJobTaskDetails. +func (a *AzureStorageJobTaskDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) + case "taskId": + err = unpopulate(val, "TaskID", &a.TaskID) delete(rawMsg, key) } if err != nil { @@ -1982,8 +1362,8 @@ func (a *AzureSQLContainer) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureSQLProtectedItem. -func (a AzureSQLProtectedItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadProtectedItem. +func (a AzureVMWorkloadProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "backupManagementType", a.BackupManagementType) populate(objectMap, "backupSetName", a.BackupSetName) @@ -1992,26 +1372,32 @@ func (a AzureSQLProtectedItem) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) + populate(objectMap, "friendlyName", a.FriendlyName) populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) populate(objectMap, "isRehydrate", a.IsRehydrate) populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) + populate(objectMap, "kpisHealths", a.KpisHealths) + populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) + populate(objectMap, "lastBackupStatus", a.LastBackupStatus) + populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) + populate(objectMap, "parentName", a.ParentName) + populate(objectMap, "parentType", a.ParentType) populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "protectedItemDataId", a.ProtectedItemDataID) - objectMap["protectedItemType"] = "Microsoft.Sql/servers/databases" + populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) + populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) + objectMap["protectedItemType"] = "AzureVmWorkloadProtectedItem" populate(objectMap, "protectionState", a.ProtectionState) + populate(objectMap, "protectionStatus", a.ProtectionStatus) populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) + populate(objectMap, "serverName", a.ServerName) populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLProtectedItem. -func (a *AzureSQLProtectedItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadProtectedItem. +func (a *AzureVMWorkloadProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2040,8 +1426,8 @@ func (a *AzureSQLProtectedItem) UnmarshalJSON(data []byte) error { case "extendedInfo": err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &a.FriendlyName) delete(rawMsg, key) case "isDeferredDeleteScheduleUpcoming": err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) @@ -2052,17 +1438,35 @@ func (a *AzureSQLProtectedItem) UnmarshalJSON(data []byte) error { case "isScheduledForDeferredDelete": err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) delete(rawMsg, key) + case "kpisHealths": + err = unpopulate(val, "KpisHealths", &a.KpisHealths) + delete(rawMsg, key) + case "lastBackupErrorDetail": + err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) + delete(rawMsg, key) + case "lastBackupStatus": + err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) + delete(rawMsg, key) + case "lastBackupTime": + err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) + delete(rawMsg, key) case "lastRecoveryPoint": err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) delete(rawMsg, key) + case "parentName": + err = unpopulate(val, "ParentName", &a.ParentName) + delete(rawMsg, key) + case "parentType": + err = unpopulate(val, "ParentType", &a.ParentType) + delete(rawMsg, key) case "policyId": err = unpopulate(val, "PolicyID", &a.PolicyID) delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) + case "protectedItemDataSourceId": + err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) delete(rawMsg, key) - case "protectedItemDataId": - err = unpopulate(val, "ProtectedItemDataID", &a.ProtectedItemDataID) + case "protectedItemHealthStatus": + err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) delete(rawMsg, key) case "protectedItemType": err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) @@ -2070,18 +1474,18 @@ func (a *AzureSQLProtectedItem) UnmarshalJSON(data []byte) error { case "protectionState": err = unpopulate(val, "ProtectionState", &a.ProtectionState) delete(rawMsg, key) + case "protectionStatus": + err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) + delete(rawMsg, key) case "resourceGuardOperationRequests": err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) + case "serverName": + err = unpopulate(val, "ServerName", &a.ServerName) delete(rawMsg, key) case "sourceResourceId": err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) case "workloadType": err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) @@ -2093,8 +1497,8 @@ func (a *AzureSQLProtectedItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureSQLProtectedItemExtendedInfo. -func (a AzureSQLProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadProtectedItemExtendedInfo. +func (a AzureVMWorkloadProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", a.OldestRecoveryPoint) populate(objectMap, "policyState", a.PolicyState) @@ -2102,8 +1506,8 @@ func (a AzureSQLProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLProtectedItemExtendedInfo. -func (a *AzureSQLProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadProtectedItemExtendedInfo. +func (a *AzureVMWorkloadProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2128,18 +1532,42 @@ func (a *AzureSQLProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureSQLProtectionPolicy. -func (a AzureSQLProtectionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. +func (a AzureVMWorkloadSAPAseDatabaseProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["backupManagementType"] = "AzureSql" - populate(objectMap, "protectedItemsCount", a.ProtectedItemsCount) + populate(objectMap, "backupManagementType", a.BackupManagementType) + populate(objectMap, "backupSetName", a.BackupSetName) + populate(objectMap, "containerName", a.ContainerName) + populate(objectMap, "createMode", a.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) + populate(objectMap, "extendedInfo", a.ExtendedInfo) + populate(objectMap, "friendlyName", a.FriendlyName) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", a.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) + populate(objectMap, "kpisHealths", a.KpisHealths) + populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) + populate(objectMap, "lastBackupStatus", a.LastBackupStatus) + populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) + populate(objectMap, "parentName", a.ParentName) + populate(objectMap, "parentType", a.ParentType) + populate(objectMap, "policyId", a.PolicyID) + populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) + populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) + objectMap["protectedItemType"] = "AzureVmWorkloadSAPAseDatabase" + populate(objectMap, "protectionState", a.ProtectionState) + populate(objectMap, "protectionStatus", a.ProtectionStatus) populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "retentionPolicy", a.RetentionPolicy) + populate(objectMap, "serverName", a.ServerName) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLProtectionPolicy. -func (a *AzureSQLProtectionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. +func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2150,14 +1578,86 @@ func (a *AzureSQLProtectionPolicy) UnmarshalJSON(data []byte) error { case "backupManagementType": err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &a.ProtectedItemsCount) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &a.BackupSetName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &a.ContainerName) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &a.CreateMode) + delete(rawMsg, key) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &a.FriendlyName) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) + delete(rawMsg, key) + case "kpisHealths": + err = unpopulate(val, "KpisHealths", &a.KpisHealths) + delete(rawMsg, key) + case "lastBackupErrorDetail": + err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) + delete(rawMsg, key) + case "lastBackupStatus": + err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) + delete(rawMsg, key) + case "lastBackupTime": + err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) + delete(rawMsg, key) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) + delete(rawMsg, key) + case "parentName": + err = unpopulate(val, "ParentName", &a.ParentName) + delete(rawMsg, key) + case "parentType": + err = unpopulate(val, "ParentType", &a.ParentType) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &a.PolicyID) + delete(rawMsg, key) + case "protectedItemDataSourceId": + err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) + delete(rawMsg, key) + case "protectedItemHealthStatus": + err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) + delete(rawMsg, key) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) + delete(rawMsg, key) + case "protectionState": + err = unpopulate(val, "ProtectionState", &a.ProtectionState) + delete(rawMsg, key) + case "protectionStatus": + err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) delete(rawMsg, key) case "resourceGuardOperationRequests": err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "retentionPolicy": - a.RetentionPolicy, err = unmarshalRetentionPolicyClassification(val) + case "serverName": + err = unpopulate(val, "ServerName", &a.ServerName) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) } if err != nil { @@ -2167,25 +1667,42 @@ func (a *AzureSQLProtectionPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureStorageContainer. -func (a AzureStorageContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. +func (a AzureVMWorkloadSAPHanaDatabaseProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "acquireStorageAccountLock", a.AcquireStorageAccountLock) populate(objectMap, "backupManagementType", a.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeStorageContainer + populate(objectMap, "backupSetName", a.BackupSetName) + populate(objectMap, "containerName", a.ContainerName) + populate(objectMap, "createMode", a.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) + populate(objectMap, "extendedInfo", a.ExtendedInfo) populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "protectedItemCount", a.ProtectedItemCount) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - populate(objectMap, "resourceGroup", a.ResourceGroup) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", a.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) + populate(objectMap, "kpisHealths", a.KpisHealths) + populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) + populate(objectMap, "lastBackupStatus", a.LastBackupStatus) + populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) + populate(objectMap, "parentName", a.ParentName) + populate(objectMap, "parentType", a.ParentType) + populate(objectMap, "policyId", a.PolicyID) + populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) + populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) + objectMap["protectedItemType"] = "AzureVmWorkloadSAPHanaDatabase" + populate(objectMap, "protectionState", a.ProtectionState) + populate(objectMap, "protectionStatus", a.ProtectionStatus) + populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) + populate(objectMap, "serverName", a.ServerName) populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "storageAccountVersion", a.StorageAccountVersion) + populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageContainer. -func (a *AzureStorageContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. +func (a *AzureVMWorkloadSAPHanaDatabaseProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2193,38 +1710,89 @@ func (a *AzureStorageContainer) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "acquireStorageAccountLock": - err = unpopulate(val, "AcquireStorageAccountLock", &a.AcquireStorageAccountLock) - delete(rawMsg, key) case "backupManagementType": err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &a.BackupSetName) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) + case "containerName": + err = unpopulate(val, "ContainerName", &a.ContainerName) delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) + case "createMode": + err = unpopulate(val, "CreateMode", &a.CreateMode) delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &a.FriendlyName) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) + delete(rawMsg, key) + case "kpisHealths": + err = unpopulate(val, "KpisHealths", &a.KpisHealths) + delete(rawMsg, key) + case "lastBackupErrorDetail": + err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) + delete(rawMsg, key) + case "lastBackupStatus": + err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) + delete(rawMsg, key) + case "lastBackupTime": + err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) delete(rawMsg, key) - case "protectedItemCount": - err = unpopulate(val, "ProtectedItemCount", &a.ProtectedItemCount) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) + delete(rawMsg, key) + case "parentName": + err = unpopulate(val, "ParentName", &a.ParentName) + delete(rawMsg, key) + case "parentType": + err = unpopulate(val, "ParentType", &a.ParentType) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &a.PolicyID) + delete(rawMsg, key) + case "protectedItemDataSourceId": + err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) + delete(rawMsg, key) + case "protectedItemHealthStatus": + err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) + delete(rawMsg, key) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) + delete(rawMsg, key) + case "protectionState": + err = unpopulate(val, "ProtectionState", &a.ProtectionState) + delete(rawMsg, key) + case "protectionStatus": + err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &a.ResourceGroup) + case "serverName": + err = unpopulate(val, "ServerName", &a.ServerName) delete(rawMsg, key) case "sourceResourceId": err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "storageAccountVersion": - err = unpopulate(val, "StorageAccountVersion", &a.StorageAccountVersion) + case "workloadType": + err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) } if err != nil { @@ -2234,17 +1802,154 @@ func (a *AzureStorageContainer) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureStorageErrorInfo. -func (a AzureStorageErrorInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSQLDatabaseProtectedItem. +func (a AzureVMWorkloadSQLDatabaseProtectedItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupManagementType", a.BackupManagementType) + populate(objectMap, "backupSetName", a.BackupSetName) + populate(objectMap, "containerName", a.ContainerName) + populate(objectMap, "createMode", a.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) + populate(objectMap, "extendedInfo", a.ExtendedInfo) + populate(objectMap, "friendlyName", a.FriendlyName) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", a.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) + populate(objectMap, "kpisHealths", a.KpisHealths) + populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) + populate(objectMap, "lastBackupStatus", a.LastBackupStatus) + populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) + populate(objectMap, "parentName", a.ParentName) + populate(objectMap, "parentType", a.ParentType) + populate(objectMap, "policyId", a.PolicyID) + populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) + populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) + objectMap["protectedItemType"] = "AzureVmWorkloadSQLDatabase" + populate(objectMap, "protectionState", a.ProtectionState) + populate(objectMap, "protectionStatus", a.ProtectionStatus) + populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) + populate(objectMap, "serverName", a.ServerName) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "workloadType", a.WorkloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSQLDatabaseProtectedItem. +func (a *AzureVMWorkloadSQLDatabaseProtectedItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) + delete(rawMsg, key) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &a.BackupSetName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &a.ContainerName) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &a.CreateMode) + delete(rawMsg, key) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &a.FriendlyName) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) + delete(rawMsg, key) + case "kpisHealths": + err = unpopulate(val, "KpisHealths", &a.KpisHealths) + delete(rawMsg, key) + case "lastBackupErrorDetail": + err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) + delete(rawMsg, key) + case "lastBackupStatus": + err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) + delete(rawMsg, key) + case "lastBackupTime": + err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) + delete(rawMsg, key) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) + delete(rawMsg, key) + case "parentName": + err = unpopulate(val, "ParentName", &a.ParentName) + delete(rawMsg, key) + case "parentType": + err = unpopulate(val, "ParentType", &a.ParentType) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &a.PolicyID) + delete(rawMsg, key) + case "protectedItemDataSourceId": + err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) + delete(rawMsg, key) + case "protectedItemHealthStatus": + err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) + delete(rawMsg, key) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) + delete(rawMsg, key) + case "protectionState": + err = unpopulate(val, "ProtectionState", &a.ProtectionState) + delete(rawMsg, key) + case "protectionStatus": + err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) + delete(rawMsg, key) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) + delete(rawMsg, key) + case "serverName": + err = unpopulate(val, "ServerName", &a.ServerName) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &a.WorkloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadErrorInfo. +func (a AzureWorkloadErrorInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "additionalDetails", a.AdditionalDetails) populate(objectMap, "errorCode", a.ErrorCode) populate(objectMap, "errorString", a.ErrorString) + populate(objectMap, "errorTitle", a.ErrorTitle) populate(objectMap, "recommendations", a.Recommendations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageErrorInfo. -func (a *AzureStorageErrorInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadErrorInfo. +func (a *AzureWorkloadErrorInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2252,12 +1957,18 @@ func (a *AzureStorageErrorInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "additionalDetails": + err = unpopulate(val, "AdditionalDetails", &a.AdditionalDetails) + delete(rawMsg, key) case "errorCode": err = unpopulate(val, "ErrorCode", &a.ErrorCode) delete(rawMsg, key) case "errorString": err = unpopulate(val, "ErrorString", &a.ErrorString) delete(rawMsg, key) + case "errorTitle": + err = unpopulate(val, "ErrorTitle", &a.ErrorTitle) + delete(rawMsg, key) case "recommendations": err = unpopulate(val, "Recommendations", &a.Recommendations) delete(rawMsg, key) @@ -2269,8 +1980,8 @@ func (a *AzureStorageErrorInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureStorageJob. -func (a AzureStorageJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadJob. +func (a AzureWorkloadJob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionsInfo", a.ActionsInfo) populate(objectMap, "activityId", a.ActivityID) @@ -2280,18 +1991,16 @@ func (a AzureStorageJob) MarshalJSON() ([]byte, error) { populate(objectMap, "entityFriendlyName", a.EntityFriendlyName) populate(objectMap, "errorDetails", a.ErrorDetails) populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "isUserTriggered", a.IsUserTriggered) - objectMap["jobType"] = "AzureStorageJob" + objectMap["jobType"] = "AzureWorkloadJob" populate(objectMap, "operation", a.Operation) populateDateTimeRFC3339(objectMap, "startTime", a.StartTime) populate(objectMap, "status", a.Status) - populate(objectMap, "storageAccountName", a.StorageAccountName) - populate(objectMap, "storageAccountVersion", a.StorageAccountVersion) + populate(objectMap, "workloadType", a.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageJob. -func (a *AzureStorageJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadJob. +func (a *AzureWorkloadJob) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2323,9 +2032,6 @@ func (a *AzureStorageJob) UnmarshalJSON(data []byte) error { case "extendedInfo": err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) delete(rawMsg, key) - case "isUserTriggered": - err = unpopulate(val, "IsUserTriggered", &a.IsUserTriggered) - delete(rawMsg, key) case "jobType": err = unpopulate(val, "JobType", &a.JobType) delete(rawMsg, key) @@ -2338,11 +2044,8 @@ func (a *AzureStorageJob) UnmarshalJSON(data []byte) error { case "status": err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) - case "storageAccountName": - err = unpopulate(val, "StorageAccountName", &a.StorageAccountName) - delete(rawMsg, key) - case "storageAccountVersion": - err = unpopulate(val, "StorageAccountVersion", &a.StorageAccountVersion) + case "workloadType": + err = unpopulate(val, "WorkloadType", &a.WorkloadType) delete(rawMsg, key) } if err != nil { @@ -2352,8 +2055,8 @@ func (a *AzureStorageJob) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureStorageJobExtendedInfo. -func (a AzureStorageJobExtendedInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadJobExtendedInfo. +func (a AzureWorkloadJobExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "dynamicErrorMessage", a.DynamicErrorMessage) populate(objectMap, "propertyBag", a.PropertyBag) @@ -2361,8 +2064,8 @@ func (a AzureStorageJobExtendedInfo) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageJobExtendedInfo. -func (a *AzureStorageJobExtendedInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadJobExtendedInfo. +func (a *AzureWorkloadJobExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2387,16 +2090,16 @@ func (a *AzureStorageJobExtendedInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureStorageJobTaskDetails. -func (a AzureStorageJobTaskDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadJobTaskDetails. +func (a AzureWorkloadJobTaskDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "status", a.Status) populate(objectMap, "taskId", a.TaskID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageJobTaskDetails. -func (a *AzureStorageJobTaskDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadJobTaskDetails. +func (a *AzureWorkloadJobTaskDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2418,19 +2121,21 @@ func (a *AzureStorageJobTaskDetails) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureStorageProtectableContainer. -func (a AzureStorageProtectableContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadPointInTimeRecoveryPoint. +func (a AzureWorkloadPointInTimeRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "containerId", a.ContainerID) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - objectMap["protectableContainerType"] = ProtectableContainerTypeStorageContainer + objectMap["objectType"] = "AzureWorkloadPointInTimeRecoveryPoint" + populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) + populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) + populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) + populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) + populate(objectMap, "timeRanges", a.TimeRanges) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureStorageProtectableContainer. -func (a *AzureStorageProtectableContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadPointInTimeRecoveryPoint. +func (a *AzureWorkloadPointInTimeRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2438,20 +2143,26 @@ func (a *AzureStorageProtectableContainer) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &a.ContainerID) + case "recoveryPointMoveReadinessInfo": + err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) + case "recoveryPointTierDetails": + err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) + delete(rawMsg, key) + case "recoveryPointTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) + delete(rawMsg, key) + case "timeRanges": + err = unpopulate(val, "TimeRanges", &a.TimeRanges) delete(rawMsg, key) - case "protectableContainerType": - err = unpopulate(val, "ProtectableContainerType", &a.ProtectableContainerType) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -2461,19 +2172,22 @@ func (a *AzureStorageProtectableContainer) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMAppContainerProtectableContainer. -func (a AzureVMAppContainerProtectableContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadPointInTimeRestoreRequest. +func (a AzureWorkloadPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "containerId", a.ContainerID) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - objectMap["protectableContainerType"] = ProtectableContainerTypeVMAppContainer + objectMap["objectType"] = "AzureWorkloadPointInTimeRestoreRequest" + populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) + populate(objectMap, "propertyBag", a.PropertyBag) + populate(objectMap, "recoveryMode", a.RecoveryMode) + populate(objectMap, "recoveryType", a.RecoveryType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "targetInfo", a.TargetInfo) + populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMAppContainerProtectableContainer. -func (a *AzureVMAppContainerProtectableContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadPointInTimeRestoreRequest. +func (a *AzureWorkloadPointInTimeRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2481,20 +2195,29 @@ func (a *AzureVMAppContainerProtectableContainer) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &a.ContainerID) + case "pointInTime": + err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &a.PropertyBag) delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) + delete(rawMsg, key) + case "recoveryType": + err = unpopulate(val, "RecoveryType", &a.RecoveryType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + case "targetInfo": + err = unpopulate(val, "TargetInfo", &a.TargetInfo) delete(rawMsg, key) - case "protectableContainerType": - err = unpopulate(val, "ProtectableContainerType", &a.ProtectableContainerType) + case "targetVirtualMachineId": + err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) delete(rawMsg, key) } if err != nil { @@ -2504,25 +2227,20 @@ func (a *AzureVMAppContainerProtectableContainer) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMAppContainerProtectionContainer. -func (a AzureVMAppContainerProtectionContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadRecoveryPoint. +func (a AzureWorkloadRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeVMAppContainer - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) - populate(objectMap, "operationType", a.OperationType) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "workloadType", a.WorkloadType) + objectMap["objectType"] = "AzureWorkloadRecoveryPoint" + populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) + populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) + populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) + populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMAppContainerProtectionContainer. -func (a *AzureVMAppContainerProtectionContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadRecoveryPoint. +func (a *AzureWorkloadRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2530,38 +2248,23 @@ func (a *AzureVMAppContainerProtectionContainer) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "operationType": - err = unpopulate(val, "OperationType", &a.OperationType) + case "recoveryPointMoveReadinessInfo": + err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) + case "recoveryPointTierDetails": + err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + case "recoveryPointTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -2571,17 +2274,21 @@ func (a *AzureVMAppContainerProtectionContainer) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMResourceFeatureSupportRequest. -func (a AzureVMResourceFeatureSupportRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadRestoreRequest. +func (a AzureWorkloadRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["featureType"] = "AzureVMResourceBackup" - populate(objectMap, "vmSku", a.VMSKU) - populate(objectMap, "vmSize", a.VMSize) + objectMap["objectType"] = "AzureWorkloadRestoreRequest" + populate(objectMap, "propertyBag", a.PropertyBag) + populate(objectMap, "recoveryMode", a.RecoveryMode) + populate(objectMap, "recoveryType", a.RecoveryType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "targetInfo", a.TargetInfo) + populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMResourceFeatureSupportRequest. -func (a *AzureVMResourceFeatureSupportRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadRestoreRequest. +func (a *AzureWorkloadRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2589,14 +2296,26 @@ func (a *AzureVMResourceFeatureSupportRequest) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "featureType": - err = unpopulate(val, "FeatureType", &a.FeatureType) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &a.PropertyBag) + delete(rawMsg, key) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) + delete(rawMsg, key) + case "recoveryType": + err = unpopulate(val, "RecoveryType", &a.RecoveryType) delete(rawMsg, key) - case "vmSku": - err = unpopulate(val, "VMSKU", &a.VMSKU) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + case "targetInfo": + err = unpopulate(val, "TargetInfo", &a.TargetInfo) delete(rawMsg, key) - case "vmSize": - err = unpopulate(val, "VMSize", &a.VMSize) + case "targetVirtualMachineId": + err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) delete(rawMsg, key) } if err != nil { @@ -2606,15 +2325,21 @@ func (a *AzureVMResourceFeatureSupportRequest) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMResourceFeatureSupportResponse. -func (a AzureVMResourceFeatureSupportResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. +func (a AzureWorkloadSAPHanaPointInTimeRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "supportStatus", a.SupportStatus) + objectMap["objectType"] = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" + populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) + populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) + populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) + populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) + populate(objectMap, "timeRanges", a.TimeRanges) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMResourceFeatureSupportResponse. -func (a *AzureVMResourceFeatureSupportResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. +func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2622,8 +2347,26 @@ func (a *AzureVMResourceFeatureSupportResponse) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "supportStatus": - err = unpopulate(val, "SupportStatus", &a.SupportStatus) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "recoveryPointMoveReadinessInfo": + err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) + delete(rawMsg, key) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) + delete(rawMsg, key) + case "recoveryPointTierDetails": + err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) + delete(rawMsg, key) + case "recoveryPointTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) + delete(rawMsg, key) + case "timeRanges": + err = unpopulate(val, "TimeRanges", &a.TimeRanges) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -2633,24 +2376,22 @@ func (a *AzureVMResourceFeatureSupportResponse) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadItem. -func (a AzureVMWorkloadItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. +func (a AzureWorkloadSAPHanaPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subWorkloadItemCount", a.SubWorkloadItemCount) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - objectMap["workloadItemType"] = "AzureVmWorkloadItem" - populate(objectMap, "workloadType", a.WorkloadType) + objectMap["objectType"] = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" + populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) + populate(objectMap, "propertyBag", a.PropertyBag) + populate(objectMap, "recoveryMode", a.RecoveryMode) + populate(objectMap, "recoveryType", a.RecoveryType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "targetInfo", a.TargetInfo) + populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadItem. -func (a *AzureVMWorkloadItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. +func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2658,35 +2399,29 @@ func (a *AzureVMWorkloadItem) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) + case "pointInTime": + err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &a.PropertyBag) delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) delete(rawMsg, key) - case "subWorkloadItemCount": - err = unpopulate(val, "SubWorkloadItemCount", &a.SubWorkloadItemCount) + case "recoveryType": + err = unpopulate(val, "RecoveryType", &a.RecoveryType) delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) + case "targetInfo": + err = unpopulate(val, "TargetInfo", &a.TargetInfo) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "targetVirtualMachineId": + err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) delete(rawMsg, key) } if err != nil { @@ -2696,28 +2431,20 @@ func (a *AzureVMWorkloadItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadProtectableItem. -func (a AzureVMWorkloadProtectableItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaRecoveryPoint. +func (a AzureWorkloadSAPHanaRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "AzureVmWorkloadProtectableItem" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) + objectMap["objectType"] = "AzureWorkloadSAPHanaRecoveryPoint" + populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) + populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) + populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) + populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadProtectableItem. -func (a *AzureVMWorkloadProtectableItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaRecoveryPoint. +func (a *AzureWorkloadSAPHanaRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2725,47 +2452,23 @@ func (a *AzureVMWorkloadProtectableItem) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) + case "recoveryPointMoveReadinessInfo": + err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) + case "recoveryPointTierDetails": + err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) + case "recoveryPointTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -2775,47 +2478,21 @@ func (a *AzureVMWorkloadProtectableItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadProtectedItem. -func (a AzureVMWorkloadProtectedItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaRestoreRequest. +func (a AzureWorkloadSAPHanaRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "backupSetName", a.BackupSetName) - populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "createMode", a.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", a.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) - populate(objectMap, "kpisHealths", a.KpisHealths) - populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) - populate(objectMap, "lastBackupStatus", a.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) - populate(objectMap, "nodesList", a.NodesList) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentType", a.ParentType) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) - populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) - objectMap["protectedItemType"] = "AzureVmWorkloadProtectedItem" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "protectionStatus", a.ProtectionStatus) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) + objectMap["objectType"] = "AzureWorkloadSAPHanaRestoreRequest" + populate(objectMap, "propertyBag", a.PropertyBag) + populate(objectMap, "recoveryMode", a.RecoveryMode) + populate(objectMap, "recoveryType", a.RecoveryType) populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) - populate(objectMap, "workloadType", a.WorkloadType) + populate(objectMap, "targetInfo", a.TargetInfo) + populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadProtectedItem. -func (a *AzureVMWorkloadProtectedItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaRestoreRequest. +func (a *AzureWorkloadSAPHanaRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2823,104 +2500,26 @@ func (a *AzureVMWorkloadProtectedItem) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &a.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &a.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "kpisHealths": - err = unpopulate(val, "KpisHealths", &a.KpisHealths) - delete(rawMsg, key) - case "lastBackupErrorDetail": - err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) - delete(rawMsg, key) - case "lastBackupTime": - err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) - delete(rawMsg, key) - case "nodesList": - err = unpopulate(val, "NodesList", &a.NodesList) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentType": - err = unpopulate(val, "ParentType", &a.ParentType) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) - case "protectedItemDataSourceId": - err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) - delete(rawMsg, key) - case "protectedItemHealthStatus": - err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &a.PropertyBag) delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) + case "recoveryType": + err = unpopulate(val, "RecoveryType", &a.RecoveryType) delete(rawMsg, key) case "sourceResourceId": err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) + case "targetInfo": + err = unpopulate(val, "TargetInfo", &a.TargetInfo) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "targetVirtualMachineId": + err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) delete(rawMsg, key) } if err != nil { @@ -2930,21 +2529,22 @@ func (a *AzureVMWorkloadProtectedItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadProtectedItemExtendedInfo. -func (a AzureVMWorkloadProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. +func (a AzureWorkloadSQLPointInTimeRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "newestRecoveryPointInArchive", a.NewestRecoveryPointInArchive) - populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", a.OldestRecoveryPoint) - populateDateTimeRFC3339(objectMap, "oldestRecoveryPointInArchive", a.OldestRecoveryPointInArchive) - populateDateTimeRFC3339(objectMap, "oldestRecoveryPointInVault", a.OldestRecoveryPointInVault) - populate(objectMap, "policyState", a.PolicyState) - populate(objectMap, "recoveryModel", a.RecoveryModel) - populate(objectMap, "recoveryPointCount", a.RecoveryPointCount) + populate(objectMap, "extendedInfo", a.ExtendedInfo) + objectMap["objectType"] = "AzureWorkloadSQLPointInTimeRecoveryPoint" + populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) + populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) + populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) + populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) + populate(objectMap, "timeRanges", a.TimeRanges) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadProtectedItemExtendedInfo. -func (a *AzureVMWorkloadProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. +func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -2952,26 +2552,29 @@ func (a *AzureVMWorkloadProtectedItemExtendedInfo) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "newestRecoveryPointInArchive": - err = unpopulateDateTimeRFC3339(val, "NewestRecoveryPointInArchive", &a.NewestRecoveryPointInArchive) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) delete(rawMsg, key) - case "oldestRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPoint", &a.OldestRecoveryPoint) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "oldestRecoveryPointInArchive": - err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPointInArchive", &a.OldestRecoveryPointInArchive) + case "recoveryPointMoveReadinessInfo": + err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) delete(rawMsg, key) - case "oldestRecoveryPointInVault": - err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPointInVault", &a.OldestRecoveryPointInVault) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) delete(rawMsg, key) - case "policyState": - err = unpopulate(val, "PolicyState", &a.PolicyState) + case "recoveryPointTierDetails": + err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) delete(rawMsg, key) - case "recoveryModel": - err = unpopulate(val, "RecoveryModel", &a.RecoveryModel) + case "recoveryPointTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) delete(rawMsg, key) - case "recoveryPointCount": - err = unpopulate(val, "RecoveryPointCount", &a.RecoveryPointCount) + case "timeRanges": + err = unpopulate(val, "TimeRanges", &a.TimeRanges) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -2981,21 +2584,25 @@ func (a *AzureVMWorkloadProtectedItemExtendedInfo) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadProtectionPolicy. -func (a AzureVMWorkloadProtectionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLPointInTimeRestoreRequest. +func (a AzureWorkloadSQLPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["backupManagementType"] = "AzureWorkload" - populate(objectMap, "makePolicyConsistent", a.MakePolicyConsistent) - populate(objectMap, "protectedItemsCount", a.ProtectedItemsCount) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "settings", a.Settings) - populate(objectMap, "subProtectionPolicy", a.SubProtectionPolicy) - populate(objectMap, "workLoadType", a.WorkLoadType) + populate(objectMap, "alternateDirectoryPaths", a.AlternateDirectoryPaths) + populate(objectMap, "isNonRecoverable", a.IsNonRecoverable) + objectMap["objectType"] = "AzureWorkloadSQLPointInTimeRestoreRequest" + populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) + populate(objectMap, "propertyBag", a.PropertyBag) + populate(objectMap, "recoveryMode", a.RecoveryMode) + populate(objectMap, "recoveryType", a.RecoveryType) + populate(objectMap, "shouldUseAlternateTargetLocation", a.ShouldUseAlternateTargetLocation) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "targetInfo", a.TargetInfo) + populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadProtectionPolicy. -func (a *AzureVMWorkloadProtectionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLPointInTimeRestoreRequest. +func (a *AzureWorkloadSQLPointInTimeRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -3003,26 +2610,38 @@ func (a *AzureVMWorkloadProtectionPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) + case "alternateDirectoryPaths": + err = unpopulate(val, "AlternateDirectoryPaths", &a.AlternateDirectoryPaths) delete(rawMsg, key) - case "makePolicyConsistent": - err = unpopulate(val, "MakePolicyConsistent", &a.MakePolicyConsistent) + case "isNonRecoverable": + err = unpopulate(val, "IsNonRecoverable", &a.IsNonRecoverable) delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &a.ProtectedItemsCount) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) + case "pointInTime": + err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) + delete(rawMsg, key) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &a.PropertyBag) + delete(rawMsg, key) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) delete(rawMsg, key) - case "settings": - err = unpopulate(val, "Settings", &a.Settings) + case "recoveryType": + err = unpopulate(val, "RecoveryType", &a.RecoveryType) + delete(rawMsg, key) + case "shouldUseAlternateTargetLocation": + err = unpopulate(val, "ShouldUseAlternateTargetLocation", &a.ShouldUseAlternateTargetLocation) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "subProtectionPolicy": - err = unpopulate(val, "SubProtectionPolicy", &a.SubProtectionPolicy) + case "targetInfo": + err = unpopulate(val, "TargetInfo", &a.TargetInfo) delete(rawMsg, key) - case "workLoadType": - err = unpopulate(val, "WorkLoadType", &a.WorkLoadType) + case "targetVirtualMachineId": + err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) delete(rawMsg, key) } if err != nil { @@ -3032,47 +2651,21 @@ func (a *AzureVMWorkloadProtectionPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. -func (a AzureVMWorkloadSAPAseDatabaseProtectedItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLRecoveryPoint. +func (a AzureWorkloadSQLRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "backupSetName", a.BackupSetName) - populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "createMode", a.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", a.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) - populate(objectMap, "kpisHealths", a.KpisHealths) - populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) - populate(objectMap, "lastBackupStatus", a.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) - populate(objectMap, "nodesList", a.NodesList) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentType", a.ParentType) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) - populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) - objectMap["protectedItemType"] = "AzureVmWorkloadSAPAseDatabase" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "protectionStatus", a.ProtectionStatus) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) - populate(objectMap, "workloadType", a.WorkloadType) + objectMap["objectType"] = "AzureWorkloadSQLRecoveryPoint" + populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) + populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) + populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) + populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPAseDatabaseProtectedItem. -func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLRecoveryPoint. +func (a *AzureWorkloadSQLRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -3080,104 +2673,26 @@ func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &a.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &a.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) - delete(rawMsg, key) case "extendedInfo": err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "kpisHealths": - err = unpopulate(val, "KpisHealths", &a.KpisHealths) - delete(rawMsg, key) - case "lastBackupErrorDetail": - err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) - delete(rawMsg, key) - case "lastBackupTime": - err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) - delete(rawMsg, key) - case "nodesList": - err = unpopulate(val, "NodesList", &a.NodesList) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentType": - err = unpopulate(val, "ParentType", &a.ParentType) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) - case "protectedItemDataSourceId": - err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) - delete(rawMsg, key) - case "protectedItemHealthStatus": - err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) + case "recoveryPointMoveReadinessInfo": + err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + case "recoveryPointTierDetails": + err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) + case "recoveryPointTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -3187,24 +2702,16 @@ func (a *AzureVMWorkloadSAPAseDatabaseProtectedItem) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPAseDatabaseWorkloadItem. -func (a AzureVMWorkloadSAPAseDatabaseWorkloadItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLRecoveryPointExtendedInfo. +func (a AzureWorkloadSQLRecoveryPointExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subWorkloadItemCount", a.SubWorkloadItemCount) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - objectMap["workloadItemType"] = "SAPAseDatabase" - populate(objectMap, "workloadType", a.WorkloadType) + populate(objectMap, "dataDirectoryPaths", a.DataDirectoryPaths) + populateDateTimeRFC3339(objectMap, "dataDirectoryTimeInUTC", a.DataDirectoryTimeInUTC) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPAseDatabaseWorkloadItem. -func (a *AzureVMWorkloadSAPAseDatabaseWorkloadItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLRecoveryPointExtendedInfo. +func (a *AzureWorkloadSQLRecoveryPointExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -3212,35 +2719,11 @@ func (a *AzureVMWorkloadSAPAseDatabaseWorkloadItem) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subWorkloadItemCount": - err = unpopulate(val, "SubWorkloadItemCount", &a.SubWorkloadItemCount) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) + case "dataDirectoryPaths": + err = unpopulate(val, "DataDirectoryPaths", &a.DataDirectoryPaths) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "dataDirectoryTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DataDirectoryTimeInUTC", &a.DataDirectoryTimeInUTC) delete(rawMsg, key) } if err != nil { @@ -3250,28 +2733,24 @@ func (a *AzureVMWorkloadSAPAseDatabaseWorkloadItem) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPAseSystemProtectableItem. -func (a AzureVMWorkloadSAPAseSystemProtectableItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLRestoreRequest. +func (a AzureWorkloadSQLRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "SAPAseSystem" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) + populate(objectMap, "alternateDirectoryPaths", a.AlternateDirectoryPaths) + populate(objectMap, "isNonRecoverable", a.IsNonRecoverable) + objectMap["objectType"] = "AzureWorkloadSQLRestoreRequest" + populate(objectMap, "propertyBag", a.PropertyBag) + populate(objectMap, "recoveryMode", a.RecoveryMode) + populate(objectMap, "recoveryType", a.RecoveryType) + populate(objectMap, "shouldUseAlternateTargetLocation", a.ShouldUseAlternateTargetLocation) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + populate(objectMap, "targetInfo", a.TargetInfo) + populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPAseSystemProtectableItem. -func (a *AzureVMWorkloadSAPAseSystemProtectableItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLRestoreRequest. +func (a *AzureWorkloadSQLRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -3279,47 +2758,35 @@ func (a *AzureVMWorkloadSAPAseSystemProtectableItem) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) + case "alternateDirectoryPaths": + err = unpopulate(val, "AlternateDirectoryPaths", &a.AlternateDirectoryPaths) delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) + case "isNonRecoverable": + err = unpopulate(val, "IsNonRecoverable", &a.IsNonRecoverable) delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &a.PropertyBag) delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) + case "recoveryType": + err = unpopulate(val, "RecoveryType", &a.RecoveryType) delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) + case "shouldUseAlternateTargetLocation": + err = unpopulate(val, "ShouldUseAlternateTargetLocation", &a.ShouldUseAlternateTargetLocation) delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) + case "targetInfo": + err = unpopulate(val, "TargetInfo", &a.TargetInfo) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "targetVirtualMachineId": + err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) delete(rawMsg, key) } if err != nil { @@ -3329,11834 +2796,3535 @@ func (a *AzureVMWorkloadSAPAseSystemProtectableItem) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPAseSystemWorkloadItem. -func (a AzureVMWorkloadSAPAseSystemWorkloadItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BEKDetails. +func (b BEKDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subWorkloadItemCount", a.SubWorkloadItemCount) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - objectMap["workloadItemType"] = "SAPAseSystem" - populate(objectMap, "workloadType", a.WorkloadType) + populate(objectMap, "secretData", b.SecretData) + populate(objectMap, "secretUrl", b.SecretURL) + populate(objectMap, "secretVaultId", b.SecretVaultID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPAseSystemWorkloadItem. -func (a *AzureVMWorkloadSAPAseSystemWorkloadItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BEKDetails. +func (b *BEKDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subWorkloadItemCount": - err = unpopulate(val, "SubWorkloadItemCount", &a.SubWorkloadItemCount) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) + case "secretData": + err = unpopulate(val, "SecretData", &b.SecretData) delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) + case "secretUrl": + err = unpopulate(val, "SecretURL", &b.SecretURL) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) + case "secretVaultId": + err = unpopulate(val, "SecretVaultID", &b.SecretVaultID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaDBInstance. -func (a AzureVMWorkloadSAPHanaDBInstance) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BMSAADPropertiesQueryObject. +func (b BMSAADPropertiesQueryObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "SAPHanaDBInstance" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaDBInstance. -func (a *AzureVMWorkloadSAPHanaDBInstance) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaDBInstanceProtectedItem. -func (a AzureVMWorkloadSAPHanaDBInstanceProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "backupSetName", a.BackupSetName) - populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "createMode", a.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", a.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) - populate(objectMap, "kpisHealths", a.KpisHealths) - populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) - populate(objectMap, "lastBackupStatus", a.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) - populate(objectMap, "nodesList", a.NodesList) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentType", a.ParentType) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) - populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) - objectMap["protectedItemType"] = "AzureVmWorkloadSAPHanaDBInstance" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "protectionStatus", a.ProtectionStatus) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaDBInstanceProtectedItem. -func (a *AzureVMWorkloadSAPHanaDBInstanceProtectedItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &a.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &a.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "kpisHealths": - err = unpopulate(val, "KpisHealths", &a.KpisHealths) - delete(rawMsg, key) - case "lastBackupErrorDetail": - err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) - delete(rawMsg, key) - case "lastBackupTime": - err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) - delete(rawMsg, key) - case "nodesList": - err = unpopulate(val, "NodesList", &a.NodesList) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentType": - err = unpopulate(val, "ParentType", &a.ParentType) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) - case "protectedItemDataSourceId": - err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) - delete(rawMsg, key) - case "protectedItemHealthStatus": - err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaDatabaseProtectableItem. -func (a AzureVMWorkloadSAPHanaDatabaseProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "SAPHanaDatabase" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaDatabaseProtectableItem. -func (a *AzureVMWorkloadSAPHanaDatabaseProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. -func (a AzureVMWorkloadSAPHanaDatabaseProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "backupSetName", a.BackupSetName) - populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "createMode", a.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", a.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) - populate(objectMap, "kpisHealths", a.KpisHealths) - populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) - populate(objectMap, "lastBackupStatus", a.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) - populate(objectMap, "nodesList", a.NodesList) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentType", a.ParentType) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) - populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) - objectMap["protectedItemType"] = "AzureVmWorkloadSAPHanaDatabase" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "protectionStatus", a.ProtectionStatus) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaDatabaseProtectedItem. -func (a *AzureVMWorkloadSAPHanaDatabaseProtectedItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &a.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &a.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "kpisHealths": - err = unpopulate(val, "KpisHealths", &a.KpisHealths) - delete(rawMsg, key) - case "lastBackupErrorDetail": - err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) - delete(rawMsg, key) - case "lastBackupTime": - err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) - delete(rawMsg, key) - case "nodesList": - err = unpopulate(val, "NodesList", &a.NodesList) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentType": - err = unpopulate(val, "ParentType", &a.ParentType) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) - case "protectedItemDataSourceId": - err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) - delete(rawMsg, key) - case "protectedItemHealthStatus": - err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaDatabaseWorkloadItem. -func (a AzureVMWorkloadSAPHanaDatabaseWorkloadItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subWorkloadItemCount", a.SubWorkloadItemCount) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - objectMap["workloadItemType"] = "SAPHanaDatabase" - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaDatabaseWorkloadItem. -func (a *AzureVMWorkloadSAPHanaDatabaseWorkloadItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subWorkloadItemCount": - err = unpopulate(val, "SubWorkloadItemCount", &a.SubWorkloadItemCount) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaHSRProtectableItem. -func (a AzureVMWorkloadSAPHanaHSRProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "HanaHSRContainer" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaHSRProtectableItem. -func (a *AzureVMWorkloadSAPHanaHSRProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaSystemProtectableItem. -func (a AzureVMWorkloadSAPHanaSystemProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "SAPHanaSystem" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaSystemProtectableItem. -func (a *AzureVMWorkloadSAPHanaSystemProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSAPHanaSystemWorkloadItem. -func (a AzureVMWorkloadSAPHanaSystemWorkloadItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subWorkloadItemCount", a.SubWorkloadItemCount) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - objectMap["workloadItemType"] = "SAPHanaSystem" - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSAPHanaSystemWorkloadItem. -func (a *AzureVMWorkloadSAPHanaSystemWorkloadItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subWorkloadItemCount": - err = unpopulate(val, "SubWorkloadItemCount", &a.SubWorkloadItemCount) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSQLAvailabilityGroupProtectableItem. -func (a AzureVMWorkloadSQLAvailabilityGroupProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "nodesList", a.NodesList) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "SQLAvailabilityGroupContainer" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSQLAvailabilityGroupProtectableItem. -func (a *AzureVMWorkloadSQLAvailabilityGroupProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "nodesList": - err = unpopulate(val, "NodesList", &a.NodesList) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSQLDatabaseProtectableItem. -func (a AzureVMWorkloadSQLDatabaseProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "SQLDataBase" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSQLDatabaseProtectableItem. -func (a *AzureVMWorkloadSQLDatabaseProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSQLDatabaseProtectedItem. -func (a AzureVMWorkloadSQLDatabaseProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "backupSetName", a.BackupSetName) - populate(objectMap, "containerName", a.ContainerName) - populate(objectMap, "createMode", a.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", a.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", a.DeferredDeleteTimeRemaining) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isArchiveEnabled", a.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", a.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", a.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", a.IsScheduledForDeferredDelete) - populate(objectMap, "kpisHealths", a.KpisHealths) - populate(objectMap, "lastBackupErrorDetail", a.LastBackupErrorDetail) - populate(objectMap, "lastBackupStatus", a.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastBackupTime", a.LastBackupTime) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", a.LastRecoveryPoint) - populate(objectMap, "nodesList", a.NodesList) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentType", a.ParentType) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "protectedItemDataSourceId", a.ProtectedItemDataSourceID) - populate(objectMap, "protectedItemHealthStatus", a.ProtectedItemHealthStatus) - objectMap["protectedItemType"] = "AzureVmWorkloadSQLDatabase" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "protectionStatus", a.ProtectionStatus) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "softDeleteRetentionPeriodInDays", a.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "vaultId", a.VaultID) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSQLDatabaseProtectedItem. -func (a *AzureVMWorkloadSQLDatabaseProtectedItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &a.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &a.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &a.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &a.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &a.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &a.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &a.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &a.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &a.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "kpisHealths": - err = unpopulate(val, "KpisHealths", &a.KpisHealths) - delete(rawMsg, key) - case "lastBackupErrorDetail": - err = unpopulate(val, "LastBackupErrorDetail", &a.LastBackupErrorDetail) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &a.LastBackupStatus) - delete(rawMsg, key) - case "lastBackupTime": - err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &a.LastBackupTime) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &a.LastRecoveryPoint) - delete(rawMsg, key) - case "nodesList": - err = unpopulate(val, "NodesList", &a.NodesList) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentType": - err = unpopulate(val, "ParentType", &a.ParentType) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) - case "protectedItemDataSourceId": - err = unpopulate(val, "ProtectedItemDataSourceID", &a.ProtectedItemDataSourceID) - delete(rawMsg, key) - case "protectedItemHealthStatus": - err = unpopulate(val, "ProtectedItemHealthStatus", &a.ProtectedItemHealthStatus) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &a.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &a.ProtectionStatus) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &a.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &a.VaultID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSQLDatabaseWorkloadItem. -func (a AzureVMWorkloadSQLDatabaseWorkloadItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subWorkloadItemCount", a.SubWorkloadItemCount) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - objectMap["workloadItemType"] = "SQLDataBase" - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSQLDatabaseWorkloadItem. -func (a *AzureVMWorkloadSQLDatabaseWorkloadItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subWorkloadItemCount": - err = unpopulate(val, "SubWorkloadItemCount", &a.SubWorkloadItemCount) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSQLInstanceProtectableItem. -func (a AzureVMWorkloadSQLInstanceProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "isAutoProtected", a.IsAutoProtected) - populate(objectMap, "isProtectable", a.IsProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "parentUniqueName", a.ParentUniqueName) - populate(objectMap, "prebackupvalidation", a.Prebackupvalidation) - objectMap["protectableItemType"] = "SQLInstance" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - populate(objectMap, "subprotectableitemcount", a.Subprotectableitemcount) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSQLInstanceProtectableItem. -func (a *AzureVMWorkloadSQLInstanceProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "isAutoProtected": - err = unpopulate(val, "IsAutoProtected", &a.IsAutoProtected) - delete(rawMsg, key) - case "isProtectable": - err = unpopulate(val, "IsProtectable", &a.IsProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "parentUniqueName": - err = unpopulate(val, "ParentUniqueName", &a.ParentUniqueName) - delete(rawMsg, key) - case "prebackupvalidation": - err = unpopulate(val, "Prebackupvalidation", &a.Prebackupvalidation) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &a.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "subprotectableitemcount": - err = unpopulate(val, "Subprotectableitemcount", &a.Subprotectableitemcount) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureVMWorkloadSQLInstanceWorkloadItem. -func (a AzureVMWorkloadSQLInstanceWorkloadItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "dataDirectoryPaths", a.DataDirectoryPaths) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "isAutoProtectable", a.IsAutoProtectable) - populate(objectMap, "parentName", a.ParentName) - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "serverName", a.ServerName) - populate(objectMap, "subWorkloadItemCount", a.SubWorkloadItemCount) - populate(objectMap, "subinquireditemcount", a.Subinquireditemcount) - objectMap["workloadItemType"] = "SQLInstance" - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureVMWorkloadSQLInstanceWorkloadItem. -func (a *AzureVMWorkloadSQLInstanceWorkloadItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "dataDirectoryPaths": - err = unpopulate(val, "DataDirectoryPaths", &a.DataDirectoryPaths) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "isAutoProtectable": - err = unpopulate(val, "IsAutoProtectable", &a.IsAutoProtectable) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &a.ParentName) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &a.ServerName) - delete(rawMsg, key) - case "subWorkloadItemCount": - err = unpopulate(val, "SubWorkloadItemCount", &a.SubWorkloadItemCount) - delete(rawMsg, key) - case "subinquireditemcount": - err = unpopulate(val, "Subinquireditemcount", &a.Subinquireditemcount) - delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadAutoProtectionIntent. -func (a AzureWorkloadAutoProtectionIntent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "itemId", a.ItemID) - populate(objectMap, "policyId", a.PolicyID) - objectMap["protectionIntentItemType"] = "ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadAutoProtectionIntent. -func (a *AzureWorkloadAutoProtectionIntent) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "itemId": - err = unpopulate(val, "ItemID", &a.ItemID) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "protectionIntentItemType": - err = unpopulate(val, "ProtectionIntentItemType", &a.ProtectionIntentItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadBackupRequest. -func (a AzureWorkloadBackupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupType", a.BackupType) - populate(objectMap, "enableCompression", a.EnableCompression) - objectMap["objectType"] = "AzureWorkloadBackupRequest" - populateDateTimeRFC3339(objectMap, "recoveryPointExpiryTimeInUTC", a.RecoveryPointExpiryTimeInUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadBackupRequest. -func (a *AzureWorkloadBackupRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupType": - err = unpopulate(val, "BackupType", &a.BackupType) - delete(rawMsg, key) - case "enableCompression": - err = unpopulate(val, "EnableCompression", &a.EnableCompression) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointExpiryTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointExpiryTimeInUTC", &a.RecoveryPointExpiryTimeInUTC) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadContainer. -func (a AzureWorkloadContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeAzureWorkloadContainer - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "healthStatus", a.HealthStatus) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) - populate(objectMap, "operationType", a.OperationType) - populate(objectMap, "protectableObjectType", a.ProtectableObjectType) - populate(objectMap, "registrationStatus", a.RegistrationStatus) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadContainer. -func (a *AzureWorkloadContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &a.ContainerType) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &a.HealthStatus) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) - delete(rawMsg, key) - case "operationType": - err = unpopulate(val, "OperationType", &a.OperationType) - delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &a.ProtectableObjectType) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &a.RegistrationStatus) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadContainerAutoProtectionIntent. -func (a AzureWorkloadContainerAutoProtectionIntent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "itemId", a.ItemID) - populate(objectMap, "policyId", a.PolicyID) - objectMap["protectionIntentItemType"] = ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadContainerAutoProtectionIntent. -func (a *AzureWorkloadContainerAutoProtectionIntent) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "itemId": - err = unpopulate(val, "ItemID", &a.ItemID) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "protectionIntentItemType": - err = unpopulate(val, "ProtectionIntentItemType", &a.ProtectionIntentItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadContainerExtendedInfo. -func (a AzureWorkloadContainerExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "hostServerName", a.HostServerName) - populate(objectMap, "inquiryInfo", a.InquiryInfo) - populate(objectMap, "nodesList", a.NodesList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadContainerExtendedInfo. -func (a *AzureWorkloadContainerExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "hostServerName": - err = unpopulate(val, "HostServerName", &a.HostServerName) - delete(rawMsg, key) - case "inquiryInfo": - err = unpopulate(val, "InquiryInfo", &a.InquiryInfo) - delete(rawMsg, key) - case "nodesList": - err = unpopulate(val, "NodesList", &a.NodesList) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadErrorInfo. -func (a AzureWorkloadErrorInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalDetails", a.AdditionalDetails) - populate(objectMap, "errorCode", a.ErrorCode) - populate(objectMap, "errorString", a.ErrorString) - populate(objectMap, "errorTitle", a.ErrorTitle) - populate(objectMap, "recommendations", a.Recommendations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadErrorInfo. -func (a *AzureWorkloadErrorInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalDetails": - err = unpopulate(val, "AdditionalDetails", &a.AdditionalDetails) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &a.ErrorCode) - delete(rawMsg, key) - case "errorString": - err = unpopulate(val, "ErrorString", &a.ErrorString) - delete(rawMsg, key) - case "errorTitle": - err = unpopulate(val, "ErrorTitle", &a.ErrorTitle) - delete(rawMsg, key) - case "recommendations": - err = unpopulate(val, "Recommendations", &a.Recommendations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadJob. -func (a AzureWorkloadJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionsInfo", a.ActionsInfo) - populate(objectMap, "activityId", a.ActivityID) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "duration", a.Duration) - populateDateTimeRFC3339(objectMap, "endTime", a.EndTime) - populate(objectMap, "entityFriendlyName", a.EntityFriendlyName) - populate(objectMap, "errorDetails", a.ErrorDetails) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - objectMap["jobType"] = "AzureWorkloadJob" - populate(objectMap, "operation", a.Operation) - populateDateTimeRFC3339(objectMap, "startTime", a.StartTime) - populate(objectMap, "status", a.Status) - populate(objectMap, "workloadType", a.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadJob. -func (a *AzureWorkloadJob) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsInfo": - err = unpopulate(val, "ActionsInfo", &a.ActionsInfo) - delete(rawMsg, key) - case "activityId": - err = unpopulate(val, "ActivityID", &a.ActivityID) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "duration": - err = unpopulate(val, "Duration", &a.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &a.EndTime) - delete(rawMsg, key) - case "entityFriendlyName": - err = unpopulate(val, "EntityFriendlyName", &a.EntityFriendlyName) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "jobType": - err = unpopulate(val, "JobType", &a.JobType) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &a.Operation) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &a.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &a.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadJobExtendedInfo. -func (a AzureWorkloadJobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dynamicErrorMessage", a.DynamicErrorMessage) - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "tasksList", a.TasksList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadJobExtendedInfo. -func (a *AzureWorkloadJobExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dynamicErrorMessage": - err = unpopulate(val, "DynamicErrorMessage", &a.DynamicErrorMessage) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "tasksList": - err = unpopulate(val, "TasksList", &a.TasksList) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadJobTaskDetails. -func (a AzureWorkloadJobTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", a.Status) - populate(objectMap, "taskId", a.TaskID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadJobTaskDetails. -func (a *AzureWorkloadJobTaskDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - case "taskId": - err = unpopulate(val, "TaskID", &a.TaskID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadPointInTimeRecoveryPoint. -func (a AzureWorkloadPointInTimeRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadPointInTimeRecoveryPoint" - populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) - populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) - populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) - populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) - populate(objectMap, "timeRanges", a.TimeRanges) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadPointInTimeRecoveryPoint. -func (a *AzureWorkloadPointInTimeRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointMoveReadinessInfo": - err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTierDetails": - err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) - delete(rawMsg, key) - case "recoveryPointTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) - delete(rawMsg, key) - case "timeRanges": - err = unpopulate(val, "TimeRanges", &a.TimeRanges) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadPointInTimeRestoreRequest. -func (a AzureWorkloadPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadPointInTimeRestoreRequest" - populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadPointInTimeRestoreRequest. -func (a *AzureWorkloadPointInTimeRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "pointInTime": - err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadRecoveryPoint. -func (a AzureWorkloadRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadRecoveryPoint" - populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) - populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) - populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) - populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadRecoveryPoint. -func (a *AzureWorkloadRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointMoveReadinessInfo": - err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTierDetails": - err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) - delete(rawMsg, key) - case "recoveryPointTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadRestoreRequest. -func (a AzureWorkloadRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadRestoreRequest" - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadRestoreRequest. -func (a *AzureWorkloadRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. -func (a AzureWorkloadSAPHanaPointInTimeRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" - populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) - populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) - populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) - populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) - populate(objectMap, "timeRanges", a.TimeRanges) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaPointInTimeRecoveryPoint. -func (a *AzureWorkloadSAPHanaPointInTimeRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointMoveReadinessInfo": - err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTierDetails": - err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) - delete(rawMsg, key) - case "recoveryPointTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) - delete(rawMsg, key) - case "timeRanges": - err = unpopulate(val, "TimeRanges", &a.TimeRanges) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. -func (a AzureWorkloadSAPHanaPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" - populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaPointInTimeRestoreRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "pointInTime": - err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest. -func (a AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest" - populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryPointRehydrationInfo", a.RecoveryPointRehydrationInfo) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "pointInTime": - err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryPointRehydrationInfo": - err = unpopulate(val, "RecoveryPointRehydrationInfo", &a.RecoveryPointRehydrationInfo) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaRecoveryPoint. -func (a AzureWorkloadSAPHanaRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadSAPHanaRecoveryPoint" - populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) - populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) - populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) - populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaRecoveryPoint. -func (a *AzureWorkloadSAPHanaRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointMoveReadinessInfo": - err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTierDetails": - err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) - delete(rawMsg, key) - case "recoveryPointTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaRestoreRequest. -func (a AzureWorkloadSAPHanaRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadSAPHanaRestoreRequest" - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaRestoreRequest. -func (a *AzureWorkloadSAPHanaRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSAPHanaRestoreWithRehydrateRequest. -func (a AzureWorkloadSAPHanaRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "AzureWorkloadSAPHanaRestoreWithRehydrateRequest" - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryPointRehydrationInfo", a.RecoveryPointRehydrationInfo) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSAPHanaRestoreWithRehydrateRequest. -func (a *AzureWorkloadSAPHanaRestoreWithRehydrateRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryPointRehydrationInfo": - err = unpopulate(val, "RecoveryPointRehydrationInfo", &a.RecoveryPointRehydrationInfo) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLAutoProtectionIntent. -func (a AzureWorkloadSQLAutoProtectionIntent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", a.BackupManagementType) - populate(objectMap, "itemId", a.ItemID) - populate(objectMap, "policyId", a.PolicyID) - objectMap["protectionIntentItemType"] = "ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent" - populate(objectMap, "protectionState", a.ProtectionState) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "workloadItemType", a.WorkloadItemType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLAutoProtectionIntent. -func (a *AzureWorkloadSQLAutoProtectionIntent) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &a.BackupManagementType) - delete(rawMsg, key) - case "itemId": - err = unpopulate(val, "ItemID", &a.ItemID) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "protectionIntentItemType": - err = unpopulate(val, "ProtectionIntentItemType", &a.ProtectionIntentItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &a.ProtectionState) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &a.WorkloadItemType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. -func (a AzureWorkloadSQLPointInTimeRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - objectMap["objectType"] = "AzureWorkloadSQLPointInTimeRecoveryPoint" - populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) - populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) - populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) - populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) - populate(objectMap, "timeRanges", a.TimeRanges) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLPointInTimeRecoveryPoint. -func (a *AzureWorkloadSQLPointInTimeRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointMoveReadinessInfo": - err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTierDetails": - err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) - delete(rawMsg, key) - case "recoveryPointTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) - delete(rawMsg, key) - case "timeRanges": - err = unpopulate(val, "TimeRanges", &a.TimeRanges) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLPointInTimeRestoreRequest. -func (a AzureWorkloadSQLPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alternateDirectoryPaths", a.AlternateDirectoryPaths) - populate(objectMap, "isNonRecoverable", a.IsNonRecoverable) - objectMap["objectType"] = "AzureWorkloadSQLPointInTimeRestoreRequest" - populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "shouldUseAlternateTargetLocation", a.ShouldUseAlternateTargetLocation) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLPointInTimeRestoreRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alternateDirectoryPaths": - err = unpopulate(val, "AlternateDirectoryPaths", &a.AlternateDirectoryPaths) - delete(rawMsg, key) - case "isNonRecoverable": - err = unpopulate(val, "IsNonRecoverable", &a.IsNonRecoverable) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "pointInTime": - err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "shouldUseAlternateTargetLocation": - err = unpopulate(val, "ShouldUseAlternateTargetLocation", &a.ShouldUseAlternateTargetLocation) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest. -func (a AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alternateDirectoryPaths", a.AlternateDirectoryPaths) - populate(objectMap, "isNonRecoverable", a.IsNonRecoverable) - objectMap["objectType"] = "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest" - populateDateTimeRFC3339(objectMap, "pointInTime", a.PointInTime) - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryPointRehydrationInfo", a.RecoveryPointRehydrationInfo) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "shouldUseAlternateTargetLocation", a.ShouldUseAlternateTargetLocation) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alternateDirectoryPaths": - err = unpopulate(val, "AlternateDirectoryPaths", &a.AlternateDirectoryPaths) - delete(rawMsg, key) - case "isNonRecoverable": - err = unpopulate(val, "IsNonRecoverable", &a.IsNonRecoverable) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "pointInTime": - err = unpopulateDateTimeRFC3339(val, "PointInTime", &a.PointInTime) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryPointRehydrationInfo": - err = unpopulate(val, "RecoveryPointRehydrationInfo", &a.RecoveryPointRehydrationInfo) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "shouldUseAlternateTargetLocation": - err = unpopulate(val, "ShouldUseAlternateTargetLocation", &a.ShouldUseAlternateTargetLocation) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLRecoveryPoint. -func (a AzureWorkloadSQLRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - objectMap["objectType"] = "AzureWorkloadSQLRecoveryPoint" - populate(objectMap, "recoveryPointMoveReadinessInfo", a.RecoveryPointMoveReadinessInfo) - populate(objectMap, "recoveryPointProperties", a.RecoveryPointProperties) - populate(objectMap, "recoveryPointTierDetails", a.RecoveryPointTierDetails) - populateDateTimeRFC3339(objectMap, "recoveryPointTimeInUTC", a.RecoveryPointTimeInUTC) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLRecoveryPoint. -func (a *AzureWorkloadSQLRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointMoveReadinessInfo": - err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &a.RecoveryPointMoveReadinessInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &a.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTierDetails": - err = unpopulate(val, "RecoveryPointTierDetails", &a.RecoveryPointTierDetails) - delete(rawMsg, key) - case "recoveryPointTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTimeInUTC", &a.RecoveryPointTimeInUTC) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLRecoveryPointExtendedInfo. -func (a AzureWorkloadSQLRecoveryPointExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataDirectoryPaths", a.DataDirectoryPaths) - populateDateTimeRFC3339(objectMap, "dataDirectoryTimeInUTC", a.DataDirectoryTimeInUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLRecoveryPointExtendedInfo. -func (a *AzureWorkloadSQLRecoveryPointExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataDirectoryPaths": - err = unpopulate(val, "DataDirectoryPaths", &a.DataDirectoryPaths) - delete(rawMsg, key) - case "dataDirectoryTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DataDirectoryTimeInUTC", &a.DataDirectoryTimeInUTC) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLRestoreRequest. -func (a AzureWorkloadSQLRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alternateDirectoryPaths", a.AlternateDirectoryPaths) - populate(objectMap, "isNonRecoverable", a.IsNonRecoverable) - objectMap["objectType"] = "AzureWorkloadSQLRestoreRequest" - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "shouldUseAlternateTargetLocation", a.ShouldUseAlternateTargetLocation) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLRestoreRequest. -func (a *AzureWorkloadSQLRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alternateDirectoryPaths": - err = unpopulate(val, "AlternateDirectoryPaths", &a.AlternateDirectoryPaths) - delete(rawMsg, key) - case "isNonRecoverable": - err = unpopulate(val, "IsNonRecoverable", &a.IsNonRecoverable) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "shouldUseAlternateTargetLocation": - err = unpopulate(val, "ShouldUseAlternateTargetLocation", &a.ShouldUseAlternateTargetLocation) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureWorkloadSQLRestoreWithRehydrateRequest. -func (a AzureWorkloadSQLRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alternateDirectoryPaths", a.AlternateDirectoryPaths) - populate(objectMap, "isNonRecoverable", a.IsNonRecoverable) - objectMap["objectType"] = "AzureWorkloadSQLRestoreWithRehydrateRequest" - populate(objectMap, "propertyBag", a.PropertyBag) - populate(objectMap, "recoveryMode", a.RecoveryMode) - populate(objectMap, "recoveryPointRehydrationInfo", a.RecoveryPointRehydrationInfo) - populate(objectMap, "recoveryType", a.RecoveryType) - populate(objectMap, "resourceGuardOperationRequests", a.ResourceGuardOperationRequests) - populate(objectMap, "shouldUseAlternateTargetLocation", a.ShouldUseAlternateTargetLocation) - populate(objectMap, "snapshotRestoreParameters", a.SnapshotRestoreParameters) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - populate(objectMap, "targetInfo", a.TargetInfo) - populate(objectMap, "targetResourceGroupName", a.TargetResourceGroupName) - populate(objectMap, "targetVirtualMachineId", a.TargetVirtualMachineID) - populate(objectMap, "userAssignedManagedIdentityDetails", a.UserAssignedManagedIdentityDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWorkloadSQLRestoreWithRehydrateRequest. -func (a *AzureWorkloadSQLRestoreWithRehydrateRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alternateDirectoryPaths": - err = unpopulate(val, "AlternateDirectoryPaths", &a.AlternateDirectoryPaths) - delete(rawMsg, key) - case "isNonRecoverable": - err = unpopulate(val, "IsNonRecoverable", &a.IsNonRecoverable) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &a.PropertyBag) - delete(rawMsg, key) - case "recoveryMode": - err = unpopulate(val, "RecoveryMode", &a.RecoveryMode) - delete(rawMsg, key) - case "recoveryPointRehydrationInfo": - err = unpopulate(val, "RecoveryPointRehydrationInfo", &a.RecoveryPointRehydrationInfo) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &a.RecoveryType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &a.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "shouldUseAlternateTargetLocation": - err = unpopulate(val, "ShouldUseAlternateTargetLocation", &a.ShouldUseAlternateTargetLocation) - delete(rawMsg, key) - case "snapshotRestoreParameters": - err = unpopulate(val, "SnapshotRestoreParameters", &a.SnapshotRestoreParameters) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - case "targetInfo": - err = unpopulate(val, "TargetInfo", &a.TargetInfo) - delete(rawMsg, key) - case "targetResourceGroupName": - err = unpopulate(val, "TargetResourceGroupName", &a.TargetResourceGroupName) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &a.TargetVirtualMachineID) - delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &a.UserAssignedManagedIdentityDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BEKDetails. -func (b BEKDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "secretData", b.SecretData) - populate(objectMap, "secretUrl", b.SecretURL) - populate(objectMap, "secretVaultId", b.SecretVaultID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BEKDetails. -func (b *BEKDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "secretData": - err = unpopulate(val, "SecretData", &b.SecretData) - delete(rawMsg, key) - case "secretUrl": - err = unpopulate(val, "SecretURL", &b.SecretURL) - delete(rawMsg, key) - case "secretVaultId": - err = unpopulate(val, "SecretVaultID", &b.SecretVaultID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSBackupEngineQueryObject. -func (b BMSBackupEngineQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "expand", b.Expand) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSBackupEngineQueryObject. -func (b *BMSBackupEngineQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expand": - err = unpopulate(val, "Expand", &b.Expand) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSBackupEnginesQueryObject. -func (b BMSBackupEnginesQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", b.BackupManagementType) - populate(objectMap, "expand", b.Expand) - populate(objectMap, "friendlyName", b.FriendlyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSBackupEnginesQueryObject. -func (b *BMSBackupEnginesQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) - delete(rawMsg, key) - case "expand": - err = unpopulate(val, "Expand", &b.Expand) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &b.FriendlyName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSBackupSummariesQueryObject. -func (b BMSBackupSummariesQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSBackupSummariesQueryObject. -func (b *BMSBackupSummariesQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSContainerQueryObject. -func (b BMSContainerQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupEngineName", b.BackupEngineName) - populate(objectMap, "backupManagementType", b.BackupManagementType) - populate(objectMap, "containerType", b.ContainerType) - populate(objectMap, "fabricName", b.FabricName) - populate(objectMap, "friendlyName", b.FriendlyName) - populate(objectMap, "status", b.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSContainerQueryObject. -func (b *BMSContainerQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupEngineName": - err = unpopulate(val, "BackupEngineName", &b.BackupEngineName) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &b.ContainerType) - delete(rawMsg, key) - case "fabricName": - err = unpopulate(val, "FabricName", &b.FabricName) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &b.FriendlyName) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &b.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSContainersInquiryQueryObject. -func (b BMSContainersInquiryQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", b.BackupManagementType) - populate(objectMap, "workloadType", b.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSContainersInquiryQueryObject. -func (b *BMSContainersInquiryQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &b.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSPOQueryObject. -func (b BMSPOQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", b.BackupManagementType) - populate(objectMap, "containerName", b.ContainerName) - populate(objectMap, "friendlyName", b.FriendlyName) - populate(objectMap, "status", b.Status) - populate(objectMap, "workloadType", b.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSPOQueryObject. -func (b *BMSPOQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &b.ContainerName) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &b.FriendlyName) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &b.Status) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &b.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSRPQueryObject. -func (b BMSRPQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endDate", b.EndDate) - populate(objectMap, "extendedInfo", b.ExtendedInfo) - populate(objectMap, "includeSoftDeletedRP", b.IncludeSoftDeletedRP) - populate(objectMap, "moveReadyRPOnly", b.MoveReadyRPOnly) - populate(objectMap, "restorePointQueryType", b.RestorePointQueryType) - populateDateTimeRFC3339(objectMap, "startDate", b.StartDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSRPQueryObject. -func (b *BMSRPQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endDate": - err = unpopulateDateTimeRFC3339(val, "EndDate", &b.EndDate) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &b.ExtendedInfo) - delete(rawMsg, key) - case "includeSoftDeletedRP": - err = unpopulate(val, "IncludeSoftDeletedRP", &b.IncludeSoftDeletedRP) - delete(rawMsg, key) - case "moveReadyRPOnly": - err = unpopulate(val, "MoveReadyRPOnly", &b.MoveReadyRPOnly) - delete(rawMsg, key) - case "restorePointQueryType": - err = unpopulate(val, "RestorePointQueryType", &b.RestorePointQueryType) - delete(rawMsg, key) - case "startDate": - err = unpopulateDateTimeRFC3339(val, "StartDate", &b.StartDate) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSRefreshContainersQueryObject. -func (b BMSRefreshContainersQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", b.BackupManagementType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSRefreshContainersQueryObject. -func (b *BMSRefreshContainersQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BMSWorkloadItemQueryObject. -func (b BMSWorkloadItemQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", b.BackupManagementType) - populate(objectMap, "protectionStatus", b.ProtectionStatus) - populate(objectMap, "workloadItemType", b.WorkloadItemType) - populate(objectMap, "workloadType", b.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSWorkloadItemQueryObject. -func (b *BMSWorkloadItemQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &b.ProtectionStatus) - delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &b.WorkloadItemType) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &b.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupEngineBase. -func (b BackupEngineBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureBackupAgentVersion", b.AzureBackupAgentVersion) - populate(objectMap, "backupEngineId", b.BackupEngineID) - populate(objectMap, "backupEngineState", b.BackupEngineState) - objectMap["backupEngineType"] = b.BackupEngineType - populate(objectMap, "backupManagementType", b.BackupManagementType) - populate(objectMap, "canReRegister", b.CanReRegister) - populate(objectMap, "dpmVersion", b.DpmVersion) - populate(objectMap, "extendedInfo", b.ExtendedInfo) - populate(objectMap, "friendlyName", b.FriendlyName) - populate(objectMap, "healthStatus", b.HealthStatus) - populate(objectMap, "isAzureBackupAgentUpgradeAvailable", b.IsAzureBackupAgentUpgradeAvailable) - populate(objectMap, "isDpmUpgradeAvailable", b.IsDpmUpgradeAvailable) - populate(objectMap, "registrationStatus", b.RegistrationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupEngineBase. -func (b *BackupEngineBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureBackupAgentVersion": - err = unpopulate(val, "AzureBackupAgentVersion", &b.AzureBackupAgentVersion) - delete(rawMsg, key) - case "backupEngineId": - err = unpopulate(val, "BackupEngineID", &b.BackupEngineID) - delete(rawMsg, key) - case "backupEngineState": - err = unpopulate(val, "BackupEngineState", &b.BackupEngineState) - delete(rawMsg, key) - case "backupEngineType": - err = unpopulate(val, "BackupEngineType", &b.BackupEngineType) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) - delete(rawMsg, key) - case "canReRegister": - err = unpopulate(val, "CanReRegister", &b.CanReRegister) - delete(rawMsg, key) - case "dpmVersion": - err = unpopulate(val, "DpmVersion", &b.DpmVersion) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &b.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &b.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &b.HealthStatus) - delete(rawMsg, key) - case "isAzureBackupAgentUpgradeAvailable": - err = unpopulate(val, "IsAzureBackupAgentUpgradeAvailable", &b.IsAzureBackupAgentUpgradeAvailable) - delete(rawMsg, key) - case "isDpmUpgradeAvailable": - err = unpopulate(val, "IsDpmUpgradeAvailable", &b.IsDpmUpgradeAvailable) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &b.RegistrationStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupEngineBaseResource. -func (b BackupEngineBaseResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupEngineBaseResource. -func (b *BackupEngineBaseResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &b.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &b.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - b.Properties, err = unmarshalBackupEngineBaseClassification(val) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &b.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupEngineBaseResourceList. -func (b BackupEngineBaseResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", b.NextLink) - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupEngineBaseResourceList. -func (b *BackupEngineBaseResourceList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &b.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &b.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupEngineExtendedInfo. -func (b BackupEngineExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "availableDiskSpace", b.AvailableDiskSpace) - populate(objectMap, "azureProtectedInstances", b.AzureProtectedInstances) - populate(objectMap, "databaseName", b.DatabaseName) - populate(objectMap, "diskCount", b.DiskCount) - populate(objectMap, "protectedItemsCount", b.ProtectedItemsCount) - populate(objectMap, "protectedServersCount", b.ProtectedServersCount) - populateDateTimeRFC3339(objectMap, "refreshedAt", b.RefreshedAt) - populate(objectMap, "usedDiskSpace", b.UsedDiskSpace) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupEngineExtendedInfo. -func (b *BackupEngineExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "availableDiskSpace": - err = unpopulate(val, "AvailableDiskSpace", &b.AvailableDiskSpace) - delete(rawMsg, key) - case "azureProtectedInstances": - err = unpopulate(val, "AzureProtectedInstances", &b.AzureProtectedInstances) - delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, "DatabaseName", &b.DatabaseName) - delete(rawMsg, key) - case "diskCount": - err = unpopulate(val, "DiskCount", &b.DiskCount) - delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &b.ProtectedItemsCount) - delete(rawMsg, key) - case "protectedServersCount": - err = unpopulate(val, "ProtectedServersCount", &b.ProtectedServersCount) - delete(rawMsg, key) - case "refreshedAt": - err = unpopulateDateTimeRFC3339(val, "RefreshedAt", &b.RefreshedAt) - delete(rawMsg, key) - case "usedDiskSpace": - err = unpopulate(val, "UsedDiskSpace", &b.UsedDiskSpace) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupManagementUsage. -func (b BackupManagementUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "currentValue", b.CurrentValue) - populate(objectMap, "limit", b.Limit) - populate(objectMap, "name", b.Name) - populateDateTimeRFC3339(objectMap, "nextResetTime", b.NextResetTime) - populate(objectMap, "quotaPeriod", b.QuotaPeriod) - populate(objectMap, "unit", b.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupManagementUsage. -func (b *BackupManagementUsage) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &b.CurrentValue) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &b.Limit) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "nextResetTime": - err = unpopulateDateTimeRFC3339(val, "NextResetTime", &b.NextResetTime) - delete(rawMsg, key) - case "quotaPeriod": - err = unpopulate(val, "QuotaPeriod", &b.QuotaPeriod) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &b.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupManagementUsageList. -func (b BackupManagementUsageList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupManagementUsageList. -func (b *BackupManagementUsageList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &b.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupRequest. -func (b BackupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = b.ObjectType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRequest. -func (b *BackupRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &b.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupRequestResource. -func (b BackupRequestResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRequestResource. -func (b *BackupRequestResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &b.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &b.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - b.Properties, err = unmarshalBackupRequestClassification(val) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &b.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceConfig. -func (b BackupResourceConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "crossRegionRestoreFlag", b.CrossRegionRestoreFlag) - populate(objectMap, "dedupState", b.DedupState) - populate(objectMap, "storageModelType", b.StorageModelType) - populate(objectMap, "storageType", b.StorageType) - populate(objectMap, "storageTypeState", b.StorageTypeState) - populate(objectMap, "xcoolState", b.XcoolState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceConfig. -func (b *BackupResourceConfig) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "crossRegionRestoreFlag": - err = unpopulate(val, "CrossRegionRestoreFlag", &b.CrossRegionRestoreFlag) - delete(rawMsg, key) - case "dedupState": - err = unpopulate(val, "DedupState", &b.DedupState) - delete(rawMsg, key) - case "storageModelType": - err = unpopulate(val, "StorageModelType", &b.StorageModelType) - delete(rawMsg, key) - case "storageType": - err = unpopulate(val, "StorageType", &b.StorageType) - delete(rawMsg, key) - case "storageTypeState": - err = unpopulate(val, "StorageTypeState", &b.StorageTypeState) - delete(rawMsg, key) - case "xcoolState": - err = unpopulate(val, "XcoolState", &b.XcoolState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceConfigResource. -func (b BackupResourceConfigResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceConfigResource. -func (b *BackupResourceConfigResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &b.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &b.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &b.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceEncryptionConfig. -func (b BackupResourceEncryptionConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "encryptionAtRestType", b.EncryptionAtRestType) - populate(objectMap, "infrastructureEncryptionState", b.InfrastructureEncryptionState) - populate(objectMap, "keyUri", b.KeyURI) - populate(objectMap, "lastUpdateStatus", b.LastUpdateStatus) - populate(objectMap, "subscriptionId", b.SubscriptionID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceEncryptionConfig. -func (b *BackupResourceEncryptionConfig) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "encryptionAtRestType": - err = unpopulate(val, "EncryptionAtRestType", &b.EncryptionAtRestType) - delete(rawMsg, key) - case "infrastructureEncryptionState": - err = unpopulate(val, "InfrastructureEncryptionState", &b.InfrastructureEncryptionState) - delete(rawMsg, key) - case "keyUri": - err = unpopulate(val, "KeyURI", &b.KeyURI) - delete(rawMsg, key) - case "lastUpdateStatus": - err = unpopulate(val, "LastUpdateStatus", &b.LastUpdateStatus) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &b.SubscriptionID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceEncryptionConfigExtended. -func (b BackupResourceEncryptionConfigExtended) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "encryptionAtRestType", b.EncryptionAtRestType) - populate(objectMap, "infrastructureEncryptionState", b.InfrastructureEncryptionState) - populate(objectMap, "keyUri", b.KeyURI) - populate(objectMap, "lastUpdateStatus", b.LastUpdateStatus) - populate(objectMap, "subscriptionId", b.SubscriptionID) - populate(objectMap, "useSystemAssignedIdentity", b.UseSystemAssignedIdentity) - populate(objectMap, "userAssignedIdentity", b.UserAssignedIdentity) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceEncryptionConfigExtended. -func (b *BackupResourceEncryptionConfigExtended) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "encryptionAtRestType": - err = unpopulate(val, "EncryptionAtRestType", &b.EncryptionAtRestType) - delete(rawMsg, key) - case "infrastructureEncryptionState": - err = unpopulate(val, "InfrastructureEncryptionState", &b.InfrastructureEncryptionState) - delete(rawMsg, key) - case "keyUri": - err = unpopulate(val, "KeyURI", &b.KeyURI) - delete(rawMsg, key) - case "lastUpdateStatus": - err = unpopulate(val, "LastUpdateStatus", &b.LastUpdateStatus) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &b.SubscriptionID) - delete(rawMsg, key) - case "useSystemAssignedIdentity": - err = unpopulate(val, "UseSystemAssignedIdentity", &b.UseSystemAssignedIdentity) - delete(rawMsg, key) - case "userAssignedIdentity": - err = unpopulate(val, "UserAssignedIdentity", &b.UserAssignedIdentity) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceEncryptionConfigExtendedResource. -func (b BackupResourceEncryptionConfigExtendedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceEncryptionConfigExtendedResource. -func (b *BackupResourceEncryptionConfigExtendedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &b.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &b.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &b.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceEncryptionConfigResource. -func (b BackupResourceEncryptionConfigResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceEncryptionConfigResource. -func (b *BackupResourceEncryptionConfigResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &b.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &b.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &b.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceVaultConfig. -func (b BackupResourceVaultConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enhancedSecurityState", b.EnhancedSecurityState) - populate(objectMap, "isSoftDeleteFeatureStateEditable", b.IsSoftDeleteFeatureStateEditable) - populate(objectMap, "resourceGuardOperationRequests", b.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteFeatureState", b.SoftDeleteFeatureState) - populate(objectMap, "softDeleteRetentionPeriodInDays", b.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "storageModelType", b.StorageModelType) - populate(objectMap, "storageType", b.StorageType) - populate(objectMap, "storageTypeState", b.StorageTypeState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceVaultConfig. -func (b *BackupResourceVaultConfig) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "enhancedSecurityState": - err = unpopulate(val, "EnhancedSecurityState", &b.EnhancedSecurityState) - delete(rawMsg, key) - case "isSoftDeleteFeatureStateEditable": - err = unpopulate(val, "IsSoftDeleteFeatureStateEditable", &b.IsSoftDeleteFeatureStateEditable) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &b.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "softDeleteFeatureState": - err = unpopulate(val, "SoftDeleteFeatureState", &b.SoftDeleteFeatureState) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &b.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "storageModelType": - err = unpopulate(val, "StorageModelType", &b.StorageModelType) - delete(rawMsg, key) - case "storageType": - err = unpopulate(val, "StorageType", &b.StorageType) - delete(rawMsg, key) - case "storageTypeState": - err = unpopulate(val, "StorageTypeState", &b.StorageTypeState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupResourceVaultConfigResource. -func (b BackupResourceVaultConfigResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceVaultConfigResource. -func (b *BackupResourceVaultConfigResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &b.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &b.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &b.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupStatusRequest. -func (b BackupStatusRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "poLogicalName", b.PoLogicalName) - populate(objectMap, "resourceId", b.ResourceID) - populate(objectMap, "resourceType", b.ResourceType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupStatusRequest. -func (b *BackupStatusRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "poLogicalName": - err = unpopulate(val, "PoLogicalName", &b.PoLogicalName) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &b.ResourceID) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &b.ResourceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupStatusResponse. -func (b BackupStatusResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "acquireStorageAccountLock", b.AcquireStorageAccountLock) - populate(objectMap, "containerName", b.ContainerName) - populate(objectMap, "errorCode", b.ErrorCode) - populate(objectMap, "errorMessage", b.ErrorMessage) - populate(objectMap, "fabricName", b.FabricName) - populate(objectMap, "policyName", b.PolicyName) - populate(objectMap, "protectedItemName", b.ProtectedItemName) - populate(objectMap, "protectedItemsCount", b.ProtectedItemsCount) - populate(objectMap, "protectionStatus", b.ProtectionStatus) - populate(objectMap, "registrationStatus", b.RegistrationStatus) - populate(objectMap, "vaultId", b.VaultID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupStatusResponse. -func (b *BackupStatusResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "acquireStorageAccountLock": - err = unpopulate(val, "AcquireStorageAccountLock", &b.AcquireStorageAccountLock) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &b.ContainerName) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &b.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &b.ErrorMessage) - delete(rawMsg, key) - case "fabricName": - err = unpopulate(val, "FabricName", &b.FabricName) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &b.PolicyName) - delete(rawMsg, key) - case "protectedItemName": - err = unpopulate(val, "ProtectedItemName", &b.ProtectedItemName) - delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &b.ProtectedItemsCount) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &b.ProtectionStatus) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &b.RegistrationStatus) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &b.VaultID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryDisplay. -func (c ClientDiscoveryDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - populate(objectMap, "operation", c.Operation) - populate(objectMap, "provider", c.Provider) - populate(objectMap, "resource", c.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryDisplay. -func (c *ClientDiscoveryDisplay) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &c.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &c.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &c.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForLogSpecification. -func (c ClientDiscoveryForLogSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "blobDuration", c.BlobDuration) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "name", c.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryForLogSpecification. -func (c *ClientDiscoveryForLogSpecification) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "blobDuration": - err = unpopulate(val, "BlobDuration", &c.BlobDuration) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForProperties. -func (c ClientDiscoveryForProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "serviceSpecification", c.ServiceSpecification) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryForProperties. -func (c *ClientDiscoveryForProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "serviceSpecification": - err = unpopulate(val, "ServiceSpecification", &c.ServiceSpecification) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForServiceSpecification. -func (c ClientDiscoveryForServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "logSpecifications", c.LogSpecifications) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryForServiceSpecification. -func (c *ClientDiscoveryForServiceSpecification) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "logSpecifications": - err = unpopulate(val, "LogSpecifications", &c.LogSpecifications) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryResponse. -func (c ClientDiscoveryResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryResponse. -func (c *ClientDiscoveryResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryValueForSingleAPI. -func (c ClientDiscoveryValueForSingleAPI) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", c.Display) - populate(objectMap, "name", c.Name) - populate(objectMap, "origin", c.Origin) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryValueForSingleAPI. -func (c *ClientDiscoveryValueForSingleAPI) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &c.Display) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &c.Origin) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientScriptForConnect. -func (c ClientScriptForConnect) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "osType", c.OSType) - populate(objectMap, "scriptContent", c.ScriptContent) - populate(objectMap, "scriptExtension", c.ScriptExtension) - populate(objectMap, "scriptNameSuffix", c.ScriptNameSuffix) - populate(objectMap, "url", c.URL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientScriptForConnect. -func (c *ClientScriptForConnect) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "osType": - err = unpopulate(val, "OSType", &c.OSType) - delete(rawMsg, key) - case "scriptContent": - err = unpopulate(val, "ScriptContent", &c.ScriptContent) - delete(rawMsg, key) - case "scriptExtension": - err = unpopulate(val, "ScriptExtension", &c.ScriptExtension) - delete(rawMsg, key) - case "scriptNameSuffix": - err = unpopulate(val, "ScriptNameSuffix", &c.ScriptNameSuffix) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &c.URL) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerIdentityInfo. -func (c ContainerIdentityInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aadTenantId", c.AADTenantID) - populate(objectMap, "audience", c.Audience) - populate(objectMap, "servicePrincipalClientId", c.ServicePrincipalClientID) - populate(objectMap, "uniqueName", c.UniqueName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerIdentityInfo. -func (c *ContainerIdentityInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aadTenantId": - err = unpopulate(val, "AADTenantID", &c.AADTenantID) - delete(rawMsg, key) - case "audience": - err = unpopulate(val, "Audience", &c.Audience) - delete(rawMsg, key) - case "servicePrincipalClientId": - err = unpopulate(val, "ServicePrincipalClientID", &c.ServicePrincipalClientID) - delete(rawMsg, key) - case "uniqueName": - err = unpopulate(val, "UniqueName", &c.UniqueName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DPMContainerExtendedInfo. -func (d DPMContainerExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "lastRefreshedAt", d.LastRefreshedAt) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DPMContainerExtendedInfo. -func (d *DPMContainerExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "lastRefreshedAt": - err = unpopulateDateTimeRFC3339(val, "LastRefreshedAt", &d.LastRefreshedAt) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DPMProtectedItem. -func (d DPMProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupEngineName", d.BackupEngineName) - populate(objectMap, "backupManagementType", d.BackupManagementType) - populate(objectMap, "backupSetName", d.BackupSetName) - populate(objectMap, "containerName", d.ContainerName) - populate(objectMap, "createMode", d.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", d.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", d.DeferredDeleteTimeRemaining) - populate(objectMap, "extendedInfo", d.ExtendedInfo) - populate(objectMap, "friendlyName", d.FriendlyName) - populate(objectMap, "isArchiveEnabled", d.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", d.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", d.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", d.IsScheduledForDeferredDelete) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", d.LastRecoveryPoint) - populate(objectMap, "policyId", d.PolicyID) - populate(objectMap, "policyName", d.PolicyName) - objectMap["protectedItemType"] = "DPMProtectedItem" - populate(objectMap, "protectionState", d.ProtectionState) - populate(objectMap, "resourceGuardOperationRequests", d.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", d.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", d.SourceResourceID) - populate(objectMap, "vaultId", d.VaultID) - populate(objectMap, "workloadType", d.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DPMProtectedItem. -func (d *DPMProtectedItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupEngineName": - err = unpopulate(val, "BackupEngineName", &d.BackupEngineName) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &d.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &d.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &d.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &d.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &d.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &d.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &d.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &d.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &d.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &d.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &d.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &d.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &d.LastRecoveryPoint) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &d.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &d.PolicyName) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &d.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &d.ProtectionState) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &d.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &d.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &d.SourceResourceID) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &d.VaultID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &d.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DPMProtectedItemExtendedInfo. -func (d DPMProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "diskStorageUsedInBytes", d.DiskStorageUsedInBytes) - populate(objectMap, "isCollocated", d.IsCollocated) - populate(objectMap, "isPresentOnCloud", d.IsPresentOnCloud) - populate(objectMap, "lastBackupStatus", d.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastRefreshedAt", d.LastRefreshedAt) - populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", d.OldestRecoveryPoint) - populateDateTimeRFC3339(objectMap, "onPremiseLatestRecoveryPoint", d.OnPremiseLatestRecoveryPoint) - populateDateTimeRFC3339(objectMap, "onPremiseOldestRecoveryPoint", d.OnPremiseOldestRecoveryPoint) - populate(objectMap, "onPremiseRecoveryPointCount", d.OnPremiseRecoveryPointCount) - populate(objectMap, "protectableObjectLoadPath", d.ProtectableObjectLoadPath) - populate(objectMap, "protected", d.Protected) - populate(objectMap, "protectionGroupName", d.ProtectionGroupName) - populate(objectMap, "recoveryPointCount", d.RecoveryPointCount) - populate(objectMap, "totalDiskStorageSizeInBytes", d.TotalDiskStorageSizeInBytes) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DPMProtectedItemExtendedInfo. -func (d *DPMProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "diskStorageUsedInBytes": - err = unpopulate(val, "DiskStorageUsedInBytes", &d.DiskStorageUsedInBytes) - delete(rawMsg, key) - case "isCollocated": - err = unpopulate(val, "IsCollocated", &d.IsCollocated) - delete(rawMsg, key) - case "isPresentOnCloud": - err = unpopulate(val, "IsPresentOnCloud", &d.IsPresentOnCloud) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &d.LastBackupStatus) - delete(rawMsg, key) - case "lastRefreshedAt": - err = unpopulateDateTimeRFC3339(val, "LastRefreshedAt", &d.LastRefreshedAt) - delete(rawMsg, key) - case "oldestRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPoint", &d.OldestRecoveryPoint) - delete(rawMsg, key) - case "onPremiseLatestRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "OnPremiseLatestRecoveryPoint", &d.OnPremiseLatestRecoveryPoint) - delete(rawMsg, key) - case "onPremiseOldestRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "OnPremiseOldestRecoveryPoint", &d.OnPremiseOldestRecoveryPoint) - delete(rawMsg, key) - case "onPremiseRecoveryPointCount": - err = unpopulate(val, "OnPremiseRecoveryPointCount", &d.OnPremiseRecoveryPointCount) - delete(rawMsg, key) - case "protectableObjectLoadPath": - err = unpopulate(val, "ProtectableObjectLoadPath", &d.ProtectableObjectLoadPath) - delete(rawMsg, key) - case "protected": - err = unpopulate(val, "Protected", &d.Protected) - delete(rawMsg, key) - case "protectionGroupName": - err = unpopulate(val, "ProtectionGroupName", &d.ProtectionGroupName) - delete(rawMsg, key) - case "recoveryPointCount": - err = unpopulate(val, "RecoveryPointCount", &d.RecoveryPointCount) - delete(rawMsg, key) - case "totalDiskStorageSizeInBytes": - err = unpopulate(val, "TotalDiskStorageSizeInBytes", &d.TotalDiskStorageSizeInBytes) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DailyRetentionFormat. -func (d DailyRetentionFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "daysOfTheMonth", d.DaysOfTheMonth) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DailyRetentionFormat. -func (d *DailyRetentionFormat) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "daysOfTheMonth": - err = unpopulate(val, "DaysOfTheMonth", &d.DaysOfTheMonth) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DailyRetentionSchedule. -func (d DailyRetentionSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "retentionDuration", d.RetentionDuration) - aux := make([]*dateTimeRFC3339, len(d.RetentionTimes), len(d.RetentionTimes)) - for i := 0; i < len(d.RetentionTimes); i++ { - aux[i] = (*dateTimeRFC3339)(d.RetentionTimes[i]) - } - populate(objectMap, "retentionTimes", aux) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DailyRetentionSchedule. -func (d *DailyRetentionSchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "retentionDuration": - err = unpopulate(val, "RetentionDuration", &d.RetentionDuration) - delete(rawMsg, key) - case "retentionTimes": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "RetentionTimes", &aux) - for _, au := range aux { - d.RetentionTimes = append(d.RetentionTimes, (*time.Time)(au)) - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DailySchedule. -func (d DailySchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - aux := make([]*dateTimeRFC3339, len(d.ScheduleRunTimes), len(d.ScheduleRunTimes)) - for i := 0; i < len(d.ScheduleRunTimes); i++ { - aux[i] = (*dateTimeRFC3339)(d.ScheduleRunTimes[i]) - } - populate(objectMap, "scheduleRunTimes", aux) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DailySchedule. -func (d *DailySchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "scheduleRunTimes": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "ScheduleRunTimes", &aux) - for _, au := range aux { - d.ScheduleRunTimes = append(d.ScheduleRunTimes, (*time.Time)(au)) - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Day. -func (d Day) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "date", d.Date) - populate(objectMap, "isLast", d.IsLast) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Day. -func (d *Day) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "date": - err = unpopulate(val, "Date", &d.Date) - delete(rawMsg, key) - case "isLast": - err = unpopulate(val, "IsLast", &d.IsLast) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiskExclusionProperties. -func (d DiskExclusionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "diskLunList", d.DiskLunList) - populate(objectMap, "isInclusionList", d.IsInclusionList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiskExclusionProperties. -func (d *DiskExclusionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "diskLunList": - err = unpopulate(val, "DiskLunList", &d.DiskLunList) - delete(rawMsg, key) - case "isInclusionList": - err = unpopulate(val, "IsInclusionList", &d.IsInclusionList) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiskInformation. -func (d DiskInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "lun", d.Lun) - populate(objectMap, "name", d.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiskInformation. -func (d *DiskInformation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "lun": - err = unpopulate(val, "Lun", &d.Lun) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DistributedNodesInfo. -func (d DistributedNodesInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "errorDetail", d.ErrorDetail) - populate(objectMap, "nodeName", d.NodeName) - populate(objectMap, "sourceResourceId", d.SourceResourceID) - populate(objectMap, "status", d.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedNodesInfo. -func (d *DistributedNodesInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "errorDetail": - err = unpopulate(val, "ErrorDetail", &d.ErrorDetail) - delete(rawMsg, key) - case "nodeName": - err = unpopulate(val, "NodeName", &d.NodeName) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &d.SourceResourceID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &d.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DpmBackupEngine. -func (d DpmBackupEngine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureBackupAgentVersion", d.AzureBackupAgentVersion) - populate(objectMap, "backupEngineId", d.BackupEngineID) - populate(objectMap, "backupEngineState", d.BackupEngineState) - objectMap["backupEngineType"] = BackupEngineTypeDpmBackupEngine - populate(objectMap, "backupManagementType", d.BackupManagementType) - populate(objectMap, "canReRegister", d.CanReRegister) - populate(objectMap, "dpmVersion", d.DpmVersion) - populate(objectMap, "extendedInfo", d.ExtendedInfo) - populate(objectMap, "friendlyName", d.FriendlyName) - populate(objectMap, "healthStatus", d.HealthStatus) - populate(objectMap, "isAzureBackupAgentUpgradeAvailable", d.IsAzureBackupAgentUpgradeAvailable) - populate(objectMap, "isDpmUpgradeAvailable", d.IsDpmUpgradeAvailable) - populate(objectMap, "registrationStatus", d.RegistrationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DpmBackupEngine. -func (d *DpmBackupEngine) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureBackupAgentVersion": - err = unpopulate(val, "AzureBackupAgentVersion", &d.AzureBackupAgentVersion) - delete(rawMsg, key) - case "backupEngineId": - err = unpopulate(val, "BackupEngineID", &d.BackupEngineID) - delete(rawMsg, key) - case "backupEngineState": - err = unpopulate(val, "BackupEngineState", &d.BackupEngineState) - delete(rawMsg, key) - case "backupEngineType": - err = unpopulate(val, "BackupEngineType", &d.BackupEngineType) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &d.BackupManagementType) - delete(rawMsg, key) - case "canReRegister": - err = unpopulate(val, "CanReRegister", &d.CanReRegister) - delete(rawMsg, key) - case "dpmVersion": - err = unpopulate(val, "DpmVersion", &d.DpmVersion) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &d.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &d.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &d.HealthStatus) - delete(rawMsg, key) - case "isAzureBackupAgentUpgradeAvailable": - err = unpopulate(val, "IsAzureBackupAgentUpgradeAvailable", &d.IsAzureBackupAgentUpgradeAvailable) - delete(rawMsg, key) - case "isDpmUpgradeAvailable": - err = unpopulate(val, "IsDpmUpgradeAvailable", &d.IsDpmUpgradeAvailable) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &d.RegistrationStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DpmContainer. -func (d DpmContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", d.BackupManagementType) - populate(objectMap, "canReRegister", d.CanReRegister) - populate(objectMap, "containerId", d.ContainerID) - objectMap["containerType"] = ProtectableContainerTypeDPMContainer - populate(objectMap, "dpmAgentVersion", d.DpmAgentVersion) - populate(objectMap, "dpmServers", d.DpmServers) - populate(objectMap, "extendedInfo", d.ExtendedInfo) - populate(objectMap, "friendlyName", d.FriendlyName) - populate(objectMap, "healthStatus", d.HealthStatus) - populate(objectMap, "protectableObjectType", d.ProtectableObjectType) - populate(objectMap, "protectedItemCount", d.ProtectedItemCount) - populate(objectMap, "protectionStatus", d.ProtectionStatus) - populate(objectMap, "registrationStatus", d.RegistrationStatus) - populate(objectMap, "upgradeAvailable", d.UpgradeAvailable) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DpmContainer. -func (d *DpmContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &d.BackupManagementType) - delete(rawMsg, key) - case "canReRegister": - err = unpopulate(val, "CanReRegister", &d.CanReRegister) - delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &d.ContainerID) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &d.ContainerType) - delete(rawMsg, key) - case "dpmAgentVersion": - err = unpopulate(val, "DpmAgentVersion", &d.DpmAgentVersion) - delete(rawMsg, key) - case "dpmServers": - err = unpopulate(val, "DpmServers", &d.DpmServers) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &d.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &d.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &d.HealthStatus) - delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &d.ProtectableObjectType) - delete(rawMsg, key) - case "protectedItemCount": - err = unpopulate(val, "ProtectedItemCount", &d.ProtectedItemCount) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &d.ProtectionStatus) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &d.RegistrationStatus) - delete(rawMsg, key) - case "upgradeAvailable": - err = unpopulate(val, "UpgradeAvailable", &d.UpgradeAvailable) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DpmErrorInfo. -func (d DpmErrorInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "errorString", d.ErrorString) - populate(objectMap, "recommendations", d.Recommendations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DpmErrorInfo. -func (d *DpmErrorInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "errorString": - err = unpopulate(val, "ErrorString", &d.ErrorString) - delete(rawMsg, key) - case "recommendations": - err = unpopulate(val, "Recommendations", &d.Recommendations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DpmJob. -func (d DpmJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionsInfo", d.ActionsInfo) - populate(objectMap, "activityId", d.ActivityID) - populate(objectMap, "backupManagementType", d.BackupManagementType) - populate(objectMap, "containerName", d.ContainerName) - populate(objectMap, "containerType", d.ContainerType) - populate(objectMap, "dpmServerName", d.DpmServerName) - populate(objectMap, "duration", d.Duration) - populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) - populate(objectMap, "entityFriendlyName", d.EntityFriendlyName) - populate(objectMap, "errorDetails", d.ErrorDetails) - populate(objectMap, "extendedInfo", d.ExtendedInfo) - objectMap["jobType"] = "DpmJob" - populate(objectMap, "operation", d.Operation) - populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) - populate(objectMap, "status", d.Status) - populate(objectMap, "workloadType", d.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DpmJob. -func (d *DpmJob) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsInfo": - err = unpopulate(val, "ActionsInfo", &d.ActionsInfo) - delete(rawMsg, key) - case "activityId": - err = unpopulate(val, "ActivityID", &d.ActivityID) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &d.BackupManagementType) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &d.ContainerName) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &d.ContainerType) - delete(rawMsg, key) - case "dpmServerName": - err = unpopulate(val, "DpmServerName", &d.DpmServerName) - delete(rawMsg, key) - case "duration": - err = unpopulate(val, "Duration", &d.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) - delete(rawMsg, key) - case "entityFriendlyName": - err = unpopulate(val, "EntityFriendlyName", &d.EntityFriendlyName) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &d.ErrorDetails) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &d.ExtendedInfo) - delete(rawMsg, key) - case "jobType": - err = unpopulate(val, "JobType", &d.JobType) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &d.Operation) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &d.Status) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &d.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DpmJobExtendedInfo. -func (d DpmJobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dynamicErrorMessage", d.DynamicErrorMessage) - populate(objectMap, "propertyBag", d.PropertyBag) - populate(objectMap, "tasksList", d.TasksList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DpmJobExtendedInfo. -func (d *DpmJobExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dynamicErrorMessage": - err = unpopulate(val, "DynamicErrorMessage", &d.DynamicErrorMessage) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &d.PropertyBag) - delete(rawMsg, key) - case "tasksList": - err = unpopulate(val, "TasksList", &d.TasksList) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DpmJobTaskDetails. -func (d DpmJobTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "duration", d.Duration) - populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) - populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) - populate(objectMap, "status", d.Status) - populate(objectMap, "taskId", d.TaskID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DpmJobTaskDetails. -func (d *DpmJobTaskDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, "Duration", &d.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &d.Status) - delete(rawMsg, key) - case "taskId": - err = unpopulate(val, "TaskID", &d.TaskID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EncryptionDetails. -func (e EncryptionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "encryptionEnabled", e.EncryptionEnabled) - populate(objectMap, "kekUrl", e.KekURL) - populate(objectMap, "kekVaultId", e.KekVaultID) - populate(objectMap, "secretKeyUrl", e.SecretKeyURL) - populate(objectMap, "secretKeyVaultId", e.SecretKeyVaultID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionDetails. -func (e *EncryptionDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "encryptionEnabled": - err = unpopulate(val, "EncryptionEnabled", &e.EncryptionEnabled) - delete(rawMsg, key) - case "kekUrl": - err = unpopulate(val, "KekURL", &e.KekURL) - delete(rawMsg, key) - case "kekVaultId": - err = unpopulate(val, "KekVaultID", &e.KekVaultID) - delete(rawMsg, key) - case "secretKeyUrl": - err = unpopulate(val, "SecretKeyURL", &e.SecretKeyURL) - delete(rawMsg, key) - case "secretKeyVaultId": - err = unpopulate(val, "SecretKeyVaultID", &e.SecretKeyVaultID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - populate(objectMap, "recommendations", e.Recommendations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "recommendations": - err = unpopulate(val, "Recommendations", &e.Recommendations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExportJobsOperationResultInfo. -func (e ExportJobsOperationResultInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "blobSasKey", e.BlobSasKey) - populate(objectMap, "blobUrl", e.BlobURL) - populate(objectMap, "excelFileBlobSasKey", e.ExcelFileBlobSasKey) - populate(objectMap, "excelFileBlobUrl", e.ExcelFileBlobURL) - objectMap["objectType"] = "ExportJobsOperationResultInfo" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportJobsOperationResultInfo. -func (e *ExportJobsOperationResultInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "blobSasKey": - err = unpopulate(val, "BlobSasKey", &e.BlobSasKey) - delete(rawMsg, key) - case "blobUrl": - err = unpopulate(val, "BlobURL", &e.BlobURL) - delete(rawMsg, key) - case "excelFileBlobSasKey": - err = unpopulate(val, "ExcelFileBlobSasKey", &e.ExcelFileBlobSasKey) - delete(rawMsg, key) - case "excelFileBlobUrl": - err = unpopulate(val, "ExcelFileBlobURL", &e.ExcelFileBlobURL) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &e.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. -func (e ExtendedLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. -func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtendedProperties. -func (e ExtendedProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "diskExclusionProperties", e.DiskExclusionProperties) - populate(objectMap, "linuxVmApplicationName", e.LinuxVMApplicationName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedProperties. -func (e *ExtendedProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "diskExclusionProperties": - err = unpopulate(val, "DiskExclusionProperties", &e.DiskExclusionProperties) - delete(rawMsg, key) - case "linuxVmApplicationName": - err = unpopulate(val, "LinuxVMApplicationName", &e.LinuxVMApplicationName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FeatureSupportRequest. -func (f FeatureSupportRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["featureType"] = f.FeatureType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureSupportRequest. -func (f *FeatureSupportRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "featureType": - err = unpopulate(val, "FeatureType", &f.FeatureType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FetchTieringCostInfoForRehydrationRequest. -func (f FetchTieringCostInfoForRehydrationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "containerName", f.ContainerName) - objectMap["objectType"] = "FetchTieringCostInfoForRehydrationRequest" - populate(objectMap, "protectedItemName", f.ProtectedItemName) - populate(objectMap, "recoveryPointId", f.RecoveryPointID) - populate(objectMap, "rehydrationPriority", f.RehydrationPriority) - populate(objectMap, "sourceTierType", f.SourceTierType) - populate(objectMap, "targetTierType", f.TargetTierType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FetchTieringCostInfoForRehydrationRequest. -func (f *FetchTieringCostInfoForRehydrationRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "containerName": - err = unpopulate(val, "ContainerName", &f.ContainerName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &f.ObjectType) - delete(rawMsg, key) - case "protectedItemName": - err = unpopulate(val, "ProtectedItemName", &f.ProtectedItemName) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &f.RecoveryPointID) - delete(rawMsg, key) - case "rehydrationPriority": - err = unpopulate(val, "RehydrationPriority", &f.RehydrationPriority) - delete(rawMsg, key) - case "sourceTierType": - err = unpopulate(val, "SourceTierType", &f.SourceTierType) - delete(rawMsg, key) - case "targetTierType": - err = unpopulate(val, "TargetTierType", &f.TargetTierType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FetchTieringCostInfoRequest. -func (f FetchTieringCostInfoRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = f.ObjectType - populate(objectMap, "sourceTierType", f.SourceTierType) - populate(objectMap, "targetTierType", f.TargetTierType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FetchTieringCostInfoRequest. -func (f *FetchTieringCostInfoRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &f.ObjectType) - delete(rawMsg, key) - case "sourceTierType": - err = unpopulate(val, "SourceTierType", &f.SourceTierType) - delete(rawMsg, key) - case "targetTierType": - err = unpopulate(val, "TargetTierType", &f.TargetTierType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FetchTieringCostSavingsInfoForPolicyRequest. -func (f FetchTieringCostSavingsInfoForPolicyRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "FetchTieringCostSavingsInfoForPolicyRequest" - populate(objectMap, "policyName", f.PolicyName) - populate(objectMap, "sourceTierType", f.SourceTierType) - populate(objectMap, "targetTierType", f.TargetTierType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FetchTieringCostSavingsInfoForPolicyRequest. -func (f *FetchTieringCostSavingsInfoForPolicyRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &f.ObjectType) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &f.PolicyName) - delete(rawMsg, key) - case "sourceTierType": - err = unpopulate(val, "SourceTierType", &f.SourceTierType) - delete(rawMsg, key) - case "targetTierType": - err = unpopulate(val, "TargetTierType", &f.TargetTierType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FetchTieringCostSavingsInfoForProtectedItemRequest. -func (f FetchTieringCostSavingsInfoForProtectedItemRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "containerName", f.ContainerName) - objectMap["objectType"] = "FetchTieringCostSavingsInfoForProtectedItemRequest" - populate(objectMap, "protectedItemName", f.ProtectedItemName) - populate(objectMap, "sourceTierType", f.SourceTierType) - populate(objectMap, "targetTierType", f.TargetTierType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FetchTieringCostSavingsInfoForProtectedItemRequest. -func (f *FetchTieringCostSavingsInfoForProtectedItemRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "containerName": - err = unpopulate(val, "ContainerName", &f.ContainerName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &f.ObjectType) - delete(rawMsg, key) - case "protectedItemName": - err = unpopulate(val, "ProtectedItemName", &f.ProtectedItemName) - delete(rawMsg, key) - case "sourceTierType": - err = unpopulate(val, "SourceTierType", &f.SourceTierType) - delete(rawMsg, key) - case "targetTierType": - err = unpopulate(val, "TargetTierType", &f.TargetTierType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FetchTieringCostSavingsInfoForVaultRequest. -func (f FetchTieringCostSavingsInfoForVaultRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "FetchTieringCostSavingsInfoForVaultRequest" - populate(objectMap, "sourceTierType", f.SourceTierType) - populate(objectMap, "targetTierType", f.TargetTierType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FetchTieringCostSavingsInfoForVaultRequest. -func (f *FetchTieringCostSavingsInfoForVaultRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &f.ObjectType) - delete(rawMsg, key) - case "sourceTierType": - err = unpopulate(val, "SourceTierType", &f.SourceTierType) - delete(rawMsg, key) - case "targetTierType": - err = unpopulate(val, "TargetTierType", &f.TargetTierType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenericContainer. -func (g GenericContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", g.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeGenericContainer - populate(objectMap, "extendedInformation", g.ExtendedInformation) - populate(objectMap, "fabricName", g.FabricName) - populate(objectMap, "friendlyName", g.FriendlyName) - populate(objectMap, "healthStatus", g.HealthStatus) - populate(objectMap, "protectableObjectType", g.ProtectableObjectType) - populate(objectMap, "registrationStatus", g.RegistrationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenericContainer. -func (g *GenericContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &g.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &g.ContainerType) - delete(rawMsg, key) - case "extendedInformation": - err = unpopulate(val, "ExtendedInformation", &g.ExtendedInformation) - delete(rawMsg, key) - case "fabricName": - err = unpopulate(val, "FabricName", &g.FabricName) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &g.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &g.HealthStatus) - delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &g.ProtectableObjectType) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &g.RegistrationStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenericContainerExtendedInfo. -func (g GenericContainerExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "containerIdentityInfo", g.ContainerIdentityInfo) - populate(objectMap, "rawCertData", g.RawCertData) - populate(objectMap, "serviceEndpoints", g.ServiceEndpoints) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenericContainerExtendedInfo. -func (g *GenericContainerExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "containerIdentityInfo": - err = unpopulate(val, "ContainerIdentityInfo", &g.ContainerIdentityInfo) - delete(rawMsg, key) - case "rawCertData": - err = unpopulate(val, "RawCertData", &g.RawCertData) - delete(rawMsg, key) - case "serviceEndpoints": - err = unpopulate(val, "ServiceEndpoints", &g.ServiceEndpoints) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenericProtectedItem. -func (g GenericProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", g.BackupManagementType) - populate(objectMap, "backupSetName", g.BackupSetName) - populate(objectMap, "containerName", g.ContainerName) - populate(objectMap, "createMode", g.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", g.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", g.DeferredDeleteTimeRemaining) - populate(objectMap, "fabricName", g.FabricName) - populate(objectMap, "friendlyName", g.FriendlyName) - populate(objectMap, "isArchiveEnabled", g.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", g.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", g.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", g.IsScheduledForDeferredDelete) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", g.LastRecoveryPoint) - populate(objectMap, "policyId", g.PolicyID) - populate(objectMap, "policyName", g.PolicyName) - populate(objectMap, "policyState", g.PolicyState) - populate(objectMap, "protectedItemId", g.ProtectedItemID) - objectMap["protectedItemType"] = "GenericProtectedItem" - populate(objectMap, "protectionState", g.ProtectionState) - populate(objectMap, "resourceGuardOperationRequests", g.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", g.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceAssociations", g.SourceAssociations) - populate(objectMap, "sourceResourceId", g.SourceResourceID) - populate(objectMap, "vaultId", g.VaultID) - populate(objectMap, "workloadType", g.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenericProtectedItem. -func (g *GenericProtectedItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &g.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &g.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &g.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &g.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &g.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &g.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "fabricName": - err = unpopulate(val, "FabricName", &g.FabricName) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &g.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &g.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &g.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &g.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &g.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &g.LastRecoveryPoint) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &g.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &g.PolicyName) - delete(rawMsg, key) - case "policyState": - err = unpopulate(val, "PolicyState", &g.PolicyState) - delete(rawMsg, key) - case "protectedItemId": - err = unpopulate(val, "ProtectedItemID", &g.ProtectedItemID) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &g.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &g.ProtectionState) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &g.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &g.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "sourceAssociations": - err = unpopulate(val, "SourceAssociations", &g.SourceAssociations) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &g.SourceResourceID) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &g.VaultID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &g.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenericProtectionPolicy. -func (g GenericProtectionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["backupManagementType"] = "GenericProtectionPolicy" - populate(objectMap, "fabricName", g.FabricName) - populate(objectMap, "protectedItemsCount", g.ProtectedItemsCount) - populate(objectMap, "resourceGuardOperationRequests", g.ResourceGuardOperationRequests) - populate(objectMap, "subProtectionPolicy", g.SubProtectionPolicy) - populate(objectMap, "timeZone", g.TimeZone) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenericProtectionPolicy. -func (g *GenericProtectionPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &g.BackupManagementType) - delete(rawMsg, key) - case "fabricName": - err = unpopulate(val, "FabricName", &g.FabricName) - delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &g.ProtectedItemsCount) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &g.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "subProtectionPolicy": - err = unpopulate(val, "SubProtectionPolicy", &g.SubProtectionPolicy) - delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &g.TimeZone) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenericRecoveryPoint. -func (g GenericRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "friendlyName", g.FriendlyName) - objectMap["objectType"] = "GenericRecoveryPoint" - populate(objectMap, "recoveryPointAdditionalInfo", g.RecoveryPointAdditionalInfo) - populate(objectMap, "recoveryPointProperties", g.RecoveryPointProperties) - populateDateTimeRFC3339(objectMap, "recoveryPointTime", g.RecoveryPointTime) - populate(objectMap, "recoveryPointType", g.RecoveryPointType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenericRecoveryPoint. -func (g *GenericRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "friendlyName": - err = unpopulate(val, "FriendlyName", &g.FriendlyName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &g.ObjectType) - delete(rawMsg, key) - case "recoveryPointAdditionalInfo": - err = unpopulate(val, "RecoveryPointAdditionalInfo", &g.RecoveryPointAdditionalInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &g.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTime", &g.RecoveryPointTime) - delete(rawMsg, key) - case "recoveryPointType": - err = unpopulate(val, "RecoveryPointType", &g.RecoveryPointType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GetProtectedItemQueryObject. -func (g GetProtectedItemQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "expand", g.Expand) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GetProtectedItemQueryObject. -func (g *GetProtectedItemQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expand": - err = unpopulate(val, "Expand", &g.Expand) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HourlySchedule. -func (h HourlySchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "interval", h.Interval) - populate(objectMap, "scheduleWindowDuration", h.ScheduleWindowDuration) - populateDateTimeRFC3339(objectMap, "scheduleWindowStartTime", h.ScheduleWindowStartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HourlySchedule. -func (h *HourlySchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "interval": - err = unpopulate(val, "Interval", &h.Interval) - delete(rawMsg, key) - case "scheduleWindowDuration": - err = unpopulate(val, "ScheduleWindowDuration", &h.ScheduleWindowDuration) - delete(rawMsg, key) - case "scheduleWindowStartTime": - err = unpopulateDateTimeRFC3339(val, "ScheduleWindowStartTime", &h.ScheduleWindowStartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ILRRequest. -func (i ILRRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = i.ObjectType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ILRRequest. -func (i *ILRRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ILRRequestResource. -func (i ILRRequestResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", i.ETag) - populate(objectMap, "id", i.ID) - populate(objectMap, "location", i.Location) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ILRRequestResource. -func (i *ILRRequestResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &i.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &i.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - i.Properties, err = unmarshalILRRequestClassification(val) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &i.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IaaSVMContainer. -func (i IaaSVMContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", i.BackupManagementType) - objectMap["containerType"] = ProtectableContainerTypeIaasVMContainer - populate(objectMap, "friendlyName", i.FriendlyName) - populate(objectMap, "healthStatus", i.HealthStatus) - populate(objectMap, "protectableObjectType", i.ProtectableObjectType) - populate(objectMap, "registrationStatus", i.RegistrationStatus) - populate(objectMap, "resourceGroup", i.ResourceGroup) - populate(objectMap, "virtualMachineId", i.VirtualMachineID) - populate(objectMap, "virtualMachineVersion", i.VirtualMachineVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IaaSVMContainer. -func (i *IaaSVMContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &i.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &i.ContainerType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &i.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &i.HealthStatus) - delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &i.ProtectableObjectType) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &i.RegistrationStatus) - delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &i.ResourceGroup) - delete(rawMsg, key) - case "virtualMachineId": - err = unpopulate(val, "VirtualMachineID", &i.VirtualMachineID) - delete(rawMsg, key) - case "virtualMachineVersion": - err = unpopulate(val, "VirtualMachineVersion", &i.VirtualMachineVersion) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IaaSVMProtectableItem. -func (i IaaSVMProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", i.BackupManagementType) - populate(objectMap, "friendlyName", i.FriendlyName) - objectMap["protectableItemType"] = "IaaSVMProtectableItem" - populate(objectMap, "protectionState", i.ProtectionState) - populate(objectMap, "resourceGroup", i.ResourceGroup) - populate(objectMap, "virtualMachineId", i.VirtualMachineID) - populate(objectMap, "virtualMachineVersion", i.VirtualMachineVersion) - populate(objectMap, "workloadType", i.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IaaSVMProtectableItem. -func (i *IaaSVMProtectableItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &i.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &i.FriendlyName) - delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &i.ProtectableItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &i.ProtectionState) - delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &i.ResourceGroup) - delete(rawMsg, key) - case "virtualMachineId": - err = unpopulate(val, "VirtualMachineID", &i.VirtualMachineID) - delete(rawMsg, key) - case "virtualMachineVersion": - err = unpopulate(val, "VirtualMachineVersion", &i.VirtualMachineVersion) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &i.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IaasVMBackupRequest. -func (i IaasVMBackupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "IaasVMBackupRequest" - populateDateTimeRFC3339(objectMap, "recoveryPointExpiryTimeInUTC", i.RecoveryPointExpiryTimeInUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IaasVMBackupRequest. -func (i *IaasVMBackupRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - case "recoveryPointExpiryTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointExpiryTimeInUTC", &i.RecoveryPointExpiryTimeInUTC) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IaasVMILRRegistrationRequest. -func (i IaasVMILRRegistrationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "initiatorName", i.InitiatorName) - objectMap["objectType"] = "IaasVMILRRegistrationRequest" - populate(objectMap, "recoveryPointId", i.RecoveryPointID) - populate(objectMap, "renewExistingRegistration", i.RenewExistingRegistration) - populate(objectMap, "virtualMachineId", i.VirtualMachineID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IaasVMILRRegistrationRequest. -func (i *IaasVMILRRegistrationRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "initiatorName": - err = unpopulate(val, "InitiatorName", &i.InitiatorName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &i.RecoveryPointID) - delete(rawMsg, key) - case "renewExistingRegistration": - err = unpopulate(val, "RenewExistingRegistration", &i.RenewExistingRegistration) - delete(rawMsg, key) - case "virtualMachineId": - err = unpopulate(val, "VirtualMachineID", &i.VirtualMachineID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IaasVMRecoveryPoint. -func (i IaasVMRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", i.ExtendedLocation) - populate(objectMap, "isInstantIlrSessionActive", i.IsInstantIlrSessionActive) - populate(objectMap, "isManagedVirtualMachine", i.IsManagedVirtualMachine) - populate(objectMap, "isPrivateAccessEnabledOnAnyDisk", i.IsPrivateAccessEnabledOnAnyDisk) - populate(objectMap, "isSourceVMEncrypted", i.IsSourceVMEncrypted) - populate(objectMap, "keyAndSecret", i.KeyAndSecret) - populate(objectMap, "osType", i.OSType) - objectMap["objectType"] = "IaasVMRecoveryPoint" - populate(objectMap, "originalStorageAccountOption", i.OriginalStorageAccountOption) - populate(objectMap, "recoveryPointAdditionalInfo", i.RecoveryPointAdditionalInfo) - populate(objectMap, "recoveryPointDiskConfiguration", i.RecoveryPointDiskConfiguration) - populate(objectMap, "recoveryPointMoveReadinessInfo", i.RecoveryPointMoveReadinessInfo) - populate(objectMap, "recoveryPointProperties", i.RecoveryPointProperties) - populate(objectMap, "recoveryPointTierDetails", i.RecoveryPointTierDetails) - populateDateTimeRFC3339(objectMap, "recoveryPointTime", i.RecoveryPointTime) - populate(objectMap, "recoveryPointType", i.RecoveryPointType) - populate(objectMap, "securityType", i.SecurityType) - populate(objectMap, "sourceVMStorageType", i.SourceVMStorageType) - populate(objectMap, "virtualMachineSize", i.VirtualMachineSize) - populate(objectMap, "zones", i.Zones) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IaasVMRecoveryPoint. -func (i *IaasVMRecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &i.ExtendedLocation) - delete(rawMsg, key) - case "isInstantIlrSessionActive": - err = unpopulate(val, "IsInstantIlrSessionActive", &i.IsInstantIlrSessionActive) - delete(rawMsg, key) - case "isManagedVirtualMachine": - err = unpopulate(val, "IsManagedVirtualMachine", &i.IsManagedVirtualMachine) - delete(rawMsg, key) - case "isPrivateAccessEnabledOnAnyDisk": - err = unpopulate(val, "IsPrivateAccessEnabledOnAnyDisk", &i.IsPrivateAccessEnabledOnAnyDisk) - delete(rawMsg, key) - case "isSourceVMEncrypted": - err = unpopulate(val, "IsSourceVMEncrypted", &i.IsSourceVMEncrypted) - delete(rawMsg, key) - case "keyAndSecret": - err = unpopulate(val, "KeyAndSecret", &i.KeyAndSecret) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &i.OSType) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - case "originalStorageAccountOption": - err = unpopulate(val, "OriginalStorageAccountOption", &i.OriginalStorageAccountOption) - delete(rawMsg, key) - case "recoveryPointAdditionalInfo": - err = unpopulate(val, "RecoveryPointAdditionalInfo", &i.RecoveryPointAdditionalInfo) - delete(rawMsg, key) - case "recoveryPointDiskConfiguration": - err = unpopulate(val, "RecoveryPointDiskConfiguration", &i.RecoveryPointDiskConfiguration) - delete(rawMsg, key) - case "recoveryPointMoveReadinessInfo": - err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &i.RecoveryPointMoveReadinessInfo) - delete(rawMsg, key) - case "recoveryPointProperties": - err = unpopulate(val, "RecoveryPointProperties", &i.RecoveryPointProperties) - delete(rawMsg, key) - case "recoveryPointTierDetails": - err = unpopulate(val, "RecoveryPointTierDetails", &i.RecoveryPointTierDetails) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulateDateTimeRFC3339(val, "RecoveryPointTime", &i.RecoveryPointTime) - delete(rawMsg, key) - case "recoveryPointType": - err = unpopulate(val, "RecoveryPointType", &i.RecoveryPointType) - delete(rawMsg, key) - case "securityType": - err = unpopulate(val, "SecurityType", &i.SecurityType) - delete(rawMsg, key) - case "sourceVMStorageType": - err = unpopulate(val, "SourceVMStorageType", &i.SourceVMStorageType) - delete(rawMsg, key) - case "virtualMachineSize": - err = unpopulate(val, "VirtualMachineSize", &i.VirtualMachineSize) - delete(rawMsg, key) - case "zones": - err = unpopulate(val, "Zones", &i.Zones) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IaasVMRestoreRequest. -func (i IaasVMRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "affinityGroup", i.AffinityGroup) - populate(objectMap, "createNewCloudService", i.CreateNewCloudService) - populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) - populate(objectMap, "encryptionDetails", i.EncryptionDetails) - populate(objectMap, "extendedLocation", i.ExtendedLocation) - populate(objectMap, "identityBasedRestoreDetails", i.IdentityBasedRestoreDetails) - populate(objectMap, "identityInfo", i.IdentityInfo) - objectMap["objectType"] = "IaasVMRestoreRequest" - populate(objectMap, "originalStorageAccountOption", i.OriginalStorageAccountOption) - populate(objectMap, "recoveryPointId", i.RecoveryPointID) - populate(objectMap, "recoveryType", i.RecoveryType) - populate(objectMap, "region", i.Region) - populate(objectMap, "resourceGuardOperationRequests", i.ResourceGuardOperationRequests) - populate(objectMap, "restoreDiskLunList", i.RestoreDiskLunList) - populate(objectMap, "restoreWithManagedDisks", i.RestoreWithManagedDisks) - populate(objectMap, "securedVMDetails", i.SecuredVMDetails) - populate(objectMap, "sourceResourceId", i.SourceResourceID) - populate(objectMap, "storageAccountId", i.StorageAccountID) - populate(objectMap, "subnetId", i.SubnetID) - populate(objectMap, "targetDiskNetworkAccessSettings", i.TargetDiskNetworkAccessSettings) - populate(objectMap, "targetDomainNameId", i.TargetDomainNameID) - populate(objectMap, "targetResourceGroupId", i.TargetResourceGroupID) - populate(objectMap, "targetVirtualMachineId", i.TargetVirtualMachineID) - populate(objectMap, "virtualNetworkId", i.VirtualNetworkID) - populate(objectMap, "zones", i.Zones) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IaasVMRestoreRequest. -func (i *IaasVMRestoreRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "affinityGroup": - err = unpopulate(val, "AffinityGroup", &i.AffinityGroup) - delete(rawMsg, key) - case "createNewCloudService": - err = unpopulate(val, "CreateNewCloudService", &i.CreateNewCloudService) - delete(rawMsg, key) - case "diskEncryptionSetId": - err = unpopulate(val, "DiskEncryptionSetID", &i.DiskEncryptionSetID) - delete(rawMsg, key) - case "encryptionDetails": - err = unpopulate(val, "EncryptionDetails", &i.EncryptionDetails) - delete(rawMsg, key) - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &i.ExtendedLocation) - delete(rawMsg, key) - case "identityBasedRestoreDetails": - err = unpopulate(val, "IdentityBasedRestoreDetails", &i.IdentityBasedRestoreDetails) - delete(rawMsg, key) - case "identityInfo": - err = unpopulate(val, "IdentityInfo", &i.IdentityInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - case "originalStorageAccountOption": - err = unpopulate(val, "OriginalStorageAccountOption", &i.OriginalStorageAccountOption) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &i.RecoveryPointID) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &i.RecoveryType) - delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &i.Region) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &i.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "restoreDiskLunList": - err = unpopulate(val, "RestoreDiskLunList", &i.RestoreDiskLunList) - delete(rawMsg, key) - case "restoreWithManagedDisks": - err = unpopulate(val, "RestoreWithManagedDisks", &i.RestoreWithManagedDisks) - delete(rawMsg, key) - case "securedVMDetails": - err = unpopulate(val, "SecuredVMDetails", &i.SecuredVMDetails) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &i.SourceResourceID) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, "StorageAccountID", &i.StorageAccountID) - delete(rawMsg, key) - case "subnetId": - err = unpopulate(val, "SubnetID", &i.SubnetID) - delete(rawMsg, key) - case "targetDiskNetworkAccessSettings": - err = unpopulate(val, "TargetDiskNetworkAccessSettings", &i.TargetDiskNetworkAccessSettings) - delete(rawMsg, key) - case "targetDomainNameId": - err = unpopulate(val, "TargetDomainNameID", &i.TargetDomainNameID) - delete(rawMsg, key) - case "targetResourceGroupId": - err = unpopulate(val, "TargetResourceGroupID", &i.TargetResourceGroupID) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &i.TargetVirtualMachineID) - delete(rawMsg, key) - case "virtualNetworkId": - err = unpopulate(val, "VirtualNetworkID", &i.VirtualNetworkID) - delete(rawMsg, key) - case "zones": - err = unpopulate(val, "Zones", &i.Zones) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IaasVMRestoreWithRehydrationRequest. -func (i IaasVMRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "affinityGroup", i.AffinityGroup) - populate(objectMap, "createNewCloudService", i.CreateNewCloudService) - populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) - populate(objectMap, "encryptionDetails", i.EncryptionDetails) - populate(objectMap, "extendedLocation", i.ExtendedLocation) - populate(objectMap, "identityBasedRestoreDetails", i.IdentityBasedRestoreDetails) - populate(objectMap, "identityInfo", i.IdentityInfo) - objectMap["objectType"] = "IaasVMRestoreWithRehydrationRequest" - populate(objectMap, "originalStorageAccountOption", i.OriginalStorageAccountOption) - populate(objectMap, "recoveryPointId", i.RecoveryPointID) - populate(objectMap, "recoveryPointRehydrationInfo", i.RecoveryPointRehydrationInfo) - populate(objectMap, "recoveryType", i.RecoveryType) - populate(objectMap, "region", i.Region) - populate(objectMap, "resourceGuardOperationRequests", i.ResourceGuardOperationRequests) - populate(objectMap, "restoreDiskLunList", i.RestoreDiskLunList) - populate(objectMap, "restoreWithManagedDisks", i.RestoreWithManagedDisks) - populate(objectMap, "securedVMDetails", i.SecuredVMDetails) - populate(objectMap, "sourceResourceId", i.SourceResourceID) - populate(objectMap, "storageAccountId", i.StorageAccountID) - populate(objectMap, "subnetId", i.SubnetID) - populate(objectMap, "targetDiskNetworkAccessSettings", i.TargetDiskNetworkAccessSettings) - populate(objectMap, "targetDomainNameId", i.TargetDomainNameID) - populate(objectMap, "targetResourceGroupId", i.TargetResourceGroupID) - populate(objectMap, "targetVirtualMachineId", i.TargetVirtualMachineID) - populate(objectMap, "virtualNetworkId", i.VirtualNetworkID) - populate(objectMap, "zones", i.Zones) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IaasVMRestoreWithRehydrationRequest. -func (i *IaasVMRestoreWithRehydrationRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "affinityGroup": - err = unpopulate(val, "AffinityGroup", &i.AffinityGroup) - delete(rawMsg, key) - case "createNewCloudService": - err = unpopulate(val, "CreateNewCloudService", &i.CreateNewCloudService) - delete(rawMsg, key) - case "diskEncryptionSetId": - err = unpopulate(val, "DiskEncryptionSetID", &i.DiskEncryptionSetID) - delete(rawMsg, key) - case "encryptionDetails": - err = unpopulate(val, "EncryptionDetails", &i.EncryptionDetails) - delete(rawMsg, key) - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &i.ExtendedLocation) - delete(rawMsg, key) - case "identityBasedRestoreDetails": - err = unpopulate(val, "IdentityBasedRestoreDetails", &i.IdentityBasedRestoreDetails) - delete(rawMsg, key) - case "identityInfo": - err = unpopulate(val, "IdentityInfo", &i.IdentityInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - case "originalStorageAccountOption": - err = unpopulate(val, "OriginalStorageAccountOption", &i.OriginalStorageAccountOption) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &i.RecoveryPointID) - delete(rawMsg, key) - case "recoveryPointRehydrationInfo": - err = unpopulate(val, "RecoveryPointRehydrationInfo", &i.RecoveryPointRehydrationInfo) - delete(rawMsg, key) - case "recoveryType": - err = unpopulate(val, "RecoveryType", &i.RecoveryType) - delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &i.Region) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &i.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "restoreDiskLunList": - err = unpopulate(val, "RestoreDiskLunList", &i.RestoreDiskLunList) - delete(rawMsg, key) - case "restoreWithManagedDisks": - err = unpopulate(val, "RestoreWithManagedDisks", &i.RestoreWithManagedDisks) - delete(rawMsg, key) - case "securedVMDetails": - err = unpopulate(val, "SecuredVMDetails", &i.SecuredVMDetails) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &i.SourceResourceID) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, "StorageAccountID", &i.StorageAccountID) - delete(rawMsg, key) - case "subnetId": - err = unpopulate(val, "SubnetID", &i.SubnetID) - delete(rawMsg, key) - case "targetDiskNetworkAccessSettings": - err = unpopulate(val, "TargetDiskNetworkAccessSettings", &i.TargetDiskNetworkAccessSettings) - delete(rawMsg, key) - case "targetDomainNameId": - err = unpopulate(val, "TargetDomainNameID", &i.TargetDomainNameID) - delete(rawMsg, key) - case "targetResourceGroupId": - err = unpopulate(val, "TargetResourceGroupID", &i.TargetResourceGroupID) - delete(rawMsg, key) - case "targetVirtualMachineId": - err = unpopulate(val, "TargetVirtualMachineID", &i.TargetVirtualMachineID) - delete(rawMsg, key) - case "virtualNetworkId": - err = unpopulate(val, "VirtualNetworkID", &i.VirtualNetworkID) - delete(rawMsg, key) - case "zones": - err = unpopulate(val, "Zones", &i.Zones) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IdentityBasedRestoreDetails. -func (i IdentityBasedRestoreDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "objectType", i.ObjectType) - populate(objectMap, "targetStorageAccountId", i.TargetStorageAccountID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityBasedRestoreDetails. -func (i *IdentityBasedRestoreDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - case "targetStorageAccountId": - err = unpopulate(val, "TargetStorageAccountID", &i.TargetStorageAccountID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IdentityInfo. -func (i IdentityInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "isSystemAssignedIdentity", i.IsSystemAssignedIdentity) - populate(objectMap, "managedIdentityResourceId", i.ManagedIdentityResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityInfo. -func (i *IdentityInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "isSystemAssignedIdentity": - err = unpopulate(val, "IsSystemAssignedIdentity", &i.IsSystemAssignedIdentity) - delete(rawMsg, key) - case "managedIdentityResourceId": - err = unpopulate(val, "ManagedIdentityResourceID", &i.ManagedIdentityResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InquiryInfo. -func (i InquiryInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "errorDetail", i.ErrorDetail) - populate(objectMap, "inquiryDetails", i.InquiryDetails) - populate(objectMap, "status", i.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InquiryInfo. -func (i *InquiryInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "errorDetail": - err = unpopulate(val, "ErrorDetail", &i.ErrorDetail) - delete(rawMsg, key) - case "inquiryDetails": - err = unpopulate(val, "InquiryDetails", &i.InquiryDetails) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &i.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InquiryValidation. -func (i InquiryValidation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalDetail", i.AdditionalDetail) - populate(objectMap, "errorDetail", i.ErrorDetail) - populateAny(objectMap, "protectableItemCount", i.ProtectableItemCount) - populate(objectMap, "status", i.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InquiryValidation. -func (i *InquiryValidation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalDetail": - err = unpopulate(val, "AdditionalDetail", &i.AdditionalDetail) - delete(rawMsg, key) - case "errorDetail": - err = unpopulate(val, "ErrorDetail", &i.ErrorDetail) - delete(rawMsg, key) - case "protectableItemCount": - err = unpopulate(val, "ProtectableItemCount", &i.ProtectableItemCount) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &i.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InstantItemRecoveryTarget. -func (i InstantItemRecoveryTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "clientScripts", i.ClientScripts) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InstantItemRecoveryTarget. -func (i *InstantItemRecoveryTarget) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientScripts": - err = unpopulate(val, "ClientScripts", &i.ClientScripts) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InstantRPAdditionalDetails. -func (i InstantRPAdditionalDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureBackupRGNamePrefix", i.AzureBackupRGNamePrefix) - populate(objectMap, "azureBackupRGNameSuffix", i.AzureBackupRGNameSuffix) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InstantRPAdditionalDetails. -func (i *InstantRPAdditionalDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureBackupRGNamePrefix": - err = unpopulate(val, "AzureBackupRGNamePrefix", &i.AzureBackupRGNamePrefix) - delete(rawMsg, key) - case "azureBackupRGNameSuffix": - err = unpopulate(val, "AzureBackupRGNameSuffix", &i.AzureBackupRGNameSuffix) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Job. -func (j Job) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activityId", j.ActivityID) - populate(objectMap, "backupManagementType", j.BackupManagementType) - populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) - populate(objectMap, "entityFriendlyName", j.EntityFriendlyName) - objectMap["jobType"] = j.JobType - populate(objectMap, "operation", j.Operation) - populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) - populate(objectMap, "status", j.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Job. -func (j *Job) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activityId": - err = unpopulate(val, "ActivityID", &j.ActivityID) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &j.BackupManagementType) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) - delete(rawMsg, key) - case "entityFriendlyName": - err = unpopulate(val, "EntityFriendlyName", &j.EntityFriendlyName) - delete(rawMsg, key) - case "jobType": - err = unpopulate(val, "JobType", &j.JobType) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &j.Operation) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &j.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &j.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JobQueryObject. -func (j JobQueryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", j.BackupManagementType) - populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) - populate(objectMap, "jobId", j.JobID) - populate(objectMap, "operation", j.Operation) - populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) - populate(objectMap, "status", j.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobQueryObject. -func (j *JobQueryObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &j.BackupManagementType) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) - delete(rawMsg, key) - case "jobId": - err = unpopulate(val, "JobID", &j.JobID) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &j.Operation) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &j.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &j.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JobResource. -func (j JobResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", j.ETag) - populate(objectMap, "id", j.ID) - populate(objectMap, "location", j.Location) - populate(objectMap, "name", j.Name) - populate(objectMap, "properties", j.Properties) - populate(objectMap, "tags", j.Tags) - populate(objectMap, "type", j.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobResource. -func (j *JobResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &j.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &j.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &j.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &j.Name) - delete(rawMsg, key) - case "properties": - j.Properties, err = unmarshalJobClassification(val) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &j.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &j.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JobResourceList. -func (j JobResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", j.NextLink) - populate(objectMap, "value", j.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobResourceList. -func (j *JobResourceList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &j.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &j.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type KEKDetails. -func (k KEKDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyBackupData", k.KeyBackupData) - populate(objectMap, "keyUrl", k.KeyURL) - populate(objectMap, "keyVaultId", k.KeyVaultID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KEKDetails. -func (k *KEKDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "keyBackupData": - err = unpopulate(val, "KeyBackupData", &k.KeyBackupData) - delete(rawMsg, key) - case "keyUrl": - err = unpopulate(val, "KeyURL", &k.KeyURL) - delete(rawMsg, key) - case "keyVaultId": - err = unpopulate(val, "KeyVaultID", &k.KeyVaultID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type KPIResourceHealthDetails. -func (k KPIResourceHealthDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "resourceHealthDetails", k.ResourceHealthDetails) - populate(objectMap, "resourceHealthStatus", k.ResourceHealthStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KPIResourceHealthDetails. -func (k *KPIResourceHealthDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceHealthDetails": - err = unpopulate(val, "ResourceHealthDetails", &k.ResourceHealthDetails) - delete(rawMsg, key) - case "resourceHealthStatus": - err = unpopulate(val, "ResourceHealthStatus", &k.ResourceHealthStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type KeyAndSecretDetails. -func (k KeyAndSecretDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "bekDetails", k.BekDetails) - populate(objectMap, "encryptionMechanism", k.EncryptionMechanism) - populate(objectMap, "kekDetails", k.KekDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyAndSecretDetails. -func (k *KeyAndSecretDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "bekDetails": - err = unpopulate(val, "BekDetails", &k.BekDetails) - delete(rawMsg, key) - case "encryptionMechanism": - err = unpopulate(val, "EncryptionMechanism", &k.EncryptionMechanism) - delete(rawMsg, key) - case "kekDetails": - err = unpopulate(val, "KekDetails", &k.KekDetails) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ListRecoveryPointsRecommendedForMoveRequest. -func (l ListRecoveryPointsRecommendedForMoveRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "excludedRPList", l.ExcludedRPList) - populate(objectMap, "objectType", l.ObjectType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ListRecoveryPointsRecommendedForMoveRequest. -func (l *ListRecoveryPointsRecommendedForMoveRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "excludedRPList": - err = unpopulate(val, "ExcludedRPList", &l.ExcludedRPList) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &l.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogSchedulePolicy. -func (l LogSchedulePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "scheduleFrequencyInMins", l.ScheduleFrequencyInMins) - objectMap["schedulePolicyType"] = "LogSchedulePolicy" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogSchedulePolicy. -func (l *LogSchedulePolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "scheduleFrequencyInMins": - err = unpopulate(val, "ScheduleFrequencyInMins", &l.ScheduleFrequencyInMins) - delete(rawMsg, key) - case "schedulePolicyType": - err = unpopulate(val, "SchedulePolicyType", &l.SchedulePolicyType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LongTermRetentionPolicy. -func (l LongTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dailySchedule", l.DailySchedule) - populate(objectMap, "monthlySchedule", l.MonthlySchedule) - objectMap["retentionPolicyType"] = "LongTermRetentionPolicy" - populate(objectMap, "weeklySchedule", l.WeeklySchedule) - populate(objectMap, "yearlySchedule", l.YearlySchedule) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LongTermRetentionPolicy. -func (l *LongTermRetentionPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dailySchedule": - err = unpopulate(val, "DailySchedule", &l.DailySchedule) - delete(rawMsg, key) - case "monthlySchedule": - err = unpopulate(val, "MonthlySchedule", &l.MonthlySchedule) - delete(rawMsg, key) - case "retentionPolicyType": - err = unpopulate(val, "RetentionPolicyType", &l.RetentionPolicyType) - delete(rawMsg, key) - case "weeklySchedule": - err = unpopulate(val, "WeeklySchedule", &l.WeeklySchedule) - delete(rawMsg, key) - case "yearlySchedule": - err = unpopulate(val, "YearlySchedule", &l.YearlySchedule) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LongTermSchedulePolicy. -func (l LongTermSchedulePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["schedulePolicyType"] = "LongTermSchedulePolicy" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LongTermSchedulePolicy. -func (l *LongTermSchedulePolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "schedulePolicyType": - err = unpopulate(val, "SchedulePolicyType", &l.SchedulePolicyType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MABContainerHealthDetails. -func (m MABContainerHealthDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", m.Code) - populate(objectMap, "message", m.Message) - populate(objectMap, "recommendations", m.Recommendations) - populate(objectMap, "title", m.Title) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MABContainerHealthDetails. -func (m *MABContainerHealthDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &m.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &m.Message) - delete(rawMsg, key) - case "recommendations": - err = unpopulate(val, "Recommendations", &m.Recommendations) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &m.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabContainer. -func (m MabContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "agentVersion", m.AgentVersion) - populate(objectMap, "backupManagementType", m.BackupManagementType) - populate(objectMap, "canReRegister", m.CanReRegister) - populate(objectMap, "containerHealthState", m.ContainerHealthState) - populate(objectMap, "containerId", m.ContainerID) - objectMap["containerType"] = ProtectableContainerTypeWindows - populate(objectMap, "extendedInfo", m.ExtendedInfo) - populate(objectMap, "friendlyName", m.FriendlyName) - populate(objectMap, "healthStatus", m.HealthStatus) - populate(objectMap, "mabContainerHealthDetails", m.MabContainerHealthDetails) - populate(objectMap, "protectableObjectType", m.ProtectableObjectType) - populate(objectMap, "protectedItemCount", m.ProtectedItemCount) - populate(objectMap, "registrationStatus", m.RegistrationStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabContainer. -func (m *MabContainer) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agentVersion": - err = unpopulate(val, "AgentVersion", &m.AgentVersion) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &m.BackupManagementType) - delete(rawMsg, key) - case "canReRegister": - err = unpopulate(val, "CanReRegister", &m.CanReRegister) - delete(rawMsg, key) - case "containerHealthState": - err = unpopulate(val, "ContainerHealthState", &m.ContainerHealthState) - delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &m.ContainerID) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &m.ContainerType) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &m.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &m.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &m.HealthStatus) - delete(rawMsg, key) - case "mabContainerHealthDetails": - err = unpopulate(val, "MabContainerHealthDetails", &m.MabContainerHealthDetails) - delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &m.ProtectableObjectType) - delete(rawMsg, key) - case "protectedItemCount": - err = unpopulate(val, "ProtectedItemCount", &m.ProtectedItemCount) - delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &m.RegistrationStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabContainerExtendedInfo. -func (m MabContainerExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupItemType", m.BackupItemType) - populate(objectMap, "backupItems", m.BackupItems) - populate(objectMap, "lastBackupStatus", m.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastRefreshedAt", m.LastRefreshedAt) - populate(objectMap, "policyName", m.PolicyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabContainerExtendedInfo. -func (m *MabContainerExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupItemType": - err = unpopulate(val, "BackupItemType", &m.BackupItemType) - delete(rawMsg, key) - case "backupItems": - err = unpopulate(val, "BackupItems", &m.BackupItems) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &m.LastBackupStatus) - delete(rawMsg, key) - case "lastRefreshedAt": - err = unpopulateDateTimeRFC3339(val, "LastRefreshedAt", &m.LastRefreshedAt) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &m.PolicyName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabErrorInfo. -func (m MabErrorInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "errorString", m.ErrorString) - populate(objectMap, "recommendations", m.Recommendations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabErrorInfo. -func (m *MabErrorInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "errorString": - err = unpopulate(val, "ErrorString", &m.ErrorString) - delete(rawMsg, key) - case "recommendations": - err = unpopulate(val, "Recommendations", &m.Recommendations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabFileFolderProtectedItem. -func (m MabFileFolderProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", m.BackupManagementType) - populate(objectMap, "backupSetName", m.BackupSetName) - populate(objectMap, "computerName", m.ComputerName) - populate(objectMap, "containerName", m.ContainerName) - populate(objectMap, "createMode", m.CreateMode) - populate(objectMap, "deferredDeleteSyncTimeInUTC", m.DeferredDeleteSyncTimeInUTC) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", m.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", m.DeferredDeleteTimeRemaining) - populate(objectMap, "extendedInfo", m.ExtendedInfo) - populate(objectMap, "friendlyName", m.FriendlyName) - populate(objectMap, "isArchiveEnabled", m.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", m.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", m.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", m.IsScheduledForDeferredDelete) - populate(objectMap, "lastBackupStatus", m.LastBackupStatus) - populateDateTimeRFC3339(objectMap, "lastBackupTime", m.LastBackupTime) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", m.LastRecoveryPoint) - populate(objectMap, "policyId", m.PolicyID) - populate(objectMap, "policyName", m.PolicyName) - objectMap["protectedItemType"] = "MabFileFolderProtectedItem" - populate(objectMap, "protectionState", m.ProtectionState) - populate(objectMap, "resourceGuardOperationRequests", m.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", m.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", m.SourceResourceID) - populate(objectMap, "vaultId", m.VaultID) - populate(objectMap, "workloadType", m.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabFileFolderProtectedItem. -func (m *MabFileFolderProtectedItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &m.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &m.BackupSetName) - delete(rawMsg, key) - case "computerName": - err = unpopulate(val, "ComputerName", &m.ComputerName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &m.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &m.CreateMode) - delete(rawMsg, key) - case "deferredDeleteSyncTimeInUTC": - err = unpopulate(val, "DeferredDeleteSyncTimeInUTC", &m.DeferredDeleteSyncTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &m.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &m.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &m.ExtendedInfo) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &m.FriendlyName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &m.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &m.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &m.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &m.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "lastBackupStatus": - err = unpopulate(val, "LastBackupStatus", &m.LastBackupStatus) - delete(rawMsg, key) - case "lastBackupTime": - err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &m.LastBackupTime) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &m.LastRecoveryPoint) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &m.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &m.PolicyName) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &m.ProtectedItemType) - delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &m.ProtectionState) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &m.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &m.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &m.SourceResourceID) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &m.VaultID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &m.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabFileFolderProtectedItemExtendedInfo. -func (m MabFileFolderProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "lastRefreshedAt", m.LastRefreshedAt) - populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", m.OldestRecoveryPoint) - populate(objectMap, "recoveryPointCount", m.RecoveryPointCount) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabFileFolderProtectedItemExtendedInfo. -func (m *MabFileFolderProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "lastRefreshedAt": - err = unpopulateDateTimeRFC3339(val, "LastRefreshedAt", &m.LastRefreshedAt) - delete(rawMsg, key) - case "oldestRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPoint", &m.OldestRecoveryPoint) - delete(rawMsg, key) - case "recoveryPointCount": - err = unpopulate(val, "RecoveryPointCount", &m.RecoveryPointCount) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabJob. -func (m MabJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionsInfo", m.ActionsInfo) - populate(objectMap, "activityId", m.ActivityID) - populate(objectMap, "backupManagementType", m.BackupManagementType) - populate(objectMap, "duration", m.Duration) - populateDateTimeRFC3339(objectMap, "endTime", m.EndTime) - populate(objectMap, "entityFriendlyName", m.EntityFriendlyName) - populate(objectMap, "errorDetails", m.ErrorDetails) - populate(objectMap, "extendedInfo", m.ExtendedInfo) - objectMap["jobType"] = "MabJob" - populate(objectMap, "mabServerName", m.MabServerName) - populate(objectMap, "mabServerType", m.MabServerType) - populate(objectMap, "operation", m.Operation) - populateDateTimeRFC3339(objectMap, "startTime", m.StartTime) - populate(objectMap, "status", m.Status) - populate(objectMap, "workloadType", m.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabJob. -func (m *MabJob) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsInfo": - err = unpopulate(val, "ActionsInfo", &m.ActionsInfo) - delete(rawMsg, key) - case "activityId": - err = unpopulate(val, "ActivityID", &m.ActivityID) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &m.BackupManagementType) - delete(rawMsg, key) - case "duration": - err = unpopulate(val, "Duration", &m.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &m.EndTime) - delete(rawMsg, key) - case "entityFriendlyName": - err = unpopulate(val, "EntityFriendlyName", &m.EntityFriendlyName) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &m.ExtendedInfo) - delete(rawMsg, key) - case "jobType": - err = unpopulate(val, "JobType", &m.JobType) - delete(rawMsg, key) - case "mabServerName": - err = unpopulate(val, "MabServerName", &m.MabServerName) - delete(rawMsg, key) - case "mabServerType": - err = unpopulate(val, "MabServerType", &m.MabServerType) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &m.Operation) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &m.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &m.WorkloadType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabJobExtendedInfo. -func (m MabJobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dynamicErrorMessage", m.DynamicErrorMessage) - populate(objectMap, "propertyBag", m.PropertyBag) - populate(objectMap, "tasksList", m.TasksList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabJobExtendedInfo. -func (m *MabJobExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dynamicErrorMessage": - err = unpopulate(val, "DynamicErrorMessage", &m.DynamicErrorMessage) - delete(rawMsg, key) - case "propertyBag": - err = unpopulate(val, "PropertyBag", &m.PropertyBag) - delete(rawMsg, key) - case "tasksList": - err = unpopulate(val, "TasksList", &m.TasksList) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabJobTaskDetails. -func (m MabJobTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "duration", m.Duration) - populateDateTimeRFC3339(objectMap, "endTime", m.EndTime) - populateDateTimeRFC3339(objectMap, "startTime", m.StartTime) - populate(objectMap, "status", m.Status) - populate(objectMap, "taskId", m.TaskID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabJobTaskDetails. -func (m *MabJobTaskDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, "Duration", &m.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &m.EndTime) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &m.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "taskId": - err = unpopulate(val, "TaskID", &m.TaskID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MabProtectionPolicy. -func (m MabProtectionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["backupManagementType"] = "MAB" - populate(objectMap, "protectedItemsCount", m.ProtectedItemsCount) - populate(objectMap, "resourceGuardOperationRequests", m.ResourceGuardOperationRequests) - populate(objectMap, "retentionPolicy", m.RetentionPolicy) - populate(objectMap, "schedulePolicy", m.SchedulePolicy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MabProtectionPolicy. -func (m *MabProtectionPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &m.BackupManagementType) - delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &m.ProtectedItemsCount) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &m.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "retentionPolicy": - m.RetentionPolicy, err = unmarshalRetentionPolicyClassification(val) - delete(rawMsg, key) - case "schedulePolicy": - m.SchedulePolicy, err = unmarshalSchedulePolicyClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MonthlyRetentionSchedule. -func (m MonthlyRetentionSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "retentionDuration", m.RetentionDuration) - populate(objectMap, "retentionScheduleDaily", m.RetentionScheduleDaily) - populate(objectMap, "retentionScheduleFormatType", m.RetentionScheduleFormatType) - populate(objectMap, "retentionScheduleWeekly", m.RetentionScheduleWeekly) - aux := make([]*dateTimeRFC3339, len(m.RetentionTimes), len(m.RetentionTimes)) - for i := 0; i < len(m.RetentionTimes); i++ { - aux[i] = (*dateTimeRFC3339)(m.RetentionTimes[i]) - } - populate(objectMap, "retentionTimes", aux) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MonthlyRetentionSchedule. -func (m *MonthlyRetentionSchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "retentionDuration": - err = unpopulate(val, "RetentionDuration", &m.RetentionDuration) - delete(rawMsg, key) - case "retentionScheduleDaily": - err = unpopulate(val, "RetentionScheduleDaily", &m.RetentionScheduleDaily) - delete(rawMsg, key) - case "retentionScheduleFormatType": - err = unpopulate(val, "RetentionScheduleFormatType", &m.RetentionScheduleFormatType) - delete(rawMsg, key) - case "retentionScheduleWeekly": - err = unpopulate(val, "RetentionScheduleWeekly", &m.RetentionScheduleWeekly) - delete(rawMsg, key) - case "retentionTimes": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "RetentionTimes", &aux) - for _, au := range aux { - m.RetentionTimes = append(m.RetentionTimes, (*time.Time)(au)) - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MoveRPAcrossTiersRequest. -func (m MoveRPAcrossTiersRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "objectType", m.ObjectType) - populate(objectMap, "sourceTierType", m.SourceTierType) - populate(objectMap, "targetTierType", m.TargetTierType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MoveRPAcrossTiersRequest. -func (m *MoveRPAcrossTiersRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &m.ObjectType) - delete(rawMsg, key) - case "sourceTierType": - err = unpopulate(val, "SourceTierType", &m.SourceTierType) - delete(rawMsg, key) - case "targetTierType": - err = unpopulate(val, "TargetTierType", &m.TargetTierType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NameInfo. -func (n NameInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "localizedValue", n.LocalizedValue) - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NameInfo. -func (n *NameInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "localizedValue": - err = unpopulate(val, "LocalizedValue", &n.LocalizedValue) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NewErrorResponse. -func (n NewErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", n.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NewErrorResponse. -func (n *NewErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &n.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NewErrorResponseError. -func (n NewErrorResponseError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", n.AdditionalInfo) - populate(objectMap, "code", n.Code) - populate(objectMap, "details", n.Details) - populate(objectMap, "message", n.Message) - populate(objectMap, "target", n.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NewErrorResponseError. -func (n *NewErrorResponseError) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &n.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &n.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &n.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &n.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &n.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationResultInfo. -func (o OperationResultInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "jobList", o.JobList) - objectMap["objectType"] = "OperationResultInfo" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultInfo. -func (o *OperationResultInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "jobList": - err = unpopulate(val, "JobList", &o.JobList) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationResultInfoBase. -func (o OperationResultInfoBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = o.ObjectType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultInfoBase. -func (o *OperationResultInfoBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationResultInfoBaseResource. -func (o OperationResultInfoBaseResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "headers", o.Headers) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "statusCode", o.StatusCode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultInfoBaseResource. -func (o *OperationResultInfoBaseResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "headers": - err = unpopulate(val, "Headers", &o.Headers) - delete(rawMsg, key) - case "operation": - o.Operation, err = unmarshalOperationResultInfoBaseClassification(val) - delete(rawMsg, key) - case "statusCode": - err = unpopulate(val, "StatusCode", &o.StatusCode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatus. -func (o OperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - o.Properties, err = unmarshalOperationStatusExtendedInfoClassification(val) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatusError. -func (o OperationStatusError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", o.Code) - populate(objectMap, "message", o.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusError. -func (o *OperationStatusError) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &o.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &o.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatusExtendedInfo. -func (o OperationStatusExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = o.ObjectType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusExtendedInfo. -func (o *OperationStatusExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatusJobExtendedInfo. -func (o OperationStatusJobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "jobId", o.JobID) - objectMap["objectType"] = "OperationStatusJobExtendedInfo" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusJobExtendedInfo. -func (o *OperationStatusJobExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "jobId": - err = unpopulate(val, "JobID", &o.JobID) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatusJobsExtendedInfo. -func (o OperationStatusJobsExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "failedJobsError", o.FailedJobsError) - populate(objectMap, "jobIds", o.JobIDs) - objectMap["objectType"] = "OperationStatusJobsExtendedInfo" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusJobsExtendedInfo. -func (o *OperationStatusJobsExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "failedJobsError": - err = unpopulate(val, "FailedJobsError", &o.FailedJobsError) - delete(rawMsg, key) - case "jobIds": - err = unpopulate(val, "JobIDs", &o.JobIDs) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatusProvisionILRExtendedInfo. -func (o OperationStatusProvisionILRExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "OperationStatusProvisionILRExtendedInfo" - populate(objectMap, "recoveryTarget", o.RecoveryTarget) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusProvisionILRExtendedInfo. -func (o *OperationStatusProvisionILRExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - case "recoveryTarget": - err = unpopulate(val, "RecoveryTarget", &o.RecoveryTarget) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatusValidateOperationExtendedInfo. -func (o OperationStatusValidateOperationExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = "OperationStatusValidateOperationExtendedInfo" - populate(objectMap, "validateOperationResponse", o.ValidateOperationResponse) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusValidateOperationExtendedInfo. -func (o *OperationStatusValidateOperationExtendedInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - case "validateOperationResponse": - err = unpopulate(val, "ValidateOperationResponse", &o.ValidateOperationResponse) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationWorkerResponse. -func (o OperationWorkerResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "headers", o.Headers) - populate(objectMap, "statusCode", o.StatusCode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationWorkerResponse. -func (o *OperationWorkerResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "headers": - err = unpopulate(val, "Headers", &o.Headers) - delete(rawMsg, key) - case "statusCode": - err = unpopulate(val, "StatusCode", &o.StatusCode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PointInTimeRange. -func (p PointInTimeRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PointInTimeRange. -func (p *PointInTimeRange) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PreBackupValidation. -func (p PreBackupValidation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", p.Code) - populate(objectMap, "message", p.Message) - populate(objectMap, "status", p.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PreBackupValidation. -func (p *PreBackupValidation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &p.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &p.Message) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PreValidateEnableBackupRequest. -func (p PreValidateEnableBackupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "resourceId", p.ResourceID) - populate(objectMap, "resourceType", p.ResourceType) - populate(objectMap, "vaultId", p.VaultID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PreValidateEnableBackupRequest. -func (p *PreValidateEnableBackupRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &p.ResourceID) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &p.ResourceType) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &p.VaultID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PreValidateEnableBackupResponse. -func (p PreValidateEnableBackupResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "containerName", p.ContainerName) - populate(objectMap, "errorCode", p.ErrorCode) - populate(objectMap, "errorMessage", p.ErrorMessage) - populate(objectMap, "protectedItemName", p.ProtectedItemName) - populate(objectMap, "recommendation", p.Recommendation) - populate(objectMap, "status", p.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PreValidateEnableBackupResponse. -func (p *PreValidateEnableBackupResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "containerName": - err = unpopulate(val, "ContainerName", &p.ContainerName) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &p.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &p.ErrorMessage) - delete(rawMsg, key) - case "protectedItemName": - err = unpopulate(val, "ProtectedItemName", &p.ProtectedItemName) - delete(rawMsg, key) - case "recommendation": - err = unpopulate(val, "Recommendation", &p.Recommendation) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrepareDataMoveRequest. -func (p PrepareDataMoveRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataMoveLevel", p.DataMoveLevel) - populate(objectMap, "ignoreMoved", p.IgnoreMoved) - populate(objectMap, "sourceContainerArmIds", p.SourceContainerArmIDs) - populate(objectMap, "targetRegion", p.TargetRegion) - populate(objectMap, "targetResourceId", p.TargetResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrepareDataMoveRequest. -func (p *PrepareDataMoveRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataMoveLevel": - err = unpopulate(val, "DataMoveLevel", &p.DataMoveLevel) - delete(rawMsg, key) - case "ignoreMoved": - err = unpopulate(val, "IgnoreMoved", &p.IgnoreMoved) - delete(rawMsg, key) - case "sourceContainerArmIds": - err = unpopulate(val, "SourceContainerArmIDs", &p.SourceContainerArmIDs) - delete(rawMsg, key) - case "targetRegion": - err = unpopulate(val, "TargetRegion", &p.TargetRegion) - delete(rawMsg, key) - case "targetResourceId": - err = unpopulate(val, "TargetResourceID", &p.TargetResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrepareDataMoveResponse. -func (p PrepareDataMoveResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "correlationId", p.CorrelationID) - objectMap["objectType"] = "PrepareDataMoveResponse" - populate(objectMap, "sourceVaultProperties", p.SourceVaultProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrepareDataMoveResponse. -func (p *PrepareDataMoveResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "correlationId": - err = unpopulate(val, "CorrelationID", &p.CorrelationID) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &p.ObjectType) - delete(rawMsg, key) - case "sourceVaultProperties": - err = unpopulate(val, "SourceVaultProperties", &p.SourceVaultProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. -func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. -func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "groupIds", p.GroupIDs) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "groupIds": - err = unpopulate(val, "GroupIDs", &p.GroupIDs) - delete(rawMsg, key) - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) - delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResource. -func (p PrivateEndpointConnectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResource. -func (p *PrivateEndpointConnectionResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectableContainer. -func (p ProtectableContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", p.BackupManagementType) - populate(objectMap, "containerId", p.ContainerID) - populate(objectMap, "friendlyName", p.FriendlyName) - populate(objectMap, "healthStatus", p.HealthStatus) - objectMap["protectableContainerType"] = p.ProtectableContainerType + populate(objectMap, "backupManagementType", b.BackupManagementType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectableContainer. -func (p *ProtectableContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BMSAADPropertiesQueryObject. +func (b *BMSAADPropertiesQueryObject) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) - delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &p.ContainerID) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &p.FriendlyName) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &p.HealthStatus) - delete(rawMsg, key) - case "protectableContainerType": - err = unpopulate(val, "ProtectableContainerType", &p.ProtectableContainerType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectableContainerResource. -func (p ProtectableContainerResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectableContainerResource. -func (p *ProtectableContainerResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - p.Properties, err = unmarshalProtectableContainerClassification(val) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectableContainerResourceList. -func (p ProtectableContainerResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectableContainerResourceList. -func (p *ProtectableContainerResourceList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "BackupManagementType", &b.BackupManagementType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItem. -func (p ProtectedItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BMSBackupSummariesQueryObject. +func (b BMSBackupSummariesQueryObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", p.BackupManagementType) - populate(objectMap, "backupSetName", p.BackupSetName) - populate(objectMap, "containerName", p.ContainerName) - populate(objectMap, "createMode", p.CreateMode) - populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", p.DeferredDeleteTimeInUTC) - populate(objectMap, "deferredDeleteTimeRemaining", p.DeferredDeleteTimeRemaining) - populate(objectMap, "isArchiveEnabled", p.IsArchiveEnabled) - populate(objectMap, "isDeferredDeleteScheduleUpcoming", p.IsDeferredDeleteScheduleUpcoming) - populate(objectMap, "isRehydrate", p.IsRehydrate) - populate(objectMap, "isScheduledForDeferredDelete", p.IsScheduledForDeferredDelete) - populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", p.LastRecoveryPoint) - populate(objectMap, "policyId", p.PolicyID) - populate(objectMap, "policyName", p.PolicyName) - objectMap["protectedItemType"] = p.ProtectedItemType - populate(objectMap, "resourceGuardOperationRequests", p.ResourceGuardOperationRequests) - populate(objectMap, "softDeleteRetentionPeriodInDays", p.SoftDeleteRetentionPeriodInDays) - populate(objectMap, "sourceResourceId", p.SourceResourceID) - populate(objectMap, "vaultId", p.VaultID) - populate(objectMap, "workloadType", p.WorkloadType) + populate(objectMap, "type", b.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItem. -func (p *ProtectedItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BMSBackupSummariesQueryObject. +func (b *BMSBackupSummariesQueryObject) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &p.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &p.ContainerName) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &p.CreateMode) - delete(rawMsg, key) - case "deferredDeleteTimeInUTC": - err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &p.DeferredDeleteTimeInUTC) - delete(rawMsg, key) - case "deferredDeleteTimeRemaining": - err = unpopulate(val, "DeferredDeleteTimeRemaining", &p.DeferredDeleteTimeRemaining) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &p.IsArchiveEnabled) - delete(rawMsg, key) - case "isDeferredDeleteScheduleUpcoming": - err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &p.IsDeferredDeleteScheduleUpcoming) - delete(rawMsg, key) - case "isRehydrate": - err = unpopulate(val, "IsRehydrate", &p.IsRehydrate) - delete(rawMsg, key) - case "isScheduledForDeferredDelete": - err = unpopulate(val, "IsScheduledForDeferredDelete", &p.IsScheduledForDeferredDelete) - delete(rawMsg, key) - case "lastRecoveryPoint": - err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &p.LastRecoveryPoint) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &p.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &p.PolicyName) - delete(rawMsg, key) - case "protectedItemType": - err = unpopulate(val, "ProtectedItemType", &p.ProtectedItemType) - delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &p.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "softDeleteRetentionPeriodInDays": - err = unpopulate(val, "SoftDeleteRetentionPeriodInDays", &p.SoftDeleteRetentionPeriodInDays) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &p.SourceResourceID) - delete(rawMsg, key) - case "vaultId": - err = unpopulate(val, "VaultID", &p.VaultID) - delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &p.WorkloadType) + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &b.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemQueryObject. -func (p ProtectedItemQueryObject) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BMSRPQueryObject. +func (b BMSRPQueryObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupEngineName", p.BackupEngineName) - populate(objectMap, "backupManagementType", p.BackupManagementType) - populate(objectMap, "backupSetName", p.BackupSetName) - populate(objectMap, "containerName", p.ContainerName) - populate(objectMap, "fabricName", p.FabricName) - populate(objectMap, "friendlyName", p.FriendlyName) - populate(objectMap, "healthState", p.HealthState) - populate(objectMap, "itemType", p.ItemType) - populate(objectMap, "policyName", p.PolicyName) + populateDateTimeRFC3339(objectMap, "endDate", b.EndDate) + populate(objectMap, "extendedInfo", b.ExtendedInfo) + populate(objectMap, "includeSoftDeletedRP", b.IncludeSoftDeletedRP) + populate(objectMap, "moveReadyRPOnly", b.MoveReadyRPOnly) + populate(objectMap, "restorePointQueryType", b.RestorePointQueryType) + populateDateTimeRFC3339(objectMap, "startDate", b.StartDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemQueryObject. -func (p *ProtectedItemQueryObject) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BMSRPQueryObject. +func (b *BMSRPQueryObject) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "backupEngineName": - err = unpopulate(val, "BackupEngineName", &p.BackupEngineName) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) - delete(rawMsg, key) - case "backupSetName": - err = unpopulate(val, "BackupSetName", &p.BackupSetName) - delete(rawMsg, key) - case "containerName": - err = unpopulate(val, "ContainerName", &p.ContainerName) + case "endDate": + err = unpopulateDateTimeRFC3339(val, "EndDate", &b.EndDate) delete(rawMsg, key) - case "fabricName": - err = unpopulate(val, "FabricName", &p.FabricName) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &b.ExtendedInfo) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &p.FriendlyName) + case "includeSoftDeletedRP": + err = unpopulate(val, "IncludeSoftDeletedRP", &b.IncludeSoftDeletedRP) delete(rawMsg, key) - case "healthState": - err = unpopulate(val, "HealthState", &p.HealthState) + case "moveReadyRPOnly": + err = unpopulate(val, "MoveReadyRPOnly", &b.MoveReadyRPOnly) delete(rawMsg, key) - case "itemType": - err = unpopulate(val, "ItemType", &p.ItemType) + case "restorePointQueryType": + err = unpopulate(val, "RestorePointQueryType", &b.RestorePointQueryType) delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &p.PolicyName) + case "startDate": + err = unpopulateDateTimeRFC3339(val, "StartDate", &b.StartDate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemResource. -func (p ProtectedItemResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BackupManagementUsage. +func (b BackupManagementUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "currentValue", b.CurrentValue) + populate(objectMap, "limit", b.Limit) + populate(objectMap, "name", b.Name) + populateDateTimeRFC3339(objectMap, "nextResetTime", b.NextResetTime) + populate(objectMap, "quotaPeriod", b.QuotaPeriod) + populate(objectMap, "unit", b.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemResource. -func (p *ProtectedItemResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupManagementUsage. +func (b *BackupManagementUsage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &p.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "currentValue": + err = unpopulate(val, "CurrentValue", &b.CurrentValue) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) + case "limit": + err = unpopulate(val, "Limit", &b.Limit) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &b.Name) delete(rawMsg, key) - case "properties": - p.Properties, err = unmarshalProtectedItemClassification(val) + case "nextResetTime": + err = unpopulateDateTimeRFC3339(val, "NextResetTime", &b.NextResetTime) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "quotaPeriod": + err = unpopulate(val, "QuotaPeriod", &b.QuotaPeriod) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "unit": + err = unpopulate(val, "Unit", &b.Unit) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemResourceList. -func (p ProtectedItemResourceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BackupManagementUsageList. +func (b BackupManagementUsageList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "value", b.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemResourceList. -func (p *ProtectedItemResourceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupManagementUsageList. +func (b *BackupManagementUsageList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Value", &b.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionContainer. -func (p ProtectionContainer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BackupResourceConfig. +func (b BackupResourceConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", p.BackupManagementType) - objectMap["containerType"] = p.ContainerType - populate(objectMap, "friendlyName", p.FriendlyName) - populate(objectMap, "healthStatus", p.HealthStatus) - populate(objectMap, "protectableObjectType", p.ProtectableObjectType) - populate(objectMap, "registrationStatus", p.RegistrationStatus) + populate(objectMap, "crossRegionRestoreFlag", b.CrossRegionRestoreFlag) + populate(objectMap, "storageModelType", b.StorageModelType) + populate(objectMap, "storageType", b.StorageType) + populate(objectMap, "storageTypeState", b.StorageTypeState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionContainer. -func (p *ProtectionContainer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceConfig. +func (b *BackupResourceConfig) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) - delete(rawMsg, key) - case "containerType": - err = unpopulate(val, "ContainerType", &p.ContainerType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &p.FriendlyName) + case "crossRegionRestoreFlag": + err = unpopulate(val, "CrossRegionRestoreFlag", &b.CrossRegionRestoreFlag) delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &p.HealthStatus) + case "storageModelType": + err = unpopulate(val, "StorageModelType", &b.StorageModelType) delete(rawMsg, key) - case "protectableObjectType": - err = unpopulate(val, "ProtectableObjectType", &p.ProtectableObjectType) + case "storageType": + err = unpopulate(val, "StorageType", &b.StorageType) delete(rawMsg, key) - case "registrationStatus": - err = unpopulate(val, "RegistrationStatus", &p.RegistrationStatus) + case "storageTypeState": + err = unpopulate(val, "StorageTypeState", &b.StorageTypeState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionContainerResource. -func (p ProtectionContainerResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BackupResourceConfigResource. +func (b BackupResourceConfigResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "eTag", b.ETag) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionContainerResource. -func (p *ProtectionContainerResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceConfigResource. +func (b *BackupResourceConfigResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { case "eTag": - err = unpopulate(val, "ETag", &p.ETag) + err = unpopulate(val, "ETag", &b.ETag) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &b.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &p.Location) + err = unpopulate(val, "Location", &b.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &b.Name) delete(rawMsg, key) case "properties": - p.Properties, err = unmarshalProtectionContainerClassification(val) + err = unpopulate(val, "Properties", &b.Properties) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &p.Tags) + err = unpopulate(val, "Tags", &b.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectionContainerResourceList. -func (p ProtectionContainerResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionContainerResourceList. -func (p *ProtectionContainerResourceList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Type", &b.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionIntent. -func (p ProtectionIntent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientScriptForConnect. +func (c ClientScriptForConnect) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", p.BackupManagementType) - populate(objectMap, "itemId", p.ItemID) - populate(objectMap, "policyId", p.PolicyID) - objectMap["protectionIntentItemType"] = p.ProtectionIntentItemType - populate(objectMap, "protectionState", p.ProtectionState) - populate(objectMap, "sourceResourceId", p.SourceResourceID) + populate(objectMap, "osType", c.OSType) + populate(objectMap, "scriptContent", c.ScriptContent) + populate(objectMap, "scriptExtension", c.ScriptExtension) + populate(objectMap, "scriptNameSuffix", c.ScriptNameSuffix) + populate(objectMap, "url", c.URL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionIntent. -func (p *ProtectionIntent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientScriptForConnect. +func (c *ClientScriptForConnect) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) - delete(rawMsg, key) - case "itemId": - err = unpopulate(val, "ItemID", &p.ItemID) + case "osType": + err = unpopulate(val, "OSType", &c.OSType) delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &p.PolicyID) + case "scriptContent": + err = unpopulate(val, "ScriptContent", &c.ScriptContent) delete(rawMsg, key) - case "protectionIntentItemType": - err = unpopulate(val, "ProtectionIntentItemType", &p.ProtectionIntentItemType) + case "scriptExtension": + err = unpopulate(val, "ScriptExtension", &c.ScriptExtension) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &p.ProtectionState) + case "scriptNameSuffix": + err = unpopulate(val, "ScriptNameSuffix", &c.ScriptNameSuffix) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &p.SourceResourceID) + case "url": + err = unpopulate(val, "URL", &c.URL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionIntentQueryObject. -func (p ProtectionIntentQueryObject) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CrossRegionRestoreRequest. +func (c CrossRegionRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", p.BackupManagementType) - populate(objectMap, "itemName", p.ItemName) - populate(objectMap, "itemType", p.ItemType) - populate(objectMap, "parentName", p.ParentName) + populate(objectMap, "crossRegionRestoreAccessDetails", c.CrossRegionRestoreAccessDetails) + populate(objectMap, "restoreRequest", c.RestoreRequest) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionIntentQueryObject. -func (p *ProtectionIntentQueryObject) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossRegionRestoreRequest. +func (c *CrossRegionRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) + case "crossRegionRestoreAccessDetails": + c.CrossRegionRestoreAccessDetails, err = unmarshalCrrAccessTokenClassification(val) delete(rawMsg, key) - case "itemName": - err = unpopulate(val, "ItemName", &p.ItemName) - delete(rawMsg, key) - case "itemType": - err = unpopulate(val, "ItemType", &p.ItemType) - delete(rawMsg, key) - case "parentName": - err = unpopulate(val, "ParentName", &p.ParentName) + case "restoreRequest": + c.RestoreRequest, err = unmarshalRestoreRequestClassification(val) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionIntentResource. -func (p ProtectionIntentResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CrossRegionRestoreRequestResource. +func (c CrossRegionRestoreRequestResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "eTag", c.ETag) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionIntentResource. -func (p *ProtectionIntentResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossRegionRestoreRequestResource. +func (c *CrossRegionRestoreRequestResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { case "eTag": - err = unpopulate(val, "ETag", &p.ETag) + err = unpopulate(val, "ETag", &c.ETag) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &p.Location) + err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": - p.Properties, err = unmarshalProtectionIntentClassification(val) + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &p.Tags) + err = unpopulate(val, "Tags", &c.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionIntentResourceList. -func (p ProtectionIntentResourceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CrrAccessToken. +func (c CrrAccessToken) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "accessTokenString", c.AccessTokenString) + populate(objectMap, "bMSActiveRegion", c.BMSActiveRegion) + populate(objectMap, "backupManagementType", c.BackupManagementType) + populate(objectMap, "containerName", c.ContainerName) + populate(objectMap, "containerType", c.ContainerType) + populate(objectMap, "coordinatorServiceStampId", c.CoordinatorServiceStampID) + populate(objectMap, "coordinatorServiceStampUri", c.CoordinatorServiceStampURI) + populate(objectMap, "datasourceContainerName", c.DatasourceContainerName) + populate(objectMap, "datasourceId", c.DatasourceID) + populate(objectMap, "datasourceName", c.DatasourceName) + populate(objectMap, "datasourceType", c.DatasourceType) + objectMap["objectType"] = c.ObjectType + populate(objectMap, "protectionContainerId", c.ProtectionContainerID) + populate(objectMap, "protectionServiceStampId", c.ProtectionServiceStampID) + populate(objectMap, "protectionServiceStampUri", c.ProtectionServiceStampURI) + populate(objectMap, "recoveryPointId", c.RecoveryPointID) + populate(objectMap, "recoveryPointTime", c.RecoveryPointTime) + populate(objectMap, "resourceGroupName", c.ResourceGroupName) + populate(objectMap, "resourceId", c.ResourceID) + populate(objectMap, "resourceName", c.ResourceName) + populate(objectMap, "rpIsManagedVirtualMachine", c.RpIsManagedVirtualMachine) + populate(objectMap, "rpOriginalSAOption", c.RpOriginalSAOption) + populate(objectMap, "rpTierInformation", c.RpTierInformation) + populate(objectMap, "rpVMSizeDescription", c.RpVMSizeDescription) + populate(objectMap, "subscriptionId", c.SubscriptionID) + populate(objectMap, "tokenExtendedInformation", c.TokenExtendedInformation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionIntentResourceList. -func (p *ProtectionIntentResourceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CrrAccessToken. +func (c *CrrAccessToken) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "accessTokenString": + err = unpopulate(val, "AccessTokenString", &c.AccessTokenString) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "bMSActiveRegion": + err = unpopulate(val, "BMSActiveRegion", &c.BMSActiveRegion) + delete(rawMsg, key) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &c.BackupManagementType) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &c.ContainerName) + delete(rawMsg, key) + case "containerType": + err = unpopulate(val, "ContainerType", &c.ContainerType) + delete(rawMsg, key) + case "coordinatorServiceStampId": + err = unpopulate(val, "CoordinatorServiceStampID", &c.CoordinatorServiceStampID) + delete(rawMsg, key) + case "coordinatorServiceStampUri": + err = unpopulate(val, "CoordinatorServiceStampURI", &c.CoordinatorServiceStampURI) + delete(rawMsg, key) + case "datasourceContainerName": + err = unpopulate(val, "DatasourceContainerName", &c.DatasourceContainerName) + delete(rawMsg, key) + case "datasourceId": + err = unpopulate(val, "DatasourceID", &c.DatasourceID) + delete(rawMsg, key) + case "datasourceName": + err = unpopulate(val, "DatasourceName", &c.DatasourceName) + delete(rawMsg, key) + case "datasourceType": + err = unpopulate(val, "DatasourceType", &c.DatasourceType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &c.ObjectType) + delete(rawMsg, key) + case "protectionContainerId": + err = unpopulate(val, "ProtectionContainerID", &c.ProtectionContainerID) + delete(rawMsg, key) + case "protectionServiceStampId": + err = unpopulate(val, "ProtectionServiceStampID", &c.ProtectionServiceStampID) + delete(rawMsg, key) + case "protectionServiceStampUri": + err = unpopulate(val, "ProtectionServiceStampURI", &c.ProtectionServiceStampURI) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, "RecoveryPointID", &c.RecoveryPointID) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulate(val, "RecoveryPointTime", &c.RecoveryPointTime) + delete(rawMsg, key) + case "resourceGroupName": + err = unpopulate(val, "ResourceGroupName", &c.ResourceGroupName) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &c.ResourceName) + delete(rawMsg, key) + case "rpIsManagedVirtualMachine": + err = unpopulate(val, "RpIsManagedVirtualMachine", &c.RpIsManagedVirtualMachine) + delete(rawMsg, key) + case "rpOriginalSAOption": + err = unpopulate(val, "RpOriginalSAOption", &c.RpOriginalSAOption) + delete(rawMsg, key) + case "rpTierInformation": + err = unpopulate(val, "RpTierInformation", &c.RpTierInformation) + delete(rawMsg, key) + case "rpVMSizeDescription": + err = unpopulate(val, "RpVMSizeDescription", &c.RpVMSizeDescription) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &c.SubscriptionID) + delete(rawMsg, key) + case "tokenExtendedInformation": + err = unpopulate(val, "TokenExtendedInformation", &c.TokenExtendedInformation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionPolicy. -func (p ProtectionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CrrAccessTokenResource. +func (c CrrAccessTokenResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["backupManagementType"] = p.BackupManagementType - populate(objectMap, "protectedItemsCount", p.ProtectedItemsCount) - populate(objectMap, "resourceGuardOperationRequests", p.ResourceGuardOperationRequests) + populate(objectMap, "eTag", c.ETag) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionPolicy. -func (p *ProtectionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CrrAccessTokenResource. +func (c *CrrAccessTokenResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) + case "eTag": + err = unpopulate(val, "ETag", &c.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "protectedItemsCount": - err = unpopulate(val, "ProtectedItemsCount", &p.ProtectedItemsCount) + case "location": + err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &p.ResourceGuardOperationRequests) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + c.Properties, err = unmarshalCrrAccessTokenClassification(val) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionPolicyQueryObject. -func (p ProtectionPolicyQueryObject) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CrrJobRequest. +func (c CrrJobRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", p.BackupManagementType) - populate(objectMap, "fabricName", p.FabricName) - populate(objectMap, "workloadType", p.WorkloadType) + populate(objectMap, "jobName", c.JobName) + populate(objectMap, "resourceId", c.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionPolicyQueryObject. -func (p *ProtectionPolicyQueryObject) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CrrJobRequest. +func (c *CrrJobRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) - delete(rawMsg, key) - case "fabricName": - err = unpopulate(val, "FabricName", &p.FabricName) + case "jobName": + err = unpopulate(val, "JobName", &c.JobName) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &p.WorkloadType) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionPolicyResource. -func (p ProtectionPolicyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CrrJobRequestResource. +func (c CrrJobRequestResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", p.ETag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "eTag", c.ETag) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionPolicyResource. -func (p *ProtectionPolicyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CrrJobRequestResource. +func (c *CrrJobRequestResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { case "eTag": - err = unpopulate(val, "ETag", &p.ETag) + err = unpopulate(val, "ETag", &c.ETag) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &p.Location) + err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": - p.Properties, err = unmarshalProtectionPolicyClassification(val) + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &p.Tags) + err = unpopulate(val, "Tags", &c.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionPolicyResourceList. -func (p ProtectionPolicyResourceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DPMProtectedItem. +func (d DPMProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "backupEngineName", d.BackupEngineName) + populate(objectMap, "backupManagementType", d.BackupManagementType) + populate(objectMap, "backupSetName", d.BackupSetName) + populate(objectMap, "containerName", d.ContainerName) + populate(objectMap, "createMode", d.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", d.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", d.DeferredDeleteTimeRemaining) + populate(objectMap, "extendedInfo", d.ExtendedInfo) + populate(objectMap, "friendlyName", d.FriendlyName) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", d.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", d.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", d.IsScheduledForDeferredDelete) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", d.LastRecoveryPoint) + populate(objectMap, "policyId", d.PolicyID) + objectMap["protectedItemType"] = "DPMProtectedItem" + populate(objectMap, "protectionState", d.ProtectionState) + populate(objectMap, "resourceGuardOperationRequests", d.ResourceGuardOperationRequests) + populate(objectMap, "sourceResourceId", d.SourceResourceID) + populate(objectMap, "workloadType", d.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionPolicyResourceList. -func (p *ProtectionPolicyResourceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DPMProtectedItem. +func (d *DPMProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "backupEngineName": + err = unpopulate(val, "BackupEngineName", &d.BackupEngineName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &d.BackupManagementType) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RecoveryPoint. -func (r RecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["objectType"] = r.ObjectType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPoint. -func (r *RecoveryPoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &r.ObjectType) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &d.BackupSetName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &d.ContainerName) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &d.CreateMode) + delete(rawMsg, key) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &d.DeferredDeleteTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &d.DeferredDeleteTimeRemaining) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &d.ExtendedInfo) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &d.FriendlyName) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &d.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &d.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &d.IsScheduledForDeferredDelete) + delete(rawMsg, key) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &d.LastRecoveryPoint) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &d.PolicyID) + delete(rawMsg, key) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &d.ProtectedItemType) + delete(rawMsg, key) + case "protectionState": + err = unpopulate(val, "ProtectionState", &d.ProtectionState) + delete(rawMsg, key) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &d.ResourceGuardOperationRequests) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &d.SourceResourceID) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &d.WorkloadType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointDiskConfiguration. -func (r RecoveryPointDiskConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DPMProtectedItemExtendedInfo. +func (d DPMProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "excludedDiskList", r.ExcludedDiskList) - populate(objectMap, "includedDiskList", r.IncludedDiskList) - populate(objectMap, "numberOfDisksAttachedToVm", r.NumberOfDisksAttachedToVM) - populate(objectMap, "numberOfDisksIncludedInBackup", r.NumberOfDisksIncludedInBackup) + populate(objectMap, "diskStorageUsedInBytes", d.DiskStorageUsedInBytes) + populate(objectMap, "isCollocated", d.IsCollocated) + populate(objectMap, "isPresentOnCloud", d.IsPresentOnCloud) + populate(objectMap, "lastBackupStatus", d.LastBackupStatus) + populateDateTimeRFC3339(objectMap, "lastRefreshedAt", d.LastRefreshedAt) + populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", d.OldestRecoveryPoint) + populateDateTimeRFC3339(objectMap, "onPremiseLatestRecoveryPoint", d.OnPremiseLatestRecoveryPoint) + populateDateTimeRFC3339(objectMap, "onPremiseOldestRecoveryPoint", d.OnPremiseOldestRecoveryPoint) + populate(objectMap, "onPremiseRecoveryPointCount", d.OnPremiseRecoveryPointCount) + populate(objectMap, "protectableObjectLoadPath", d.ProtectableObjectLoadPath) + populate(objectMap, "protected", d.Protected) + populate(objectMap, "protectionGroupName", d.ProtectionGroupName) + populate(objectMap, "recoveryPointCount", d.RecoveryPointCount) + populate(objectMap, "totalDiskStorageSizeInBytes", d.TotalDiskStorageSizeInBytes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointDiskConfiguration. -func (r *RecoveryPointDiskConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DPMProtectedItemExtendedInfo. +func (d *DPMProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "excludedDiskList": - err = unpopulate(val, "ExcludedDiskList", &r.ExcludedDiskList) + case "diskStorageUsedInBytes": + err = unpopulate(val, "DiskStorageUsedInBytes", &d.DiskStorageUsedInBytes) delete(rawMsg, key) - case "includedDiskList": - err = unpopulate(val, "IncludedDiskList", &r.IncludedDiskList) + case "isCollocated": + err = unpopulate(val, "IsCollocated", &d.IsCollocated) delete(rawMsg, key) - case "numberOfDisksAttachedToVm": - err = unpopulate(val, "NumberOfDisksAttachedToVM", &r.NumberOfDisksAttachedToVM) + case "isPresentOnCloud": + err = unpopulate(val, "IsPresentOnCloud", &d.IsPresentOnCloud) delete(rawMsg, key) - case "numberOfDisksIncludedInBackup": - err = unpopulate(val, "NumberOfDisksIncludedInBackup", &r.NumberOfDisksIncludedInBackup) + case "lastBackupStatus": + err = unpopulate(val, "LastBackupStatus", &d.LastBackupStatus) + delete(rawMsg, key) + case "lastRefreshedAt": + err = unpopulateDateTimeRFC3339(val, "LastRefreshedAt", &d.LastRefreshedAt) + delete(rawMsg, key) + case "oldestRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPoint", &d.OldestRecoveryPoint) + delete(rawMsg, key) + case "onPremiseLatestRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "OnPremiseLatestRecoveryPoint", &d.OnPremiseLatestRecoveryPoint) + delete(rawMsg, key) + case "onPremiseOldestRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "OnPremiseOldestRecoveryPoint", &d.OnPremiseOldestRecoveryPoint) + delete(rawMsg, key) + case "onPremiseRecoveryPointCount": + err = unpopulate(val, "OnPremiseRecoveryPointCount", &d.OnPremiseRecoveryPointCount) + delete(rawMsg, key) + case "protectableObjectLoadPath": + err = unpopulate(val, "ProtectableObjectLoadPath", &d.ProtectableObjectLoadPath) + delete(rawMsg, key) + case "protected": + err = unpopulate(val, "Protected", &d.Protected) + delete(rawMsg, key) + case "protectionGroupName": + err = unpopulate(val, "ProtectionGroupName", &d.ProtectionGroupName) + delete(rawMsg, key) + case "recoveryPointCount": + err = unpopulate(val, "RecoveryPointCount", &d.RecoveryPointCount) + delete(rawMsg, key) + case "totalDiskStorageSizeInBytes": + err = unpopulate(val, "TotalDiskStorageSizeInBytes", &d.TotalDiskStorageSizeInBytes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointMoveReadinessInfo. -func (r RecoveryPointMoveReadinessInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiskExclusionProperties. +func (d DiskExclusionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", r.AdditionalInfo) - populate(objectMap, "isReadyForMove", r.IsReadyForMove) + populate(objectMap, "diskLunList", d.DiskLunList) + populate(objectMap, "isInclusionList", d.IsInclusionList) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointMoveReadinessInfo. -func (r *RecoveryPointMoveReadinessInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskExclusionProperties. +func (d *DiskExclusionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &r.AdditionalInfo) + case "diskLunList": + err = unpopulate(val, "DiskLunList", &d.DiskLunList) delete(rawMsg, key) - case "isReadyForMove": - err = unpopulate(val, "IsReadyForMove", &r.IsReadyForMove) + case "isInclusionList": + err = unpopulate(val, "IsInclusionList", &d.IsInclusionList) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointProperties. -func (r RecoveryPointProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiskInformation. +func (d DiskInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "expiryTime", r.ExpiryTime) - populate(objectMap, "isSoftDeleted", r.IsSoftDeleted) - populate(objectMap, "ruleName", r.RuleName) + populate(objectMap, "lun", d.Lun) + populate(objectMap, "name", d.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointProperties. -func (r *RecoveryPointProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskInformation. +func (d *DiskInformation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "expiryTime": - err = unpopulate(val, "ExpiryTime", &r.ExpiryTime) - delete(rawMsg, key) - case "isSoftDeleted": - err = unpopulate(val, "IsSoftDeleted", &r.IsSoftDeleted) + case "lun": + err = unpopulate(val, "Lun", &d.Lun) delete(rawMsg, key) - case "ruleName": - err = unpopulate(val, "RuleName", &r.RuleName) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointRehydrationInfo. -func (r RecoveryPointRehydrationInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DpmErrorInfo. +func (d DpmErrorInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "rehydrationPriority", r.RehydrationPriority) - populate(objectMap, "rehydrationRetentionDuration", r.RehydrationRetentionDuration) + populate(objectMap, "errorString", d.ErrorString) + populate(objectMap, "recommendations", d.Recommendations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointRehydrationInfo. -func (r *RecoveryPointRehydrationInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DpmErrorInfo. +func (d *DpmErrorInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "rehydrationPriority": - err = unpopulate(val, "RehydrationPriority", &r.RehydrationPriority) + case "errorString": + err = unpopulate(val, "ErrorString", &d.ErrorString) delete(rawMsg, key) - case "rehydrationRetentionDuration": - err = unpopulate(val, "RehydrationRetentionDuration", &r.RehydrationRetentionDuration) + case "recommendations": + err = unpopulate(val, "Recommendations", &d.Recommendations) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointResource. -func (r RecoveryPointResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DpmJob. +func (d DpmJob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", r.ETag) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) + populate(objectMap, "actionsInfo", d.ActionsInfo) + populate(objectMap, "activityId", d.ActivityID) + populate(objectMap, "backupManagementType", d.BackupManagementType) + populate(objectMap, "containerName", d.ContainerName) + populate(objectMap, "containerType", d.ContainerType) + populate(objectMap, "dpmServerName", d.DpmServerName) + populate(objectMap, "duration", d.Duration) + populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) + populate(objectMap, "entityFriendlyName", d.EntityFriendlyName) + populate(objectMap, "errorDetails", d.ErrorDetails) + populate(objectMap, "extendedInfo", d.ExtendedInfo) + objectMap["jobType"] = "DpmJob" + populate(objectMap, "operation", d.Operation) + populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) + populate(objectMap, "status", d.Status) + populate(objectMap, "workloadType", d.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointResource. -func (r *RecoveryPointResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DpmJob. +func (d *DpmJob) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &r.ETag) + case "actionsInfo": + err = unpopulate(val, "ActionsInfo", &d.ActionsInfo) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) + case "activityId": + err = unpopulate(val, "ActivityID", &d.ActivityID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &d.BackupManagementType) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "containerName": + err = unpopulate(val, "ContainerName", &d.ContainerName) delete(rawMsg, key) - case "properties": - r.Properties, err = unmarshalRecoveryPointClassification(val) + case "containerType": + err = unpopulate(val, "ContainerType", &d.ContainerType) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "dpmServerName": + err = unpopulate(val, "DpmServerName", &d.DpmServerName) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "duration": + err = unpopulate(val, "Duration", &d.Duration) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointResourceList. -func (r RecoveryPointResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointResourceList. -func (r *RecoveryPointResourceList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) + delete(rawMsg, key) + case "entityFriendlyName": + err = unpopulate(val, "EntityFriendlyName", &d.EntityFriendlyName) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &d.ErrorDetails) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &d.ExtendedInfo) + delete(rawMsg, key) + case "jobType": + err = unpopulate(val, "JobType", &d.JobType) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &d.Operation) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "workloadType": + err = unpopulate(val, "WorkloadType", &d.WorkloadType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointTierInformation. -func (r RecoveryPointTierInformation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DpmJobExtendedInfo. +func (d DpmJobExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedInfo", r.ExtendedInfo) - populate(objectMap, "status", r.Status) - populate(objectMap, "type", r.Type) + populate(objectMap, "dynamicErrorMessage", d.DynamicErrorMessage) + populate(objectMap, "propertyBag", d.PropertyBag) + populate(objectMap, "tasksList", d.TasksList) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointTierInformation. -func (r *RecoveryPointTierInformation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DpmJobExtendedInfo. +func (d *DpmJobExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &r.ExtendedInfo) + case "dynamicErrorMessage": + err = unpopulate(val, "DynamicErrorMessage", &d.DynamicErrorMessage) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &d.PropertyBag) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "tasksList": + err = unpopulate(val, "TasksList", &d.TasksList) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointTierInformationV2. -func (r RecoveryPointTierInformationV2) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DpmJobTaskDetails. +func (d DpmJobTaskDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedInfo", r.ExtendedInfo) - populate(objectMap, "status", r.Status) - populate(objectMap, "type", r.Type) + populate(objectMap, "duration", d.Duration) + populateDateTimeRFC3339(objectMap, "endTime", d.EndTime) + populateDateTimeRFC3339(objectMap, "startTime", d.StartTime) + populate(objectMap, "status", d.Status) + populate(objectMap, "taskId", d.TaskID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointTierInformationV2. -func (r *RecoveryPointTierInformationV2) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DpmJobTaskDetails. +func (d *DpmJobTaskDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &r.ExtendedInfo) + case "duration": + err = unpopulate(val, "Duration", &d.Duration) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &d.EndTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &d.StartTime) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &r.Status) + err = unpopulate(val, "Status", &d.Status) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "taskId": + err = unpopulate(val, "TaskID", &d.TaskID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EncryptionDetails. +func (e EncryptionDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", r.ETag) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) + populate(objectMap, "encryptionEnabled", e.EncryptionEnabled) + populate(objectMap, "kekUrl", e.KekURL) + populate(objectMap, "kekVaultId", e.KekVaultID) + populate(objectMap, "secretKeyUrl", e.SecretKeyURL) + populate(objectMap, "secretKeyVaultId", e.SecretKeyVaultID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionDetails. +func (e *EncryptionDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &r.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) + case "encryptionEnabled": + err = unpopulate(val, "EncryptionEnabled", &e.EncryptionEnabled) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + case "kekUrl": + err = unpopulate(val, "KekURL", &e.KekURL) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "kekVaultId": + err = unpopulate(val, "KekVaultID", &e.KekVaultID) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "secretKeyUrl": + err = unpopulate(val, "SecretKeyURL", &e.SecretKeyURL) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "secretKeyVaultId": + err = unpopulate(val, "SecretKeyVaultID", &e.SecretKeyVaultID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardOperationDetail. -func (r ResourceGuardOperationDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "defaultResourceRequest", r.DefaultResourceRequest) - populate(objectMap, "vaultCriticalOperation", r.VaultCriticalOperation) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardOperationDetail. -func (r *ResourceGuardOperationDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "defaultResourceRequest": - err = unpopulate(val, "DefaultResourceRequest", &r.DefaultResourceRequest) + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) - case "vaultCriticalOperation": - err = unpopulate(val, "VaultCriticalOperation", &r.VaultCriticalOperation) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardProxyBase. -func (r ResourceGuardProxyBase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", r.Description) - populate(objectMap, "lastUpdatedTime", r.LastUpdatedTime) - populate(objectMap, "resourceGuardOperationDetails", r.ResourceGuardOperationDetails) - populate(objectMap, "resourceGuardResourceId", r.ResourceGuardResourceID) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "recommendations", e.Recommendations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardProxyBase. -func (r *ResourceGuardProxyBase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulate(val, "LastUpdatedTime", &r.LastUpdatedTime) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "resourceGuardOperationDetails": - err = unpopulate(val, "ResourceGuardOperationDetails", &r.ResourceGuardOperationDetails) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "resourceGuardResourceId": - err = unpopulate(val, "ResourceGuardResourceID", &r.ResourceGuardResourceID) + case "recommendations": + err = unpopulate(val, "Recommendations", &e.Recommendations) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardProxyBaseResource. -func (r ResourceGuardProxyBaseResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtendedProperties. +func (e ExtendedProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", r.ETag) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) + populate(objectMap, "diskExclusionProperties", e.DiskExclusionProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardProxyBaseResource. -func (r *ResourceGuardProxyBaseResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedProperties. +func (e *ExtendedProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &r.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "diskExclusionProperties": + err = unpopulate(val, "DiskExclusionProperties", &e.DiskExclusionProperties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardProxyBaseResourceList. -func (r ResourceGuardProxyBaseResourceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenericProtectedItem. +func (g GenericProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "backupManagementType", g.BackupManagementType) + populate(objectMap, "backupSetName", g.BackupSetName) + populate(objectMap, "containerName", g.ContainerName) + populate(objectMap, "createMode", g.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", g.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", g.DeferredDeleteTimeRemaining) + populate(objectMap, "fabricName", g.FabricName) + populate(objectMap, "friendlyName", g.FriendlyName) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", g.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", g.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", g.IsScheduledForDeferredDelete) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", g.LastRecoveryPoint) + populate(objectMap, "policyId", g.PolicyID) + populate(objectMap, "policyState", g.PolicyState) + populate(objectMap, "protectedItemId", g.ProtectedItemID) + objectMap["protectedItemType"] = "GenericProtectedItem" + populate(objectMap, "protectionState", g.ProtectionState) + populate(objectMap, "resourceGuardOperationRequests", g.ResourceGuardOperationRequests) + populate(objectMap, "sourceAssociations", g.SourceAssociations) + populate(objectMap, "sourceResourceId", g.SourceResourceID) + populate(objectMap, "workloadType", g.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardProxyBaseResourceList. -func (r *ResourceGuardProxyBaseResourceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenericProtectedItem. +func (g *GenericProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &g.BackupManagementType) + delete(rawMsg, key) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &g.BackupSetName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &g.ContainerName) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &g.CreateMode) + delete(rawMsg, key) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &g.DeferredDeleteTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &g.DeferredDeleteTimeRemaining) + delete(rawMsg, key) + case "fabricName": + err = unpopulate(val, "FabricName", &g.FabricName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &g.FriendlyName) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &g.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &g.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &g.IsScheduledForDeferredDelete) + delete(rawMsg, key) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &g.LastRecoveryPoint) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &g.PolicyID) + delete(rawMsg, key) + case "policyState": + err = unpopulate(val, "PolicyState", &g.PolicyState) + delete(rawMsg, key) + case "protectedItemId": + err = unpopulate(val, "ProtectedItemID", &g.ProtectedItemID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &g.ProtectedItemType) + delete(rawMsg, key) + case "protectionState": + err = unpopulate(val, "ProtectionState", &g.ProtectionState) + delete(rawMsg, key) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &g.ResourceGuardOperationRequests) + delete(rawMsg, key) + case "sourceAssociations": + err = unpopulate(val, "SourceAssociations", &g.SourceAssociations) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &g.SourceResourceID) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &g.WorkloadType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceHealthDetails. -func (r ResourceHealthDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenericRecoveryPoint. +func (g GenericRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", r.Code) - populate(objectMap, "message", r.Message) - populate(objectMap, "recommendations", r.Recommendations) - populate(objectMap, "title", r.Title) + populate(objectMap, "friendlyName", g.FriendlyName) + objectMap["objectType"] = "GenericRecoveryPoint" + populate(objectMap, "recoveryPointAdditionalInfo", g.RecoveryPointAdditionalInfo) + populate(objectMap, "recoveryPointProperties", g.RecoveryPointProperties) + populateDateTimeRFC3339(objectMap, "recoveryPointTime", g.RecoveryPointTime) + populate(objectMap, "recoveryPointType", g.RecoveryPointType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceHealthDetails. -func (r *ResourceHealthDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenericRecoveryPoint. +func (g *GenericRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &r.Code) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &g.FriendlyName) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &r.Message) + case "objectType": + err = unpopulate(val, "ObjectType", &g.ObjectType) delete(rawMsg, key) - case "recommendations": - err = unpopulate(val, "Recommendations", &r.Recommendations) + case "recoveryPointAdditionalInfo": + err = unpopulate(val, "RecoveryPointAdditionalInfo", &g.RecoveryPointAdditionalInfo) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &r.Title) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &g.RecoveryPointProperties) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTime", &g.RecoveryPointTime) + delete(rawMsg, key) + case "recoveryPointType": + err = unpopulate(val, "RecoveryPointType", &g.RecoveryPointType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceList. -func (r ResourceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IaasVMRecoveryPoint. +func (i IaasVMRecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "isInstantIlrSessionActive", i.IsInstantIlrSessionActive) + populate(objectMap, "isManagedVirtualMachine", i.IsManagedVirtualMachine) + populate(objectMap, "isSourceVMEncrypted", i.IsSourceVMEncrypted) + populate(objectMap, "keyAndSecret", i.KeyAndSecret) + populate(objectMap, "osType", i.OSType) + objectMap["objectType"] = "IaasVMRecoveryPoint" + populate(objectMap, "originalStorageAccountOption", i.OriginalStorageAccountOption) + populate(objectMap, "recoveryPointAdditionalInfo", i.RecoveryPointAdditionalInfo) + populate(objectMap, "recoveryPointDiskConfiguration", i.RecoveryPointDiskConfiguration) + populate(objectMap, "recoveryPointMoveReadinessInfo", i.RecoveryPointMoveReadinessInfo) + populate(objectMap, "recoveryPointProperties", i.RecoveryPointProperties) + populate(objectMap, "recoveryPointTierDetails", i.RecoveryPointTierDetails) + populateDateTimeRFC3339(objectMap, "recoveryPointTime", i.RecoveryPointTime) + populate(objectMap, "recoveryPointType", i.RecoveryPointType) + populate(objectMap, "sourceVMStorageType", i.SourceVMStorageType) + populate(objectMap, "virtualMachineSize", i.VirtualMachineSize) + populate(objectMap, "zones", i.Zones) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceList. -func (r *ResourceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IaasVMRecoveryPoint. +func (i *IaasVMRecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "isInstantIlrSessionActive": + err = unpopulate(val, "IsInstantIlrSessionActive", &i.IsInstantIlrSessionActive) + delete(rawMsg, key) + case "isManagedVirtualMachine": + err = unpopulate(val, "IsManagedVirtualMachine", &i.IsManagedVirtualMachine) + delete(rawMsg, key) + case "isSourceVMEncrypted": + err = unpopulate(val, "IsSourceVMEncrypted", &i.IsSourceVMEncrypted) + delete(rawMsg, key) + case "keyAndSecret": + err = unpopulate(val, "KeyAndSecret", &i.KeyAndSecret) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &i.OSType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &i.ObjectType) + delete(rawMsg, key) + case "originalStorageAccountOption": + err = unpopulate(val, "OriginalStorageAccountOption", &i.OriginalStorageAccountOption) + delete(rawMsg, key) + case "recoveryPointAdditionalInfo": + err = unpopulate(val, "RecoveryPointAdditionalInfo", &i.RecoveryPointAdditionalInfo) + delete(rawMsg, key) + case "recoveryPointDiskConfiguration": + err = unpopulate(val, "RecoveryPointDiskConfiguration", &i.RecoveryPointDiskConfiguration) + delete(rawMsg, key) + case "recoveryPointMoveReadinessInfo": + err = unpopulate(val, "RecoveryPointMoveReadinessInfo", &i.RecoveryPointMoveReadinessInfo) + delete(rawMsg, key) + case "recoveryPointProperties": + err = unpopulate(val, "RecoveryPointProperties", &i.RecoveryPointProperties) + delete(rawMsg, key) + case "recoveryPointTierDetails": + err = unpopulate(val, "RecoveryPointTierDetails", &i.RecoveryPointTierDetails) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulateDateTimeRFC3339(val, "RecoveryPointTime", &i.RecoveryPointTime) + delete(rawMsg, key) + case "recoveryPointType": + err = unpopulate(val, "RecoveryPointType", &i.RecoveryPointType) + delete(rawMsg, key) + case "sourceVMStorageType": + err = unpopulate(val, "SourceVMStorageType", &i.SourceVMStorageType) + delete(rawMsg, key) + case "virtualMachineSize": + err = unpopulate(val, "VirtualMachineSize", &i.VirtualMachineSize) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &i.Zones) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestoreFileSpecs. -func (r RestoreFileSpecs) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IaasVMRestoreRequest. +func (i IaasVMRestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "fileSpecType", r.FileSpecType) - populate(objectMap, "path", r.Path) - populate(objectMap, "targetFolderPath", r.TargetFolderPath) + populate(objectMap, "affinityGroup", i.AffinityGroup) + populate(objectMap, "createNewCloudService", i.CreateNewCloudService) + populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) + populate(objectMap, "encryptionDetails", i.EncryptionDetails) + populate(objectMap, "identityBasedRestoreDetails", i.IdentityBasedRestoreDetails) + populate(objectMap, "identityInfo", i.IdentityInfo) + objectMap["objectType"] = "IaasVMRestoreRequest" + populate(objectMap, "originalStorageAccountOption", i.OriginalStorageAccountOption) + populate(objectMap, "recoveryPointId", i.RecoveryPointID) + populate(objectMap, "recoveryType", i.RecoveryType) + populate(objectMap, "region", i.Region) + populate(objectMap, "restoreDiskLunList", i.RestoreDiskLunList) + populate(objectMap, "restoreWithManagedDisks", i.RestoreWithManagedDisks) + populate(objectMap, "sourceResourceId", i.SourceResourceID) + populate(objectMap, "storageAccountId", i.StorageAccountID) + populate(objectMap, "subnetId", i.SubnetID) + populate(objectMap, "targetDomainNameId", i.TargetDomainNameID) + populate(objectMap, "targetResourceGroupId", i.TargetResourceGroupID) + populate(objectMap, "targetVirtualMachineId", i.TargetVirtualMachineID) + populate(objectMap, "virtualNetworkId", i.VirtualNetworkID) + populate(objectMap, "zones", i.Zones) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreFileSpecs. -func (r *RestoreFileSpecs) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IaasVMRestoreRequest. +func (i *IaasVMRestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "fileSpecType": - err = unpopulate(val, "FileSpecType", &r.FileSpecType) + case "affinityGroup": + err = unpopulate(val, "AffinityGroup", &i.AffinityGroup) delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &r.Path) + case "createNewCloudService": + err = unpopulate(val, "CreateNewCloudService", &i.CreateNewCloudService) delete(rawMsg, key) - case "targetFolderPath": - err = unpopulate(val, "TargetFolderPath", &r.TargetFolderPath) + case "diskEncryptionSetId": + err = unpopulate(val, "DiskEncryptionSetID", &i.DiskEncryptionSetID) + delete(rawMsg, key) + case "encryptionDetails": + err = unpopulate(val, "EncryptionDetails", &i.EncryptionDetails) + delete(rawMsg, key) + case "identityBasedRestoreDetails": + err = unpopulate(val, "IdentityBasedRestoreDetails", &i.IdentityBasedRestoreDetails) + delete(rawMsg, key) + case "identityInfo": + err = unpopulate(val, "IdentityInfo", &i.IdentityInfo) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &i.ObjectType) + delete(rawMsg, key) + case "originalStorageAccountOption": + err = unpopulate(val, "OriginalStorageAccountOption", &i.OriginalStorageAccountOption) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, "RecoveryPointID", &i.RecoveryPointID) + delete(rawMsg, key) + case "recoveryType": + err = unpopulate(val, "RecoveryType", &i.RecoveryType) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &i.Region) + delete(rawMsg, key) + case "restoreDiskLunList": + err = unpopulate(val, "RestoreDiskLunList", &i.RestoreDiskLunList) + delete(rawMsg, key) + case "restoreWithManagedDisks": + err = unpopulate(val, "RestoreWithManagedDisks", &i.RestoreWithManagedDisks) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &i.SourceResourceID) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &i.StorageAccountID) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &i.SubnetID) + delete(rawMsg, key) + case "targetDomainNameId": + err = unpopulate(val, "TargetDomainNameID", &i.TargetDomainNameID) + delete(rawMsg, key) + case "targetResourceGroupId": + err = unpopulate(val, "TargetResourceGroupID", &i.TargetResourceGroupID) + delete(rawMsg, key) + case "targetVirtualMachineId": + err = unpopulate(val, "TargetVirtualMachineID", &i.TargetVirtualMachineID) + delete(rawMsg, key) + case "virtualNetworkId": + err = unpopulate(val, "VirtualNetworkID", &i.VirtualNetworkID) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &i.Zones) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestoreRequest. -func (r RestoreRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityBasedRestoreDetails. +func (i IdentityBasedRestoreDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = r.ObjectType - populate(objectMap, "resourceGuardOperationRequests", r.ResourceGuardOperationRequests) + populate(objectMap, "objectType", i.ObjectType) + populate(objectMap, "targetStorageAccountId", i.TargetStorageAccountID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreRequest. -func (r *RestoreRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityBasedRestoreDetails. +func (i *IdentityBasedRestoreDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { case "objectType": - err = unpopulate(val, "ObjectType", &r.ObjectType) + err = unpopulate(val, "ObjectType", &i.ObjectType) delete(rawMsg, key) - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &r.ResourceGuardOperationRequests) + case "targetStorageAccountId": + err = unpopulate(val, "TargetStorageAccountID", &i.TargetStorageAccountID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestoreRequestResource. -func (r RestoreRequestResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityInfo. +func (i IdentityInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", r.ETag) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) + populate(objectMap, "isSystemAssignedIdentity", i.IsSystemAssignedIdentity) + populate(objectMap, "managedIdentityResourceId", i.ManagedIdentityResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreRequestResource. -func (r *RestoreRequestResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityInfo. +func (i *IdentityInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &r.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - r.Properties, err = unmarshalRestoreRequestClassification(val) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "isSystemAssignedIdentity": + err = unpopulate(val, "IsSystemAssignedIdentity", &i.IsSystemAssignedIdentity) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "managedIdentityResourceId": + err = unpopulate(val, "ManagedIdentityResourceID", &i.ManagedIdentityResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RetentionDuration. -func (r RetentionDuration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InstantItemRecoveryTarget. +func (i InstantItemRecoveryTarget) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", r.Count) - populate(objectMap, "durationType", r.DurationType) + populate(objectMap, "clientScripts", i.ClientScripts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionDuration. -func (r *RetentionDuration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InstantItemRecoveryTarget. +func (i *InstantItemRecoveryTarget) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &r.Count) - delete(rawMsg, key) - case "durationType": - err = unpopulate(val, "DurationType", &r.DurationType) + case "clientScripts": + err = unpopulate(val, "ClientScripts", &i.ClientScripts) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. -func (r RetentionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Job. +func (j Job) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["retentionPolicyType"] = r.RetentionPolicyType + populate(objectMap, "activityId", j.ActivityID) + populate(objectMap, "backupManagementType", j.BackupManagementType) + populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "entityFriendlyName", j.EntityFriendlyName) + objectMap["jobType"] = j.JobType + populate(objectMap, "operation", j.Operation) + populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "status", j.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. -func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Job. +func (j *Job) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "retentionPolicyType": - err = unpopulate(val, "RetentionPolicyType", &r.RetentionPolicyType) + case "activityId": + err = unpopulate(val, "ActivityID", &j.ActivityID) + delete(rawMsg, key) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &j.BackupManagementType) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) + delete(rawMsg, key) + case "entityFriendlyName": + err = unpopulate(val, "EntityFriendlyName", &j.EntityFriendlyName) + delete(rawMsg, key) + case "jobType": + err = unpopulate(val, "JobType", &j.JobType) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &j.Operation) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLDataDirectory. -func (s SQLDataDirectory) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobQueryObject. +func (j JobQueryObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "logicalName", s.LogicalName) - populate(objectMap, "path", s.Path) - populate(objectMap, "type", s.Type) + populate(objectMap, "backupManagementType", j.BackupManagementType) + populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "jobId", j.JobID) + populate(objectMap, "operation", j.Operation) + populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "status", j.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDataDirectory. -func (s *SQLDataDirectory) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobQueryObject. +func (j *JobQueryObject) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "logicalName": - err = unpopulate(val, "LogicalName", &s.LogicalName) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &j.BackupManagementType) delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &s.Path) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "jobId": + err = unpopulate(val, "JobID", &j.JobID) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &j.Operation) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLDataDirectoryMapping. -func (s SQLDataDirectoryMapping) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobResource. +func (j JobResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "mappingType", s.MappingType) - populate(objectMap, "sourceLogicalName", s.SourceLogicalName) - populate(objectMap, "sourcePath", s.SourcePath) - populate(objectMap, "targetPath", s.TargetPath) + populate(objectMap, "eTag", j.ETag) + populate(objectMap, "id", j.ID) + populate(objectMap, "location", j.Location) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "tags", j.Tags) + populate(objectMap, "type", j.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDataDirectoryMapping. -func (s *SQLDataDirectoryMapping) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobResource. +func (j *JobResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "mappingType": - err = unpopulate(val, "MappingType", &s.MappingType) + case "eTag": + err = unpopulate(val, "ETag", &j.ETag) delete(rawMsg, key) - case "sourceLogicalName": - err = unpopulate(val, "SourceLogicalName", &s.SourceLogicalName) + case "id": + err = unpopulate(val, "ID", &j.ID) delete(rawMsg, key) - case "sourcePath": - err = unpopulate(val, "SourcePath", &s.SourcePath) + case "location": + err = unpopulate(val, "Location", &j.Location) delete(rawMsg, key) - case "targetPath": - err = unpopulate(val, "TargetPath", &s.TargetPath) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + j.Properties, err = unmarshalJobClassification(val) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &j.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SchedulePolicy. -func (s SchedulePolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobResourceList. +func (j JobResourceList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["schedulePolicyType"] = s.SchedulePolicyType + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SchedulePolicy. -func (s *SchedulePolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JobResourceList. +func (j *JobResourceList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "schedulePolicyType": - err = unpopulate(val, "SchedulePolicyType", &s.SchedulePolicyType) + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SecuredVMDetails. -func (s SecuredVMDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KEKDetails. +func (k KEKDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "securedVMOsDiskEncryptionSetId", s.SecuredVMOsDiskEncryptionSetID) + populate(objectMap, "keyBackupData", k.KeyBackupData) + populate(objectMap, "keyUrl", k.KeyURL) + populate(objectMap, "keyVaultId", k.KeyVaultID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecuredVMDetails. -func (s *SecuredVMDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KEKDetails. +func (k *KEKDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "securedVMOsDiskEncryptionSetId": - err = unpopulate(val, "SecuredVMOsDiskEncryptionSetID", &s.SecuredVMOsDiskEncryptionSetID) + case "keyBackupData": + err = unpopulate(val, "KeyBackupData", &k.KeyBackupData) + delete(rawMsg, key) + case "keyUrl": + err = unpopulate(val, "KeyURL", &k.KeyURL) + delete(rawMsg, key) + case "keyVaultId": + err = unpopulate(val, "KeyVaultID", &k.KeyVaultID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityPinBase. -func (s SecurityPinBase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KPIResourceHealthDetails. +func (k KPIResourceHealthDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resourceGuardOperationRequests", s.ResourceGuardOperationRequests) + populate(objectMap, "resourceHealthDetails", k.ResourceHealthDetails) + populate(objectMap, "resourceHealthStatus", k.ResourceHealthStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPinBase. -func (s *SecurityPinBase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KPIResourceHealthDetails. +func (k *KPIResourceHealthDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &s.ResourceGuardOperationRequests) + case "resourceHealthDetails": + err = unpopulate(val, "ResourceHealthDetails", &k.ResourceHealthDetails) + delete(rawMsg, key) + case "resourceHealthStatus": + err = unpopulate(val, "ResourceHealthStatus", &k.ResourceHealthStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Settings. -func (s Settings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KeyAndSecretDetails. +func (k KeyAndSecretDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isCompression", s.IsCompression) - populate(objectMap, "issqlcompression", s.Issqlcompression) - populate(objectMap, "timeZone", s.TimeZone) + populate(objectMap, "bekDetails", k.BekDetails) + populate(objectMap, "encryptionMechanism", k.EncryptionMechanism) + populate(objectMap, "kekDetails", k.KekDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Settings. -func (s *Settings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyAndSecretDetails. +func (k *KeyAndSecretDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "isCompression": - err = unpopulate(val, "IsCompression", &s.IsCompression) + case "bekDetails": + err = unpopulate(val, "BekDetails", &k.BekDetails) delete(rawMsg, key) - case "issqlcompression": - err = unpopulate(val, "Issqlcompression", &s.Issqlcompression) + case "encryptionMechanism": + err = unpopulate(val, "EncryptionMechanism", &k.EncryptionMechanism) delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &s.TimeZone) + case "kekDetails": + err = unpopulate(val, "KekDetails", &k.KekDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SimpleRetentionPolicy. -func (s SimpleRetentionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MabErrorInfo. +func (m MabErrorInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "retentionDuration", s.RetentionDuration) - objectMap["retentionPolicyType"] = "SimpleRetentionPolicy" + populate(objectMap, "errorString", m.ErrorString) + populate(objectMap, "recommendations", m.Recommendations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleRetentionPolicy. -func (s *SimpleRetentionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MabErrorInfo. +func (m *MabErrorInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "retentionDuration": - err = unpopulate(val, "RetentionDuration", &s.RetentionDuration) + case "errorString": + err = unpopulate(val, "ErrorString", &m.ErrorString) delete(rawMsg, key) - case "retentionPolicyType": - err = unpopulate(val, "RetentionPolicyType", &s.RetentionPolicyType) + case "recommendations": + err = unpopulate(val, "Recommendations", &m.Recommendations) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SimpleSchedulePolicy. -func (s SimpleSchedulePolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MabFileFolderProtectedItem. +func (m MabFileFolderProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "hourlySchedule", s.HourlySchedule) - objectMap["schedulePolicyType"] = "SimpleSchedulePolicy" - populate(objectMap, "scheduleRunDays", s.ScheduleRunDays) - populate(objectMap, "scheduleRunFrequency", s.ScheduleRunFrequency) - aux := make([]*dateTimeRFC3339, len(s.ScheduleRunTimes), len(s.ScheduleRunTimes)) - for i := 0; i < len(s.ScheduleRunTimes); i++ { - aux[i] = (*dateTimeRFC3339)(s.ScheduleRunTimes[i]) - } - populate(objectMap, "scheduleRunTimes", aux) - populate(objectMap, "scheduleWeeklyFrequency", s.ScheduleWeeklyFrequency) + populate(objectMap, "backupManagementType", m.BackupManagementType) + populate(objectMap, "backupSetName", m.BackupSetName) + populate(objectMap, "computerName", m.ComputerName) + populate(objectMap, "containerName", m.ContainerName) + populate(objectMap, "createMode", m.CreateMode) + populate(objectMap, "deferredDeleteSyncTimeInUTC", m.DeferredDeleteSyncTimeInUTC) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", m.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", m.DeferredDeleteTimeRemaining) + populate(objectMap, "extendedInfo", m.ExtendedInfo) + populate(objectMap, "friendlyName", m.FriendlyName) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", m.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", m.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", m.IsScheduledForDeferredDelete) + populate(objectMap, "lastBackupStatus", m.LastBackupStatus) + populateDateTimeRFC3339(objectMap, "lastBackupTime", m.LastBackupTime) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", m.LastRecoveryPoint) + populate(objectMap, "policyId", m.PolicyID) + objectMap["protectedItemType"] = "MabFileFolderProtectedItem" + populate(objectMap, "protectionState", m.ProtectionState) + populate(objectMap, "resourceGuardOperationRequests", m.ResourceGuardOperationRequests) + populate(objectMap, "sourceResourceId", m.SourceResourceID) + populate(objectMap, "workloadType", m.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleSchedulePolicy. -func (s *SimpleSchedulePolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MabFileFolderProtectedItem. +func (m *MabFileFolderProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "hourlySchedule": - err = unpopulate(val, "HourlySchedule", &s.HourlySchedule) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &m.BackupManagementType) + delete(rawMsg, key) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &m.BackupSetName) + delete(rawMsg, key) + case "computerName": + err = unpopulate(val, "ComputerName", &m.ComputerName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &m.ContainerName) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &m.CreateMode) + delete(rawMsg, key) + case "deferredDeleteSyncTimeInUTC": + err = unpopulate(val, "DeferredDeleteSyncTimeInUTC", &m.DeferredDeleteSyncTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &m.DeferredDeleteTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &m.DeferredDeleteTimeRemaining) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &m.ExtendedInfo) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &m.FriendlyName) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &m.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &m.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &m.IsScheduledForDeferredDelete) + delete(rawMsg, key) + case "lastBackupStatus": + err = unpopulate(val, "LastBackupStatus", &m.LastBackupStatus) + delete(rawMsg, key) + case "lastBackupTime": + err = unpopulateDateTimeRFC3339(val, "LastBackupTime", &m.LastBackupTime) + delete(rawMsg, key) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &m.LastRecoveryPoint) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &m.PolicyID) delete(rawMsg, key) - case "schedulePolicyType": - err = unpopulate(val, "SchedulePolicyType", &s.SchedulePolicyType) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &m.ProtectedItemType) delete(rawMsg, key) - case "scheduleRunDays": - err = unpopulate(val, "ScheduleRunDays", &s.ScheduleRunDays) + case "protectionState": + err = unpopulate(val, "ProtectionState", &m.ProtectionState) delete(rawMsg, key) - case "scheduleRunFrequency": - err = unpopulate(val, "ScheduleRunFrequency", &s.ScheduleRunFrequency) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &m.ResourceGuardOperationRequests) delete(rawMsg, key) - case "scheduleRunTimes": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "ScheduleRunTimes", &aux) - for _, au := range aux { - s.ScheduleRunTimes = append(s.ScheduleRunTimes, (*time.Time)(au)) - } + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &m.SourceResourceID) delete(rawMsg, key) - case "scheduleWeeklyFrequency": - err = unpopulate(val, "ScheduleWeeklyFrequency", &s.ScheduleWeeklyFrequency) + case "workloadType": + err = unpopulate(val, "WorkloadType", &m.WorkloadType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SimpleSchedulePolicyV2. -func (s SimpleSchedulePolicyV2) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MabFileFolderProtectedItemExtendedInfo. +func (m MabFileFolderProtectedItemExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dailySchedule", s.DailySchedule) - populate(objectMap, "hourlySchedule", s.HourlySchedule) - objectMap["schedulePolicyType"] = "SimpleSchedulePolicyV2" - populate(objectMap, "scheduleRunFrequency", s.ScheduleRunFrequency) - populate(objectMap, "weeklySchedule", s.WeeklySchedule) + populateDateTimeRFC3339(objectMap, "lastRefreshedAt", m.LastRefreshedAt) + populateDateTimeRFC3339(objectMap, "oldestRecoveryPoint", m.OldestRecoveryPoint) + populate(objectMap, "recoveryPointCount", m.RecoveryPointCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleSchedulePolicyV2. -func (s *SimpleSchedulePolicyV2) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MabFileFolderProtectedItemExtendedInfo. +func (m *MabFileFolderProtectedItemExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "dailySchedule": - err = unpopulate(val, "DailySchedule", &s.DailySchedule) - delete(rawMsg, key) - case "hourlySchedule": - err = unpopulate(val, "HourlySchedule", &s.HourlySchedule) - delete(rawMsg, key) - case "schedulePolicyType": - err = unpopulate(val, "SchedulePolicyType", &s.SchedulePolicyType) + case "lastRefreshedAt": + err = unpopulateDateTimeRFC3339(val, "LastRefreshedAt", &m.LastRefreshedAt) delete(rawMsg, key) - case "scheduleRunFrequency": - err = unpopulate(val, "ScheduleRunFrequency", &s.ScheduleRunFrequency) + case "oldestRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "OldestRecoveryPoint", &m.OldestRecoveryPoint) delete(rawMsg, key) - case "weeklySchedule": - err = unpopulate(val, "WeeklySchedule", &s.WeeklySchedule) + case "recoveryPointCount": + err = unpopulate(val, "RecoveryPointCount", &m.RecoveryPointCount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SnapshotBackupAdditionalDetails. -func (s SnapshotBackupAdditionalDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MabJob. +func (m MabJob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "instantRPDetails", s.InstantRPDetails) - populate(objectMap, "instantRpRetentionRangeInDays", s.InstantRpRetentionRangeInDays) - populate(objectMap, "userAssignedManagedIdentityDetails", s.UserAssignedManagedIdentityDetails) + populate(objectMap, "actionsInfo", m.ActionsInfo) + populate(objectMap, "activityId", m.ActivityID) + populate(objectMap, "backupManagementType", m.BackupManagementType) + populate(objectMap, "duration", m.Duration) + populateDateTimeRFC3339(objectMap, "endTime", m.EndTime) + populate(objectMap, "entityFriendlyName", m.EntityFriendlyName) + populate(objectMap, "errorDetails", m.ErrorDetails) + populate(objectMap, "extendedInfo", m.ExtendedInfo) + objectMap["jobType"] = "MabJob" + populate(objectMap, "mabServerName", m.MabServerName) + populate(objectMap, "mabServerType", m.MabServerType) + populate(objectMap, "operation", m.Operation) + populateDateTimeRFC3339(objectMap, "startTime", m.StartTime) + populate(objectMap, "status", m.Status) + populate(objectMap, "workloadType", m.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotBackupAdditionalDetails. -func (s *SnapshotBackupAdditionalDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MabJob. +func (m *MabJob) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "instantRPDetails": - err = unpopulate(val, "InstantRPDetails", &s.InstantRPDetails) + case "actionsInfo": + err = unpopulate(val, "ActionsInfo", &m.ActionsInfo) + delete(rawMsg, key) + case "activityId": + err = unpopulate(val, "ActivityID", &m.ActivityID) + delete(rawMsg, key) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &m.BackupManagementType) + delete(rawMsg, key) + case "duration": + err = unpopulate(val, "Duration", &m.Duration) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &m.EndTime) + delete(rawMsg, key) + case "entityFriendlyName": + err = unpopulate(val, "EntityFriendlyName", &m.EntityFriendlyName) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &m.ExtendedInfo) + delete(rawMsg, key) + case "jobType": + err = unpopulate(val, "JobType", &m.JobType) delete(rawMsg, key) - case "instantRpRetentionRangeInDays": - err = unpopulate(val, "InstantRpRetentionRangeInDays", &s.InstantRpRetentionRangeInDays) + case "mabServerName": + err = unpopulate(val, "MabServerName", &m.MabServerName) + delete(rawMsg, key) + case "mabServerType": + err = unpopulate(val, "MabServerType", &m.MabServerType) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &m.Operation) delete(rawMsg, key) - case "userAssignedManagedIdentityDetails": - err = unpopulate(val, "UserAssignedManagedIdentityDetails", &s.UserAssignedManagedIdentityDetails) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &m.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &m.WorkloadType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SnapshotRestoreParameters. -func (s SnapshotRestoreParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MabJobExtendedInfo. +func (m MabJobExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "logPointInTimeForDBRecovery", s.LogPointInTimeForDBRecovery) - populate(objectMap, "skipAttachAndMount", s.SkipAttachAndMount) + populate(objectMap, "dynamicErrorMessage", m.DynamicErrorMessage) + populate(objectMap, "propertyBag", m.PropertyBag) + populate(objectMap, "tasksList", m.TasksList) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotRestoreParameters. -func (s *SnapshotRestoreParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MabJobExtendedInfo. +func (m *MabJobExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "logPointInTimeForDBRecovery": - err = unpopulate(val, "LogPointInTimeForDBRecovery", &s.LogPointInTimeForDBRecovery) + case "dynamicErrorMessage": + err = unpopulate(val, "DynamicErrorMessage", &m.DynamicErrorMessage) + delete(rawMsg, key) + case "propertyBag": + err = unpopulate(val, "PropertyBag", &m.PropertyBag) delete(rawMsg, key) - case "skipAttachAndMount": - err = unpopulate(val, "SkipAttachAndMount", &s.SkipAttachAndMount) + case "tasksList": + err = unpopulate(val, "TasksList", &m.TasksList) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubProtectionPolicy. -func (s SubProtectionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MabJobTaskDetails. +func (m MabJobTaskDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "policyType", s.PolicyType) - populate(objectMap, "retentionPolicy", s.RetentionPolicy) - populate(objectMap, "schedulePolicy", s.SchedulePolicy) - populate(objectMap, "snapshotBackupAdditionalDetails", s.SnapshotBackupAdditionalDetails) - populate(objectMap, "tieringPolicy", s.TieringPolicy) + populate(objectMap, "duration", m.Duration) + populateDateTimeRFC3339(objectMap, "endTime", m.EndTime) + populateDateTimeRFC3339(objectMap, "startTime", m.StartTime) + populate(objectMap, "status", m.Status) + populate(objectMap, "taskId", m.TaskID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubProtectionPolicy. -func (s *SubProtectionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MabJobTaskDetails. +func (m *MabJobTaskDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "policyType": - err = unpopulate(val, "PolicyType", &s.PolicyType) + case "duration": + err = unpopulate(val, "Duration", &m.Duration) delete(rawMsg, key) - case "retentionPolicy": - s.RetentionPolicy, err = unmarshalRetentionPolicyClassification(val) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &m.EndTime) delete(rawMsg, key) - case "schedulePolicy": - s.SchedulePolicy, err = unmarshalSchedulePolicyClassification(val) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &m.StartTime) delete(rawMsg, key) - case "snapshotBackupAdditionalDetails": - err = unpopulate(val, "SnapshotBackupAdditionalDetails", &s.SnapshotBackupAdditionalDetails) + case "status": + err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) - case "tieringPolicy": - err = unpopulate(val, "TieringPolicy", &s.TieringPolicy) + case "taskId": + err = unpopulate(val, "TaskID", &m.TaskID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TargetAFSRestoreInfo. -func (t TargetAFSRestoreInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NameInfo. +func (n NameInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", t.Name) - populate(objectMap, "targetResourceId", t.TargetResourceID) + populate(objectMap, "localizedValue", n.LocalizedValue) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetAFSRestoreInfo. -func (t *TargetAFSRestoreInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NameInfo. +func (n *NameInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "targetResourceId": - err = unpopulate(val, "TargetResourceID", &t.TargetResourceID) + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &n.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TargetDiskNetworkAccessSettings. -func (t TargetDiskNetworkAccessSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NewErrorResponse. +func (n NewErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "targetDiskAccessId", t.TargetDiskAccessID) - populate(objectMap, "targetDiskNetworkAccessOption", t.TargetDiskNetworkAccessOption) + populate(objectMap, "error", n.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetDiskNetworkAccessSettings. -func (t *TargetDiskNetworkAccessSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NewErrorResponse. +func (n *NewErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "targetDiskAccessId": - err = unpopulate(val, "TargetDiskAccessID", &t.TargetDiskAccessID) - delete(rawMsg, key) - case "targetDiskNetworkAccessOption": - err = unpopulate(val, "TargetDiskNetworkAccessOption", &t.TargetDiskNetworkAccessOption) + case "error": + err = unpopulate(val, "Error", &n.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TargetRestoreInfo. -func (t TargetRestoreInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NewErrorResponseError. +func (n NewErrorResponseError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "containerId", t.ContainerID) - populate(objectMap, "databaseName", t.DatabaseName) - populate(objectMap, "overwriteOption", t.OverwriteOption) - populate(objectMap, "targetDirectoryForFileRestore", t.TargetDirectoryForFileRestore) + populate(objectMap, "additionalInfo", n.AdditionalInfo) + populate(objectMap, "code", n.Code) + populate(objectMap, "details", n.Details) + populate(objectMap, "message", n.Message) + populate(objectMap, "target", n.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetRestoreInfo. -func (t *TargetRestoreInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NewErrorResponseError. +func (n *NewErrorResponseError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "containerId": - err = unpopulate(val, "ContainerID", &t.ContainerID) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &n.AdditionalInfo) delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, "DatabaseName", &t.DatabaseName) + case "code": + err = unpopulate(val, "Code", &n.Code) delete(rawMsg, key) - case "overwriteOption": - err = unpopulate(val, "OverwriteOption", &t.OverwriteOption) + case "details": + err = unpopulate(val, "Details", &n.Details) delete(rawMsg, key) - case "targetDirectoryForFileRestore": - err = unpopulate(val, "TargetDirectoryForFileRestore", &t.TargetDirectoryForFileRestore) + case "message": + err = unpopulate(val, "Message", &n.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &n.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TieringCostInfo. -func (t TieringCostInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = t.ObjectType + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TieringCostInfo. -func (t *TieringCostInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &t.ObjectType) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + o.Properties, err = unmarshalOperationStatusExtendedInfoClassification(val) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TieringCostRehydrationInfo. -func (t TieringCostRehydrationInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusError. +func (o OperationStatusError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = "TieringCostRehydrationInfo" - populate(objectMap, "rehydrationSizeInBytes", t.RehydrationSizeInBytes) - populate(objectMap, "retailRehydrationCostPerGBPerMonth", t.RetailRehydrationCostPerGBPerMonth) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TieringCostRehydrationInfo. -func (t *TieringCostRehydrationInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusError. +func (o *OperationStatusError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &t.ObjectType) - delete(rawMsg, key) - case "rehydrationSizeInBytes": - err = unpopulate(val, "RehydrationSizeInBytes", &t.RehydrationSizeInBytes) + case "code": + err = unpopulate(val, "Code", &o.Code) delete(rawMsg, key) - case "retailRehydrationCostPerGBPerMonth": - err = unpopulate(val, "RetailRehydrationCostPerGBPerMonth", &t.RetailRehydrationCostPerGBPerMonth) + case "message": + err = unpopulate(val, "Message", &o.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TieringCostSavingInfo. -func (t TieringCostSavingInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusExtendedInfo. +func (o OperationStatusExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = "TieringCostSavingInfo" - populate(objectMap, "retailSourceTierCostPerGBPerMonth", t.RetailSourceTierCostPerGBPerMonth) - populate(objectMap, "retailTargetTierCostPerGBPerMonth", t.RetailTargetTierCostPerGBPerMonth) - populate(objectMap, "sourceTierSizeReductionInBytes", t.SourceTierSizeReductionInBytes) - populate(objectMap, "targetTierSizeIncreaseInBytes", t.TargetTierSizeIncreaseInBytes) + objectMap["objectType"] = o.ObjectType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TieringCostSavingInfo. -func (t *TieringCostSavingInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusExtendedInfo. +func (o *OperationStatusExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "objectType": - err = unpopulate(val, "ObjectType", &t.ObjectType) - delete(rawMsg, key) - case "retailSourceTierCostPerGBPerMonth": - err = unpopulate(val, "RetailSourceTierCostPerGBPerMonth", &t.RetailSourceTierCostPerGBPerMonth) - delete(rawMsg, key) - case "retailTargetTierCostPerGBPerMonth": - err = unpopulate(val, "RetailTargetTierCostPerGBPerMonth", &t.RetailTargetTierCostPerGBPerMonth) - delete(rawMsg, key) - case "sourceTierSizeReductionInBytes": - err = unpopulate(val, "SourceTierSizeReductionInBytes", &t.SourceTierSizeReductionInBytes) - delete(rawMsg, key) - case "targetTierSizeIncreaseInBytes": - err = unpopulate(val, "TargetTierSizeIncreaseInBytes", &t.TargetTierSizeIncreaseInBytes) + err = unpopulate(val, "ObjectType", &o.ObjectType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TieringPolicy. -func (t TieringPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusJobExtendedInfo. +func (o OperationStatusJobExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "duration", t.Duration) - populate(objectMap, "durationType", t.DurationType) - populate(objectMap, "tieringMode", t.TieringMode) + populate(objectMap, "jobId", o.JobID) + objectMap["objectType"] = "OperationStatusJobExtendedInfo" return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TieringPolicy. -func (t *TieringPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusJobExtendedInfo. +func (o *OperationStatusJobExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "duration": - err = unpopulate(val, "Duration", &t.Duration) - delete(rawMsg, key) - case "durationType": - err = unpopulate(val, "DurationType", &t.DurationType) + case "jobId": + err = unpopulate(val, "JobID", &o.JobID) delete(rawMsg, key) - case "tieringMode": - err = unpopulate(val, "TieringMode", &t.TieringMode) + case "objectType": + err = unpopulate(val, "ObjectType", &o.ObjectType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TokenInformation. -func (t TokenInformation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusJobsExtendedInfo. +func (o OperationStatusJobsExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "expiryTimeInUtcTicks", t.ExpiryTimeInUTCTicks) - populate(objectMap, "securityPIN", t.SecurityPIN) - populate(objectMap, "token", t.Token) + populate(objectMap, "failedJobsError", o.FailedJobsError) + populate(objectMap, "jobIds", o.JobIDs) + objectMap["objectType"] = "OperationStatusJobsExtendedInfo" return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TokenInformation. -func (t *TokenInformation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusJobsExtendedInfo. +func (o *OperationStatusJobsExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "expiryTimeInUtcTicks": - err = unpopulate(val, "ExpiryTimeInUTCTicks", &t.ExpiryTimeInUTCTicks) + case "failedJobsError": + err = unpopulate(val, "FailedJobsError", &o.FailedJobsError) delete(rawMsg, key) - case "securityPIN": - err = unpopulate(val, "SecurityPIN", &t.SecurityPIN) + case "jobIds": + err = unpopulate(val, "JobIDs", &o.JobIDs) delete(rawMsg, key) - case "token": - err = unpopulate(val, "Token", &t.Token) + case "objectType": + err = unpopulate(val, "ObjectType", &o.ObjectType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TriggerDataMoveRequest. -func (t TriggerDataMoveRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusProvisionILRExtendedInfo. +func (o OperationStatusProvisionILRExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "correlationId", t.CorrelationID) - populate(objectMap, "dataMoveLevel", t.DataMoveLevel) - populate(objectMap, "pauseGC", t.PauseGC) - populate(objectMap, "sourceContainerArmIds", t.SourceContainerArmIDs) - populate(objectMap, "sourceRegion", t.SourceRegion) - populate(objectMap, "sourceResourceId", t.SourceResourceID) + objectMap["objectType"] = "OperationStatusProvisionILRExtendedInfo" + populate(objectMap, "recoveryTarget", o.RecoveryTarget) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerDataMoveRequest. -func (t *TriggerDataMoveRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusProvisionILRExtendedInfo. +func (o *OperationStatusProvisionILRExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "correlationId": - err = unpopulate(val, "CorrelationID", &t.CorrelationID) - delete(rawMsg, key) - case "dataMoveLevel": - err = unpopulate(val, "DataMoveLevel", &t.DataMoveLevel) - delete(rawMsg, key) - case "pauseGC": - err = unpopulate(val, "PauseGC", &t.PauseGC) - delete(rawMsg, key) - case "sourceContainerArmIds": - err = unpopulate(val, "SourceContainerArmIDs", &t.SourceContainerArmIDs) - delete(rawMsg, key) - case "sourceRegion": - err = unpopulate(val, "SourceRegion", &t.SourceRegion) + case "objectType": + err = unpopulate(val, "ObjectType", &o.ObjectType) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &t.SourceResourceID) + case "recoveryTarget": + err = unpopulate(val, "RecoveryTarget", &o.RecoveryTarget) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UnlockDeleteRequest. -func (u UnlockDeleteRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusRecoveryPointExtendedInfo. +func (o OperationStatusRecoveryPointExtendedInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resourceGuardOperationRequests", u.ResourceGuardOperationRequests) - populate(objectMap, "resourceToBeDeleted", u.ResourceToBeDeleted) + populate(objectMap, "deletedBackupItemVersion", o.DeletedBackupItemVersion) + objectMap["objectType"] = "OperationStatusRecoveryPointExtendedInfo" + populate(objectMap, "updatedRecoveryPoint", o.UpdatedRecoveryPoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UnlockDeleteRequest. -func (u *UnlockDeleteRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusRecoveryPointExtendedInfo. +func (o *OperationStatusRecoveryPointExtendedInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &u.ResourceGuardOperationRequests) + case "deletedBackupItemVersion": + err = unpopulate(val, "DeletedBackupItemVersion", &o.DeletedBackupItemVersion) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &o.ObjectType) delete(rawMsg, key) - case "resourceToBeDeleted": - err = unpopulate(val, "ResourceToBeDeleted", &u.ResourceToBeDeleted) + case "updatedRecoveryPoint": + o.UpdatedRecoveryPoint, err = unmarshalRecoveryPointClassification(val) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UnlockDeleteResponse. -func (u UnlockDeleteResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PointInTimeRange. +func (p PointInTimeRange) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "unlockDeleteExpiryTime", u.UnlockDeleteExpiryTime) + populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) + populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UnlockDeleteResponse. -func (u *UnlockDeleteResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PointInTimeRange. +func (p *PointInTimeRange) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "unlockDeleteExpiryTime": - err = unpopulate(val, "UnlockDeleteExpiryTime", &u.UnlockDeleteExpiryTime) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentityProperties. -func (u UserAssignedIdentityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItem. +func (p ProtectedItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", u.ClientID) - populate(objectMap, "principalId", u.PrincipalID) + populate(objectMap, "backupManagementType", p.BackupManagementType) + populate(objectMap, "backupSetName", p.BackupSetName) + populate(objectMap, "containerName", p.ContainerName) + populate(objectMap, "createMode", p.CreateMode) + populateDateTimeRFC3339(objectMap, "deferredDeleteTimeInUTC", p.DeferredDeleteTimeInUTC) + populate(objectMap, "deferredDeleteTimeRemaining", p.DeferredDeleteTimeRemaining) + populate(objectMap, "isDeferredDeleteScheduleUpcoming", p.IsDeferredDeleteScheduleUpcoming) + populate(objectMap, "isRehydrate", p.IsRehydrate) + populate(objectMap, "isScheduledForDeferredDelete", p.IsScheduledForDeferredDelete) + populateDateTimeRFC3339(objectMap, "lastRecoveryPoint", p.LastRecoveryPoint) + populate(objectMap, "policyId", p.PolicyID) + objectMap["protectedItemType"] = p.ProtectedItemType + populate(objectMap, "resourceGuardOperationRequests", p.ResourceGuardOperationRequests) + populate(objectMap, "sourceResourceId", p.SourceResourceID) + populate(objectMap, "workloadType", p.WorkloadType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentityProperties. -func (u *UserAssignedIdentityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItem. +func (p *ProtectedItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) + delete(rawMsg, key) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &p.BackupSetName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &p.ContainerName) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &p.CreateMode) + delete(rawMsg, key) + case "deferredDeleteTimeInUTC": + err = unpopulateDateTimeRFC3339(val, "DeferredDeleteTimeInUTC", &p.DeferredDeleteTimeInUTC) + delete(rawMsg, key) + case "deferredDeleteTimeRemaining": + err = unpopulate(val, "DeferredDeleteTimeRemaining", &p.DeferredDeleteTimeRemaining) + delete(rawMsg, key) + case "isDeferredDeleteScheduleUpcoming": + err = unpopulate(val, "IsDeferredDeleteScheduleUpcoming", &p.IsDeferredDeleteScheduleUpcoming) + delete(rawMsg, key) + case "isRehydrate": + err = unpopulate(val, "IsRehydrate", &p.IsRehydrate) + delete(rawMsg, key) + case "isScheduledForDeferredDelete": + err = unpopulate(val, "IsScheduledForDeferredDelete", &p.IsScheduledForDeferredDelete) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &u.PrincipalID) + case "lastRecoveryPoint": + err = unpopulateDateTimeRFC3339(val, "LastRecoveryPoint", &p.LastRecoveryPoint) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &p.PolicyID) + delete(rawMsg, key) + case "protectedItemType": + err = unpopulate(val, "ProtectedItemType", &p.ProtectedItemType) + delete(rawMsg, key) + case "resourceGuardOperationRequests": + err = unpopulate(val, "ResourceGuardOperationRequests", &p.ResourceGuardOperationRequests) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &p.SourceResourceID) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &p.WorkloadType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserAssignedManagedIdentityDetails. -func (u UserAssignedManagedIdentityDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemQueryObject. +func (p ProtectedItemQueryObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identityArmId", u.IdentityArmID) - populate(objectMap, "identityName", u.IdentityName) - populate(objectMap, "userAssignedIdentityProperties", u.UserAssignedIdentityProperties) + populate(objectMap, "backupEngineName", p.BackupEngineName) + populate(objectMap, "backupManagementType", p.BackupManagementType) + populate(objectMap, "backupSetName", p.BackupSetName) + populate(objectMap, "containerName", p.ContainerName) + populate(objectMap, "fabricName", p.FabricName) + populate(objectMap, "friendlyName", p.FriendlyName) + populate(objectMap, "healthState", p.HealthState) + populate(objectMap, "itemType", p.ItemType) + populate(objectMap, "policyName", p.PolicyName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedManagedIdentityDetails. -func (u *UserAssignedManagedIdentityDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemQueryObject. +func (p *ProtectedItemQueryObject) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "identityArmId": - err = unpopulate(val, "IdentityArmID", &u.IdentityArmID) + case "backupEngineName": + err = unpopulate(val, "BackupEngineName", &p.BackupEngineName) + delete(rawMsg, key) + case "backupManagementType": + err = unpopulate(val, "BackupManagementType", &p.BackupManagementType) + delete(rawMsg, key) + case "backupSetName": + err = unpopulate(val, "BackupSetName", &p.BackupSetName) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &p.ContainerName) + delete(rawMsg, key) + case "fabricName": + err = unpopulate(val, "FabricName", &p.FabricName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &p.FriendlyName) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, "HealthState", &p.HealthState) delete(rawMsg, key) - case "identityName": - err = unpopulate(val, "IdentityName", &u.IdentityName) + case "itemType": + err = unpopulate(val, "ItemType", &p.ItemType) delete(rawMsg, key) - case "userAssignedIdentityProperties": - err = unpopulate(val, "UserAssignedIdentityProperties", &u.UserAssignedIdentityProperties) + case "policyName": + err = unpopulate(val, "PolicyName", &p.PolicyName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidateIaasVMRestoreOperationRequest. -func (v ValidateIaasVMRestoreOperationRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemResource. +func (p ProtectedItemResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = "ValidateIaasVMRestoreOperationRequest" - populate(objectMap, "restoreRequest", v.RestoreRequest) + populate(objectMap, "eTag", p.ETag) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateIaasVMRestoreOperationRequest. -func (v *ValidateIaasVMRestoreOperationRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemResource. +func (p *ProtectedItemResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &v.ObjectType) + case "eTag": + err = unpopulate(val, "ETag", &p.ETag) delete(rawMsg, key) - case "restoreRequest": - v.RestoreRequest, err = unmarshalRestoreRequestClassification(val) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + p.Properties, err = unmarshalProtectedItemClassification(val) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidateOperationRequest. -func (v ValidateOperationRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemResourceList. +func (p ProtectedItemResourceList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = v.ObjectType + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateOperationRequest. -func (v *ValidateOperationRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemResourceList. +func (p *ProtectedItemResourceList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &v.ObjectType) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidateOperationRequestResource. -func (v ValidateOperationRequestResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPoint. +func (r RecoveryPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) - populate(objectMap, "properties", v.Properties) + objectMap["objectType"] = r.ObjectType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateOperationRequestResource. -func (v *ValidateOperationRequestResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPoint. +func (r *RecoveryPoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) - case "properties": - v.Properties, err = unmarshalValidateOperationRequestClassification(val) + case "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidateOperationResponse. -func (v ValidateOperationResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointDiskConfiguration. +func (r RecoveryPointDiskConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "validationResults", v.ValidationResults) + populate(objectMap, "excludedDiskList", r.ExcludedDiskList) + populate(objectMap, "includedDiskList", r.IncludedDiskList) + populate(objectMap, "numberOfDisksAttachedToVm", r.NumberOfDisksAttachedToVM) + populate(objectMap, "numberOfDisksIncludedInBackup", r.NumberOfDisksIncludedInBackup) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateOperationResponse. -func (v *ValidateOperationResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointDiskConfiguration. +func (r *RecoveryPointDiskConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "validationResults": - err = unpopulate(val, "ValidationResults", &v.ValidationResults) + case "excludedDiskList": + err = unpopulate(val, "ExcludedDiskList", &r.ExcludedDiskList) + delete(rawMsg, key) + case "includedDiskList": + err = unpopulate(val, "IncludedDiskList", &r.IncludedDiskList) + delete(rawMsg, key) + case "numberOfDisksAttachedToVm": + err = unpopulate(val, "NumberOfDisksAttachedToVM", &r.NumberOfDisksAttachedToVM) + delete(rawMsg, key) + case "numberOfDisksIncludedInBackup": + err = unpopulate(val, "NumberOfDisksIncludedInBackup", &r.NumberOfDisksIncludedInBackup) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidateOperationsResponse. -func (v ValidateOperationsResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointMoveReadinessInfo. +func (r RecoveryPointMoveReadinessInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "validateOperationResponse", v.ValidateOperationResponse) + populate(objectMap, "additionalInfo", r.AdditionalInfo) + populate(objectMap, "isReadyForMove", r.IsReadyForMove) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateOperationsResponse. -func (v *ValidateOperationsResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointMoveReadinessInfo. +func (r *RecoveryPointMoveReadinessInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "validateOperationResponse": - err = unpopulate(val, "ValidateOperationResponse", &v.ValidateOperationResponse) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &r.AdditionalInfo) + delete(rawMsg, key) + case "isReadyForMove": + err = unpopulate(val, "IsReadyForMove", &r.IsReadyForMove) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidateRestoreOperationRequest. -func (v ValidateRestoreOperationRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointProperties. +func (r RecoveryPointProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = "ValidateRestoreOperationRequest" - populate(objectMap, "restoreRequest", v.RestoreRequest) + populate(objectMap, "expiryTime", r.ExpiryTime) + populate(objectMap, "isSoftDeleted", r.IsSoftDeleted) + populate(objectMap, "ruleName", r.RuleName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateRestoreOperationRequest. -func (v *ValidateRestoreOperationRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointProperties. +func (r *RecoveryPointProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &v.ObjectType) + case "expiryTime": + err = unpopulate(val, "ExpiryTime", &r.ExpiryTime) delete(rawMsg, key) - case "restoreRequest": - v.RestoreRequest, err = unmarshalRestoreRequestClassification(val) + case "isSoftDeleted": + err = unpopulate(val, "IsSoftDeleted", &r.IsSoftDeleted) + delete(rawMsg, key) + case "ruleName": + err = unpopulate(val, "RuleName", &r.RuleName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultJob. -func (v VaultJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointResource. +func (r RecoveryPointResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsInfo", v.ActionsInfo) - populate(objectMap, "activityId", v.ActivityID) - populate(objectMap, "backupManagementType", v.BackupManagementType) - populate(objectMap, "duration", v.Duration) - populateDateTimeRFC3339(objectMap, "endTime", v.EndTime) - populate(objectMap, "entityFriendlyName", v.EntityFriendlyName) - populate(objectMap, "errorDetails", v.ErrorDetails) - populate(objectMap, "extendedInfo", v.ExtendedInfo) - objectMap["jobType"] = "VaultJob" - populate(objectMap, "operation", v.Operation) - populateDateTimeRFC3339(objectMap, "startTime", v.StartTime) - populate(objectMap, "status", v.Status) + populate(objectMap, "eTag", r.ETag) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultJob. -func (v *VaultJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointResource. +func (r *RecoveryPointResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "actionsInfo": - err = unpopulate(val, "ActionsInfo", &v.ActionsInfo) - delete(rawMsg, key) - case "activityId": - err = unpopulate(val, "ActivityID", &v.ActivityID) - delete(rawMsg, key) - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &v.BackupManagementType) - delete(rawMsg, key) - case "duration": - err = unpopulate(val, "Duration", &v.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &v.EndTime) - delete(rawMsg, key) - case "entityFriendlyName": - err = unpopulate(val, "EntityFriendlyName", &v.EntityFriendlyName) + case "eTag": + err = unpopulate(val, "ETag", &r.ETag) delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &v.ErrorDetails) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &v.ExtendedInfo) + case "location": + err = unpopulate(val, "Location", &r.Location) delete(rawMsg, key) - case "jobType": - err = unpopulate(val, "JobType", &v.JobType) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &v.Operation) + case "properties": + r.Properties, err = unmarshalRecoveryPointClassification(val) delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &v.StartTime) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &v.Status) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultJobErrorInfo. -func (v VaultJobErrorInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointResourceList. +func (r RecoveryPointResourceList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", v.ErrorCode) - populate(objectMap, "errorString", v.ErrorString) - populate(objectMap, "recommendations", v.Recommendations) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultJobErrorInfo. -func (v *VaultJobErrorInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointResourceList. +func (r *RecoveryPointResourceList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "errorCode": - err = unpopulate(val, "ErrorCode", &v.ErrorCode) - delete(rawMsg, key) - case "errorString": - err = unpopulate(val, "ErrorString", &v.ErrorString) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "recommendations": - err = unpopulate(val, "Recommendations", &v.Recommendations) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultJobExtendedInfo. -func (v VaultJobExtendedInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointTierInformation. +func (r RecoveryPointTierInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "propertyBag", v.PropertyBag) + populate(objectMap, "extendedInfo", r.ExtendedInfo) + populate(objectMap, "status", r.Status) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultJobExtendedInfo. -func (v *VaultJobExtendedInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointTierInformation. +func (r *RecoveryPointTierInformation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "propertyBag": - err = unpopulate(val, "PropertyBag", &v.PropertyBag) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &r.ExtendedInfo) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultRetentionPolicy. -func (v VaultRetentionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "snapshotRetentionInDays", v.SnapshotRetentionInDays) - populate(objectMap, "vaultRetention", v.VaultRetention) + populate(objectMap, "eTag", r.ETag) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultRetentionPolicy. -func (v *VaultRetentionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "snapshotRetentionInDays": - err = unpopulate(val, "SnapshotRetentionInDays", &v.SnapshotRetentionInDays) + case "eTag": + err = unpopulate(val, "ETag", &r.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) - case "vaultRetention": - v.VaultRetention, err = unmarshalRetentionPolicyClassification(val) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultStorageConfigOperationResultResponse. -func (v VaultStorageConfigOperationResultResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceHealthDetails. +func (r ResourceHealthDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["objectType"] = v.ObjectType + populate(objectMap, "code", r.Code) + populate(objectMap, "message", r.Message) + populate(objectMap, "recommendations", r.Recommendations) + populate(objectMap, "title", r.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultStorageConfigOperationResultResponse. -func (v *VaultStorageConfigOperationResultResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceHealthDetails. +func (r *ResourceHealthDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &v.ObjectType) + case "code": + err = unpopulate(val, "Code", &r.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "recommendations": + err = unpopulate(val, "Recommendations", &r.Recommendations) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &r.Title) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WeeklyRetentionFormat. -func (w WeeklyRetentionFormat) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceList. +func (r ResourceList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "daysOfTheWeek", w.DaysOfTheWeek) - populate(objectMap, "weeksOfTheMonth", w.WeeksOfTheMonth) + populate(objectMap, "nextLink", r.NextLink) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WeeklyRetentionFormat. -func (w *WeeklyRetentionFormat) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceList. +func (r *ResourceList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "daysOfTheWeek": - err = unpopulate(val, "DaysOfTheWeek", &w.DaysOfTheWeek) - delete(rawMsg, key) - case "weeksOfTheMonth": - err = unpopulate(val, "WeeksOfTheMonth", &w.WeeksOfTheMonth) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WeeklyRetentionSchedule. -func (w WeeklyRetentionSchedule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestoreFileSpecs. +func (r RestoreFileSpecs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "daysOfTheWeek", w.DaysOfTheWeek) - populate(objectMap, "retentionDuration", w.RetentionDuration) - aux := make([]*dateTimeRFC3339, len(w.RetentionTimes), len(w.RetentionTimes)) - for i := 0; i < len(w.RetentionTimes); i++ { - aux[i] = (*dateTimeRFC3339)(w.RetentionTimes[i]) - } - populate(objectMap, "retentionTimes", aux) + populate(objectMap, "fileSpecType", r.FileSpecType) + populate(objectMap, "path", r.Path) + populate(objectMap, "targetFolderPath", r.TargetFolderPath) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WeeklyRetentionSchedule. -func (w *WeeklyRetentionSchedule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreFileSpecs. +func (r *RestoreFileSpecs) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "daysOfTheWeek": - err = unpopulate(val, "DaysOfTheWeek", &w.DaysOfTheWeek) + case "fileSpecType": + err = unpopulate(val, "FileSpecType", &r.FileSpecType) delete(rawMsg, key) - case "retentionDuration": - err = unpopulate(val, "RetentionDuration", &w.RetentionDuration) + case "path": + err = unpopulate(val, "Path", &r.Path) delete(rawMsg, key) - case "retentionTimes": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "RetentionTimes", &aux) - for _, au := range aux { - w.RetentionTimes = append(w.RetentionTimes, (*time.Time)(au)) - } + case "targetFolderPath": + err = unpopulate(val, "TargetFolderPath", &r.TargetFolderPath) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WeeklySchedule. -func (w WeeklySchedule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestoreRequest. +func (r RestoreRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "scheduleRunDays", w.ScheduleRunDays) - aux := make([]*dateTimeRFC3339, len(w.ScheduleRunTimes), len(w.ScheduleRunTimes)) - for i := 0; i < len(w.ScheduleRunTimes); i++ { - aux[i] = (*dateTimeRFC3339)(w.ScheduleRunTimes[i]) - } - populate(objectMap, "scheduleRunTimes", aux) + objectMap["objectType"] = r.ObjectType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WeeklySchedule. -func (w *WeeklySchedule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreRequest. +func (r *RestoreRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "scheduleRunDays": - err = unpopulate(val, "ScheduleRunDays", &w.ScheduleRunDays) - delete(rawMsg, key) - case "scheduleRunTimes": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "ScheduleRunTimes", &aux) - for _, au := range aux { - w.ScheduleRunTimes = append(w.ScheduleRunTimes, (*time.Time)(au)) - } + case "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkloadInquiryDetails. -func (w WorkloadInquiryDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLDataDirectory. +func (s SQLDataDirectory) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "inquiryValidation", w.InquiryValidation) - populate(objectMap, "itemCount", w.ItemCount) - populate(objectMap, "type", w.Type) + populate(objectMap, "logicalName", s.LogicalName) + populate(objectMap, "path", s.Path) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadInquiryDetails. -func (w *WorkloadInquiryDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDataDirectory. +func (s *SQLDataDirectory) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "inquiryValidation": - err = unpopulate(val, "InquiryValidation", &w.InquiryValidation) + case "logicalName": + err = unpopulate(val, "LogicalName", &s.LogicalName) delete(rawMsg, key) - case "itemCount": - err = unpopulate(val, "ItemCount", &w.ItemCount) + case "path": + err = unpopulate(val, "Path", &s.Path) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &w.Type) + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkloadItem. -func (w WorkloadItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLDataDirectoryMapping. +func (s SQLDataDirectoryMapping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupManagementType", w.BackupManagementType) - populate(objectMap, "friendlyName", w.FriendlyName) - populate(objectMap, "protectionState", w.ProtectionState) - objectMap["workloadItemType"] = w.WorkloadItemType - populate(objectMap, "workloadType", w.WorkloadType) + populate(objectMap, "mappingType", s.MappingType) + populate(objectMap, "sourceLogicalName", s.SourceLogicalName) + populate(objectMap, "sourcePath", s.SourcePath) + populate(objectMap, "targetPath", s.TargetPath) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadItem. -func (w *WorkloadItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDataDirectoryMapping. +func (s *SQLDataDirectoryMapping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "backupManagementType": - err = unpopulate(val, "BackupManagementType", &w.BackupManagementType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &w.FriendlyName) + case "mappingType": + err = unpopulate(val, "MappingType", &s.MappingType) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &w.ProtectionState) + case "sourceLogicalName": + err = unpopulate(val, "SourceLogicalName", &s.SourceLogicalName) delete(rawMsg, key) - case "workloadItemType": - err = unpopulate(val, "WorkloadItemType", &w.WorkloadItemType) + case "sourcePath": + err = unpopulate(val, "SourcePath", &s.SourcePath) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &w.WorkloadType) + case "targetPath": + err = unpopulate(val, "TargetPath", &s.TargetPath) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkloadItemResource. -func (w WorkloadItemResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetAFSRestoreInfo. +func (t TargetAFSRestoreInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eTag", w.ETag) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "type", w.Type) + populate(objectMap, "name", t.Name) + populate(objectMap, "targetResourceId", t.TargetResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadItemResource. -func (w *WorkloadItemResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetAFSRestoreInfo. +func (t *TargetAFSRestoreInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &w.ETag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &w.Location) - delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - w.Properties, err = unmarshalWorkloadItemClassification(val) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &w.Tags) + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &w.Type) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &t.TargetResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkloadItemResourceList. -func (w WorkloadItemResourceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetRestoreInfo. +func (t TargetRestoreInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) + populate(objectMap, "containerId", t.ContainerID) + populate(objectMap, "databaseName", t.DatabaseName) + populate(objectMap, "overwriteOption", t.OverwriteOption) + populate(objectMap, "targetDirectoryForFileRestore", t.TargetDirectoryForFileRestore) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadItemResourceList. -func (w *WorkloadItemResourceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetRestoreInfo. +func (t *TargetRestoreInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &w.NextLink) + case "containerId": + err = unpopulate(val, "ContainerID", &t.ContainerID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) + case "databaseName": + err = unpopulate(val, "DatabaseName", &t.DatabaseName) + delete(rawMsg, key) + case "overwriteOption": + err = unpopulate(val, "OverwriteOption", &t.OverwriteOption) + delete(rawMsg, key) + case "targetDirectoryForFileRestore": + err = unpopulate(val, "TargetDirectoryForFileRestore", &t.TargetDirectoryForFileRestore) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkloadProtectableItem. -func (w WorkloadProtectableItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkloadCrrAccessToken. +func (w WorkloadCrrAccessToken) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "accessTokenString", w.AccessTokenString) + populate(objectMap, "bMSActiveRegion", w.BMSActiveRegion) populate(objectMap, "backupManagementType", w.BackupManagementType) - populate(objectMap, "friendlyName", w.FriendlyName) - objectMap["protectableItemType"] = w.ProtectableItemType - populate(objectMap, "protectionState", w.ProtectionState) - populate(objectMap, "workloadType", w.WorkloadType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProtectableItem. -func (w *WorkloadProtectableItem) UnmarshalJSON(data []byte) error { + populate(objectMap, "containerId", w.ContainerID) + populate(objectMap, "containerName", w.ContainerName) + populate(objectMap, "containerType", w.ContainerType) + populate(objectMap, "coordinatorServiceStampId", w.CoordinatorServiceStampID) + populate(objectMap, "coordinatorServiceStampUri", w.CoordinatorServiceStampURI) + populate(objectMap, "datasourceContainerName", w.DatasourceContainerName) + populate(objectMap, "datasourceId", w.DatasourceID) + populate(objectMap, "datasourceName", w.DatasourceName) + populate(objectMap, "datasourceType", w.DatasourceType) + objectMap["objectType"] = "WorkloadCrrAccessToken" + populate(objectMap, "policyId", w.PolicyID) + populate(objectMap, "policyName", w.PolicyName) + populate(objectMap, "protectableObjectContainerHostOsName", w.ProtectableObjectContainerHostOsName) + populate(objectMap, "protectableObjectFriendlyName", w.ProtectableObjectFriendlyName) + populate(objectMap, "protectableObjectParentLogicalContainerName", w.ProtectableObjectParentLogicalContainerName) + populate(objectMap, "protectableObjectProtectionState", w.ProtectableObjectProtectionState) + populate(objectMap, "protectableObjectUniqueName", w.ProtectableObjectUniqueName) + populate(objectMap, "protectableObjectWorkloadType", w.ProtectableObjectWorkloadType) + populate(objectMap, "protectionContainerId", w.ProtectionContainerID) + populate(objectMap, "protectionServiceStampId", w.ProtectionServiceStampID) + populate(objectMap, "protectionServiceStampUri", w.ProtectionServiceStampURI) + populate(objectMap, "recoveryPointId", w.RecoveryPointID) + populate(objectMap, "recoveryPointTime", w.RecoveryPointTime) + populate(objectMap, "resourceGroupName", w.ResourceGroupName) + populate(objectMap, "resourceId", w.ResourceID) + populate(objectMap, "resourceName", w.ResourceName) + populate(objectMap, "rpIsManagedVirtualMachine", w.RpIsManagedVirtualMachine) + populate(objectMap, "rpOriginalSAOption", w.RpOriginalSAOption) + populate(objectMap, "rpTierInformation", w.RpTierInformation) + populate(objectMap, "rpVMSizeDescription", w.RpVMSizeDescription) + populate(objectMap, "subscriptionId", w.SubscriptionID) + populate(objectMap, "tokenExtendedInformation", w.TokenExtendedInformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadCrrAccessToken. +func (w *WorkloadCrrAccessToken) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -15164,161 +6332,114 @@ func (w *WorkloadProtectableItem) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "accessTokenString": + err = unpopulate(val, "AccessTokenString", &w.AccessTokenString) + delete(rawMsg, key) + case "bMSActiveRegion": + err = unpopulate(val, "BMSActiveRegion", &w.BMSActiveRegion) + delete(rawMsg, key) case "backupManagementType": err = unpopulate(val, "BackupManagementType", &w.BackupManagementType) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &w.FriendlyName) + case "containerId": + err = unpopulate(val, "ContainerID", &w.ContainerID) delete(rawMsg, key) - case "protectableItemType": - err = unpopulate(val, "ProtectableItemType", &w.ProtectableItemType) + case "containerName": + err = unpopulate(val, "ContainerName", &w.ContainerName) delete(rawMsg, key) - case "protectionState": - err = unpopulate(val, "ProtectionState", &w.ProtectionState) + case "containerType": + err = unpopulate(val, "ContainerType", &w.ContainerType) delete(rawMsg, key) - case "workloadType": - err = unpopulate(val, "WorkloadType", &w.WorkloadType) + case "coordinatorServiceStampId": + err = unpopulate(val, "CoordinatorServiceStampID", &w.CoordinatorServiceStampID) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadProtectableItemResource. -func (w WorkloadProtectableItemResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eTag", w.ETag) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProtectableItemResource. -func (w *WorkloadProtectableItemResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eTag": - err = unpopulate(val, "ETag", &w.ETag) + case "coordinatorServiceStampUri": + err = unpopulate(val, "CoordinatorServiceStampURI", &w.CoordinatorServiceStampURI) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &w.ID) + case "datasourceContainerName": + err = unpopulate(val, "DatasourceContainerName", &w.DatasourceContainerName) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &w.Location) + case "datasourceId": + err = unpopulate(val, "DatasourceID", &w.DatasourceID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) + case "datasourceName": + err = unpopulate(val, "DatasourceName", &w.DatasourceName) delete(rawMsg, key) - case "properties": - w.Properties, err = unmarshalWorkloadProtectableItemClassification(val) + case "datasourceType": + err = unpopulate(val, "DatasourceType", &w.DatasourceType) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &w.Tags) + case "objectType": + err = unpopulate(val, "ObjectType", &w.ObjectType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &w.Type) + case "policyId": + err = unpopulate(val, "PolicyID", &w.PolicyID) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkloadProtectableItemResourceList. -func (w WorkloadProtectableItemResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadProtectableItemResourceList. -func (w *WorkloadProtectableItemResourceList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &w.NextLink) + case "policyName": + err = unpopulate(val, "PolicyName", &w.PolicyName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) + case "protectableObjectContainerHostOsName": + err = unpopulate(val, "ProtectableObjectContainerHostOsName", &w.ProtectableObjectContainerHostOsName) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type YearlyRetentionSchedule. -func (y YearlyRetentionSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "monthsOfYear", y.MonthsOfYear) - populate(objectMap, "retentionDuration", y.RetentionDuration) - populate(objectMap, "retentionScheduleDaily", y.RetentionScheduleDaily) - populate(objectMap, "retentionScheduleFormatType", y.RetentionScheduleFormatType) - populate(objectMap, "retentionScheduleWeekly", y.RetentionScheduleWeekly) - aux := make([]*dateTimeRFC3339, len(y.RetentionTimes), len(y.RetentionTimes)) - for i := 0; i < len(y.RetentionTimes); i++ { - aux[i] = (*dateTimeRFC3339)(y.RetentionTimes[i]) - } - populate(objectMap, "retentionTimes", aux) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type YearlyRetentionSchedule. -func (y *YearlyRetentionSchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", y, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "monthsOfYear": - err = unpopulate(val, "MonthsOfYear", &y.MonthsOfYear) + case "protectableObjectFriendlyName": + err = unpopulate(val, "ProtectableObjectFriendlyName", &w.ProtectableObjectFriendlyName) + delete(rawMsg, key) + case "protectableObjectParentLogicalContainerName": + err = unpopulate(val, "ProtectableObjectParentLogicalContainerName", &w.ProtectableObjectParentLogicalContainerName) + delete(rawMsg, key) + case "protectableObjectProtectionState": + err = unpopulate(val, "ProtectableObjectProtectionState", &w.ProtectableObjectProtectionState) delete(rawMsg, key) - case "retentionDuration": - err = unpopulate(val, "RetentionDuration", &y.RetentionDuration) + case "protectableObjectUniqueName": + err = unpopulate(val, "ProtectableObjectUniqueName", &w.ProtectableObjectUniqueName) delete(rawMsg, key) - case "retentionScheduleDaily": - err = unpopulate(val, "RetentionScheduleDaily", &y.RetentionScheduleDaily) + case "protectableObjectWorkloadType": + err = unpopulate(val, "ProtectableObjectWorkloadType", &w.ProtectableObjectWorkloadType) delete(rawMsg, key) - case "retentionScheduleFormatType": - err = unpopulate(val, "RetentionScheduleFormatType", &y.RetentionScheduleFormatType) + case "protectionContainerId": + err = unpopulate(val, "ProtectionContainerID", &w.ProtectionContainerID) delete(rawMsg, key) - case "retentionScheduleWeekly": - err = unpopulate(val, "RetentionScheduleWeekly", &y.RetentionScheduleWeekly) + case "protectionServiceStampId": + err = unpopulate(val, "ProtectionServiceStampID", &w.ProtectionServiceStampID) delete(rawMsg, key) - case "retentionTimes": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "RetentionTimes", &aux) - for _, au := range aux { - y.RetentionTimes = append(y.RetentionTimes, (*time.Time)(au)) - } + case "protectionServiceStampUri": + err = unpopulate(val, "ProtectionServiceStampURI", &w.ProtectionServiceStampURI) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, "RecoveryPointID", &w.RecoveryPointID) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulate(val, "RecoveryPointTime", &w.RecoveryPointTime) + delete(rawMsg, key) + case "resourceGroupName": + err = unpopulate(val, "ResourceGroupName", &w.ResourceGroupName) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &w.ResourceID) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &w.ResourceName) + delete(rawMsg, key) + case "rpIsManagedVirtualMachine": + err = unpopulate(val, "RpIsManagedVirtualMachine", &w.RpIsManagedVirtualMachine) + delete(rawMsg, key) + case "rpOriginalSAOption": + err = unpopulate(val, "RpOriginalSAOption", &w.RpOriginalSAOption) + delete(rawMsg, key) + case "rpTierInformation": + err = unpopulate(val, "RpTierInformation", &w.RpTierInformation) + delete(rawMsg, key) + case "rpVMSizeDescription": + err = unpopulate(val, "RpVMSizeDescription", &w.RpVMSizeDescription) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &w.SubscriptionID) + delete(rawMsg, key) + case "tokenExtendedInformation": + err = unpopulate(val, "TokenExtendedInformation", &w.TokenExtendedInformation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", y, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operation_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operation_client.go deleted file mode 100644 index 2c4571e3e56c..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operation_client.go +++ /dev/null @@ -1,112 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// OperationClient contains the methods for the Operation group. -// Don't use this type directly, use NewOperationClient() instead. -type OperationClient struct { - internal *arm.Client - subscriptionID string -} - -// NewOperationClient creates a new instance of OperationClient 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 NewOperationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperationClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Validate - Validate operation for specified backed up item. This is a synchronous operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - resource validate operation request -// - options - OperationClientValidateOptions contains the optional parameters for the OperationClient.Validate method. -func (client *OperationClient) Validate(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateOperationRequestResource, options *OperationClientValidateOptions) (OperationClientValidateResponse, error) { - var err error - const operationName = "OperationClient.Validate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.validateCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return OperationClientValidateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperationClientValidateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return OperationClientValidateResponse{}, err - } - resp, err := client.validateHandleResponse(httpResp) - return resp, err -} - -// validateCreateRequest creates the Validate request. -func (client *OperationClient) validateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateOperationRequestResource, options *OperationClientValidateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// validateHandleResponse handles the Validate response. -func (client *OperationClient) validateHandleResponse(resp *http.Response) (OperationClientValidateResponse, error) { - result := OperationClientValidateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ValidateOperationsResponse); err != nil { - return OperationClientValidateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operation_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operation_client_example_test.go deleted file mode 100644 index 9a1f4561c9e5..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operation_client_example_test.go +++ /dev/null @@ -1,127 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperation_RestoreDisk.json -func ExampleOperationClient_Validate_validateOperation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationClient().Validate(ctx, "testVault", "testRG", armrecoveryservicesbackup.ValidateOperationRequestResource{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVault/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;testRG;testvmName/protectedItems/VM;iaasvmcontainerv2;testRG;testvmName/recoveryPoints/348916168024334"), - Properties: &armrecoveryservicesbackup.ValidateIaasVMRestoreOperationRequest{ - ObjectType: to.Ptr("ValidateIaasVMRestoreOperationRequest"), - RestoreRequest: &armrecoveryservicesbackup.IaasVMRestoreRequest{ - ObjectType: to.Ptr("IaasVMRestoreRequest"), - CreateNewCloudService: to.Ptr(true), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - IdentityInfo: &armrecoveryservicesbackup.IdentityInfo{ - IsSystemAssignedIdentity: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi"), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeRestoreDisks), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ValidateOperationsResponse = armrecoveryservicesbackup.ValidateOperationsResponse{ - // ValidateOperationResponse: &armrecoveryservicesbackup.ValidateOperationResponse{ - // ValidationResults: []*armrecoveryservicesbackup.ErrorDetail{ - // { - // Code: to.Ptr("UserErrorCoreCountSubscriptionQuotaReached"), - // Message: to.Ptr("Core Count subscription quota has been reached."), - // Recommendations: []*string{ - // to.Ptr("Contact Azure support to increase the limits.")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperation_RestoreDisk_IdentityBasedRestoreDetails.json -func ExampleOperationClient_Validate_validateOperationWithIdentityBasedRestoreDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationClient().Validate(ctx, "testVault", "testRG", armrecoveryservicesbackup.ValidateOperationRequestResource{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVault/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;testRG;testvmName/protectedItems/VM;iaasvmcontainerv2;testRG;testvmName/recoveryPoints/348916168024334"), - Properties: &armrecoveryservicesbackup.ValidateIaasVMRestoreOperationRequest{ - ObjectType: to.Ptr("ValidateIaasVMRestoreOperationRequest"), - RestoreRequest: &armrecoveryservicesbackup.IaasVMRestoreRequest{ - ObjectType: to.Ptr("IaasVMRestoreRequest"), - CreateNewCloudService: to.Ptr(true), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - IdentityBasedRestoreDetails: &armrecoveryservicesbackup.IdentityBasedRestoreDetails{ - TargetStorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"), - }, - IdentityInfo: &armrecoveryservicesbackup.IdentityInfo{ - IsSystemAssignedIdentity: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi"), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeRestoreDisks), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ValidateOperationsResponse = armrecoveryservicesbackup.ValidateOperationsResponse{ - // ValidateOperationResponse: &armrecoveryservicesbackup.ValidateOperationResponse{ - // ValidationResults: []*armrecoveryservicesbackup.ErrorDetail{ - // { - // Code: to.Ptr("UserErrorCoreCountSubscriptionQuotaReached"), - // Message: to.Ptr("Core Count subscription quota has been reached."), - // Recommendations: []*string{ - // to.Ptr("Contact Azure support to increase the limits.")}, - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operations_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operations_client.go deleted file mode 100644 index b1738721083e..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operations_client.go +++ /dev/null @@ -1,88 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// OperationsClient contains the methods for the Operations group. -// Don't use this type directly, use NewOperationsClient() instead. -type OperationsClient struct { - internal *arm.Client -} - -// 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, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperationsClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Returns the list of available operations. -// -// Generated from API version 2024-04-01 -// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ - More: func(page OperationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return OperationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.RecoveryServices/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClientDiscoveryResponse); err != nil { - return OperationsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operations_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operations_client_example_test.go deleted file mode 100644 index f5e2445105d4..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/operations_client_example_test.go +++ /dev/null @@ -1,496 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ListOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClientDiscoveryResponse = armrecoveryservicesbackup.ClientDiscoveryResponse{ - // Value: []*armrecoveryservicesbackup.ClientDiscoveryValueForSingleAPI{ - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/usages/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns usage details for a Recovery Services Vault."), - // Operation: to.Ptr("Recovery Services Vault usage details."), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Vault Usage"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupUsageSummaries/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns summaries for Protected Items and Protected Servers for a Recovery Services ."), - // Operation: to.Ptr("Recovery Services Protected Items and Protected Servers usage summaries details."), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Usages Summaries"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/storageConfig/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Storage Configuration for Recovery Services Vault."), - // Operation: to.Ptr("Get Resource Storage Config"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Vault Storage Config"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/storageConfig/write"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Updates Storage Configuration for Recovery Services Vault."), - // Operation: to.Ptr("Write Resource Storage Config"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Vault Storage Config"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupconfig/vaultconfig/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Configuration for Recovery Services Vault."), - // Operation: to.Ptr("Get Resource Config"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Vault Config"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupconfig/vaultconfig/write"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Updates Configuration for Recovery Services Vault."), - // Operation: to.Ptr("Update Resource Config"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Vault Config"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/tokenInfo/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns token information for Recovery Services Vault."), - // Operation: to.Ptr("Get Vault Token Info"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Token Info"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupSecurityPIN/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Security PIN Information for Recovery Services Vault."), - // Operation: to.Ptr("Get Security PIN Info"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("SecurityPINInfo"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupManagementMetaData/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Management Metadata for Recovery Services Vault."), - // Operation: to.Ptr("Get Backup Management Metadata"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Management Metadata"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupOperationResults/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Operation Result for Recovery Services Vault."), - // Operation: to.Ptr("Get Backup Operation Result"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupOperations/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Operation Status for Recovery Services Vault."), - // Operation: to.Ptr("Get Backup Operation Status"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Operation Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupJobs/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all Job Objects"), - // Operation: to.Ptr("Get Jobs"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Jobs"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupJobs/cancel/action"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Cancel the Job"), - // Operation: to.Ptr("Cancel Jobs"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Jobs"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupJobsExport/action"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Export Jobs"), - // Operation: to.Ptr("Export Jobs"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Export Backup Jobs"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupJobs/operationResults/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns the Result of Job Operation."), - // Operation: to.Ptr("Get Job Operation Result"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Jobs Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupJobsExport/operationResults/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns the Result of Export Job Operation."), - // Operation: to.Ptr("Get Export Job Operation Result"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Export Backup Jobs Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get Recovery Points for Protected Items."), - // Operation: to.Ptr("Get Recovery Points"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Recovery Points"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/restore/action"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Restore Recovery Points for Protected Items."), - // Operation: to.Ptr("Restore Recovery Points"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Recovery Points"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/provisionInstantItemRecovery/action"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Provision Instant Item Recovery for Protected Item"), - // Operation: to.Ptr("Provision Instant Item Recovery for Protected Item"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Recovery Points"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/revokeInstantItemRecovery/action"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Revoke Instant Item Recovery for Protected Item"), - // Operation: to.Ptr("Revoke Instant Item Recovery for Protected Item"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Recovery Points"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupPolicies/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all Protection Policies"), - // Operation: to.Ptr("Get Protection Policy"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Policies"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupPolicies/write"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Creates Protection Policy"), - // Operation: to.Ptr("Create Protection Policy"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Policies"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupPolicies/delete"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Delete a Protection Policy"), - // Operation: to.Ptr("Delete Protection Policy"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Policies"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupPolicies/operationResults/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get Results of Policy Operation."), - // Operation: to.Ptr("Get Policy Operation Results"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Policy Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupPolicies/operationsStatus/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get Status of Policy Operation."), - // Operation: to.Ptr("Get Policy Operation Status"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Policy Operation Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns object details of the Protected Item"), - // Operation: to.Ptr("Get Protected Item Details"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protected Items"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupProtectedItems/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns the list of all Protected Items."), - // Operation: to.Ptr("Get All Protected Items"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protected Items"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/write"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Create a backup Protected Item"), - // Operation: to.Ptr("Create Backup Protected Item"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protected Items"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/delete"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Deletes Protected Item"), - // Operation: to.Ptr("Delete Protected Items"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protected Items"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/operationResults/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets Result of Operation Performed on Protected Items."), - // Operation: to.Ptr("Get Protected Items Operation Results"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protected Item Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/operationsStatus/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns the status of Operation performed on Protected Items."), - // Operation: to.Ptr("Get Protected Items operation status"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protected Item Operation Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/protectedItems/backup/action"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Performs Backup for Protected Item."), - // Operation: to.Ptr("Backup Protected Item"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protected Items"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupProtectableItems/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns list of all Protectable Items."), - // Operation: to.Ptr("Get Protectable Items"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Protectable Items"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/refreshContainers/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Refreshes the container list"), - // Operation: to.Ptr("Refresh container"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Refresh Containers"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/operationResults/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns status of the operation"), - // Operation: to.Ptr("Get Operation Results"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Refresh Containers Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupProtectionContainers/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all containers belonging to the subscription"), - // Operation: to.Ptr("Get Containers In Subscription"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Protection Containers"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all registered containers"), - // Operation: to.Ptr("Get Registered Container"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protection Containers"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/operationResults/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets result of Operation performed on Protection Container."), - // Operation: to.Ptr("Get Container Operation Results"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protection Containers Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupEngines"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all the backup management servers registered with vault."), - // Operation: to.Ptr("List of backup management servers."), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Engines"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupStatus"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Check Backup Status for Recovery Services Vaults"), - // Operation: to.Ptr("Check Backup Status for Vault"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Backup Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupPreValidateProtection"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr(""), - // Operation: to.Ptr("Pre Validate Enable Protection"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("PreValidate Protection"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupValidateFeatures"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Validate Features"), - // Operation: to.Ptr("Validate Features"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Validate Features"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/backupProtectionIntent/write"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Create a backup Protection Intent"), - // Operation: to.Ptr("Create backup Protection Intent"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protection Intent"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/{fabricName}/protectionContainers/{containerName}/items/read"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get all items in a container"), - // Operation: to.Ptr("Get all items in a container"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Workload Items"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("microsoft.recoveryservices/vaults/backupFabrics/protectionContainers/inquire/action"), - // Display: &armrecoveryservicesbackup.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get all items in a container"), - // Operation: to.Ptr("Get all items in a container"), - // Provider: to.Ptr("microsoft.recoveryservices"), - // Resource: to.Ptr("Protection Containers Inquire"), - // }, - // Origin: to.Ptr("user"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/options.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/options.go index 5ff6e5774b72..47868f93b7b2 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/options.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/options.go @@ -8,68 +8,19 @@ package armrecoveryservicesbackup -// BMSPrepareDataMoveOperationResultClientGetOptions contains the optional parameters for the BMSPrepareDataMoveOperationResultClient.Get -// method. -type BMSPrepareDataMoveOperationResultClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupEnginesClientGetOptions contains the optional parameters for the BackupEnginesClient.Get method. -type BackupEnginesClientGetOptions struct { +// AADPropertiesClientGetOptions contains the optional parameters for the AADPropertiesClient.Get method. +type AADPropertiesClientGetOptions struct { // OData filter options. Filter *string - - // skipToken Filter. - SkipToken *string } -// BackupEnginesClientListOptions contains the optional parameters for the BackupEnginesClient.NewListPager method. -type BackupEnginesClientListOptions struct { - // OData filter options. - Filter *string - - // skipToken Filter. - SkipToken *string -} - -// BackupJobsClientListOptions contains the optional parameters for the BackupJobsClient.NewListPager method. -type BackupJobsClientListOptions struct { - // OData filter options. - Filter *string - - // skipToken Filter. - SkipToken *string -} - -// BackupOperationResultsClientGetOptions contains the optional parameters for the BackupOperationResultsClient.Get method. -type BackupOperationResultsClientGetOptions struct { +// BackupCrrJobDetailsClientGetOptions contains the optional parameters for the BackupCrrJobDetailsClient.Get method. +type BackupCrrJobDetailsClientGetOptions struct { // placeholder for future optional parameters } -// BackupOperationStatusesClientGetOptions contains the optional parameters for the BackupOperationStatusesClient.Get method. -type BackupOperationStatusesClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. -type BackupPoliciesClientListOptions struct { - // OData filter options. - Filter *string -} - -// BackupProtectableItemsClientListOptions contains the optional parameters for the BackupProtectableItemsClient.NewListPager -// method. -type BackupProtectableItemsClientListOptions struct { - // OData filter options. - Filter *string - - // skipToken Filter. - SkipToken *string -} - -// BackupProtectedItemsClientListOptions contains the optional parameters for the BackupProtectedItemsClient.NewListPager -// method. -type BackupProtectedItemsClientListOptions struct { +// BackupCrrJobsClientListOptions contains the optional parameters for the BackupCrrJobsClient.NewListPager method. +type BackupCrrJobsClientListOptions struct { // OData filter options. Filter *string @@ -77,16 +28,9 @@ type BackupProtectedItemsClientListOptions struct { SkipToken *string } -// BackupProtectionContainersClientListOptions contains the optional parameters for the BackupProtectionContainersClient.NewListPager -// method. -type BackupProtectionContainersClientListOptions struct { - // OData filter options. - Filter *string -} - -// BackupProtectionIntentClientListOptions contains the optional parameters for the BackupProtectionIntentClient.NewListPager +// BackupProtectedItemsCrrClientListOptions contains the optional parameters for the BackupProtectedItemsCrrClient.NewListPager // method. -type BackupProtectionIntentClientListOptions struct { +type BackupProtectedItemsCrrClientListOptions struct { // OData filter options. Filter *string @@ -94,62 +38,27 @@ type BackupProtectionIntentClientListOptions struct { SkipToken *string } -// BackupResourceEncryptionConfigsClientGetOptions contains the optional parameters for the BackupResourceEncryptionConfigsClient.Get -// method. -type BackupResourceEncryptionConfigsClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupResourceEncryptionConfigsClientUpdateOptions contains the optional parameters for the BackupResourceEncryptionConfigsClient.Update -// method. -type BackupResourceEncryptionConfigsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// BackupResourceStorageConfigsNonCRRClientGetOptions contains the optional parameters for the BackupResourceStorageConfigsNonCRRClient.Get +// BackupResourceStorageConfigsClientGetOptions contains the optional parameters for the BackupResourceStorageConfigsClient.Get // method. -type BackupResourceStorageConfigsNonCRRClientGetOptions struct { +type BackupResourceStorageConfigsClientGetOptions struct { // placeholder for future optional parameters } -// BackupResourceStorageConfigsNonCRRClientPatchOptions contains the optional parameters for the BackupResourceStorageConfigsNonCRRClient.Patch +// BackupResourceStorageConfigsClientPatchOptions contains the optional parameters for the BackupResourceStorageConfigsClient.Patch // method. -type BackupResourceStorageConfigsNonCRRClientPatchOptions struct { +type BackupResourceStorageConfigsClientPatchOptions struct { // placeholder for future optional parameters } -// BackupResourceStorageConfigsNonCRRClientUpdateOptions contains the optional parameters for the BackupResourceStorageConfigsNonCRRClient.Update +// BackupResourceStorageConfigsClientUpdateOptions contains the optional parameters for the BackupResourceStorageConfigsClient.Update // method. -type BackupResourceStorageConfigsNonCRRClientUpdateOptions struct { +type BackupResourceStorageConfigsClientUpdateOptions struct { // placeholder for future optional parameters } -// BackupResourceVaultConfigsClientGetOptions contains the optional parameters for the BackupResourceVaultConfigsClient.Get +// BackupUsageSummariesCRRClientListOptions contains the optional parameters for the BackupUsageSummariesCRRClient.NewListPager // method. -type BackupResourceVaultConfigsClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupResourceVaultConfigsClientPutOptions contains the optional parameters for the BackupResourceVaultConfigsClient.Put -// method. -type BackupResourceVaultConfigsClientPutOptions struct { - XMSAuthorizationAuxiliary *string -} - -// BackupResourceVaultConfigsClientUpdateOptions contains the optional parameters for the BackupResourceVaultConfigsClient.Update -// method. -type BackupResourceVaultConfigsClientUpdateOptions struct { - XMSAuthorizationAuxiliary *string -} - -// BackupStatusClientGetOptions contains the optional parameters for the BackupStatusClient.Get method. -type BackupStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupUsageSummariesClientListOptions contains the optional parameters for the BackupUsageSummariesClient.NewListPager -// method. -type BackupUsageSummariesClientListOptions struct { +type BackupUsageSummariesCRRClientListOptions struct { // OData filter options. Filter *string @@ -157,348 +66,36 @@ type BackupUsageSummariesClientListOptions struct { SkipToken *string } -// BackupWorkloadItemsClientListOptions contains the optional parameters for the BackupWorkloadItemsClient.NewListPager method. -type BackupWorkloadItemsClientListOptions struct { - // OData filter options. - Filter *string - - // skipToken Filter. - SkipToken *string -} - -// BackupsClientTriggerOptions contains the optional parameters for the BackupsClient.Trigger method. -type BackupsClientTriggerOptions struct { - // placeholder for future optional parameters -} - -// ClientBeginBMSPrepareDataMoveOptions contains the optional parameters for the Client.BeginBMSPrepareDataMove method. -type ClientBeginBMSPrepareDataMoveOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginBMSTriggerDataMoveOptions contains the optional parameters for the Client.BeginBMSTriggerDataMove method. -type ClientBeginBMSTriggerDataMoveOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginMoveRecoveryPointOptions contains the optional parameters for the Client.BeginMoveRecoveryPoint method. -type ClientBeginMoveRecoveryPointOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientGetOperationStatusOptions contains the optional parameters for the Client.GetOperationStatus method. -type ClientGetOperationStatusOptions struct { - // placeholder for future optional parameters -} - -// DeletedProtectionContainersClientListOptions contains the optional parameters for the DeletedProtectionContainersClient.NewListPager -// method. -type DeletedProtectionContainersClientListOptions struct { - // OData filter options. - Filter *string -} - -// ExportJobsOperationResultsClientGetOptions contains the optional parameters for the ExportJobsOperationResultsClient.Get -// method. -type ExportJobsOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// FeatureSupportClientValidateOptions contains the optional parameters for the FeatureSupportClient.Validate method. -type FeatureSupportClientValidateOptions struct { - // placeholder for future optional parameters -} - -// FetchTieringCostClientBeginPostOptions contains the optional parameters for the FetchTieringCostClient.BeginPost method. -type FetchTieringCostClientBeginPostOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GetTieringCostOperationResultClientGetOptions contains the optional parameters for the GetTieringCostOperationResultClient.Get -// method. -type GetTieringCostOperationResultClientGetOptions struct { - // placeholder for future optional parameters -} - -// ItemLevelRecoveryConnectionsClientProvisionOptions contains the optional parameters for the ItemLevelRecoveryConnectionsClient.Provision -// method. -type ItemLevelRecoveryConnectionsClientProvisionOptions struct { - // placeholder for future optional parameters -} - -// ItemLevelRecoveryConnectionsClientRevokeOptions contains the optional parameters for the ItemLevelRecoveryConnectionsClient.Revoke -// method. -type ItemLevelRecoveryConnectionsClientRevokeOptions struct { - // placeholder for future optional parameters -} - -// JobCancellationsClientTriggerOptions contains the optional parameters for the JobCancellationsClient.Trigger method. -type JobCancellationsClientTriggerOptions struct { - // placeholder for future optional parameters -} - -// JobDetailsClientGetOptions contains the optional parameters for the JobDetailsClient.Get method. -type JobDetailsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobOperationResultsClientGetOptions contains the optional parameters for the JobOperationResultsClient.Get method. -type JobOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobsClientExportOptions contains the optional parameters for the JobsClient.Export method. -type JobsClientExportOptions struct { - // OData filter options. - Filter *string -} - -// OperationClientValidateOptions contains the optional parameters for the OperationClient.Validate method. -type OperationClientValidateOptions struct { - // placeholder for future optional parameters -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointClientGetOperationStatusOptions contains the optional parameters for the PrivateEndpointClient.GetOperationStatus +// CrossRegionRestoreClientBeginTriggerOptions contains the optional parameters for the CrossRegionRestoreClient.BeginTrigger // method. -type PrivateEndpointClientGetOperationStatusOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginDelete -// method. -type PrivateEndpointConnectionClientBeginDeleteOptions struct { +type CrossRegionRestoreClientBeginTriggerOptions struct { // Resumes the LRO from the provided token. ResumeToken string } -// PrivateEndpointConnectionClientBeginPutOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginPut -// method. -type PrivateEndpointConnectionClientBeginPutOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get -// method. -type PrivateEndpointConnectionClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProtectableContainersClientListOptions contains the optional parameters for the ProtectableContainersClient.NewListPager -// method. -type ProtectableContainersClientListOptions struct { - // OData filter options. - Filter *string -} - -// ProtectedItemOperationResultsClientGetOptions contains the optional parameters for the ProtectedItemOperationResultsClient.Get -// method. -type ProtectedItemOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProtectedItemOperationStatusesClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusesClient.Get -// method. -type ProtectedItemOperationStatusesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProtectedItemsClientCreateOrUpdateOptions contains the optional parameters for the ProtectedItemsClient.CreateOrUpdate -// method. -type ProtectedItemsClientCreateOrUpdateOptions struct { - XMSAuthorizationAuxiliary *string -} - -// ProtectedItemsClientDeleteOptions contains the optional parameters for the ProtectedItemsClient.Delete method. -type ProtectedItemsClientDeleteOptions struct { +// CrrOperationResultsClientGetOptions contains the optional parameters for the CrrOperationResultsClient.Get method. +type CrrOperationResultsClientGetOptions struct { // placeholder for future optional parameters } -// ProtectedItemsClientGetOptions contains the optional parameters for the ProtectedItemsClient.Get method. -type ProtectedItemsClientGetOptions struct { - // OData filter options. - Filter *string -} - -// ProtectionContainerOperationResultsClientGetOptions contains the optional parameters for the ProtectionContainerOperationResultsClient.Get -// method. -type ProtectionContainerOperationResultsClientGetOptions struct { +// CrrOperationStatusClientGetOptions contains the optional parameters for the CrrOperationStatusClient.Get method. +type CrrOperationStatusClientGetOptions struct { // placeholder for future optional parameters } -// ProtectionContainerRefreshOperationResultsClientGetOptions contains the optional parameters for the ProtectionContainerRefreshOperationResultsClient.Get +// RecoveryPointsClientGetAccessTokenOptions contains the optional parameters for the RecoveryPointsClient.GetAccessToken // method. -type ProtectionContainerRefreshOperationResultsClientGetOptions struct { +type RecoveryPointsClientGetAccessTokenOptions struct { // placeholder for future optional parameters } -// ProtectionContainersClientBeginRegisterOptions contains the optional parameters for the ProtectionContainersClient.BeginRegister -// method. -type ProtectionContainersClientBeginRegisterOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProtectionContainersClientGetOptions contains the optional parameters for the ProtectionContainersClient.Get method. -type ProtectionContainersClientGetOptions struct { +// RecoveryPointsCrrClientGetOptions contains the optional parameters for the RecoveryPointsCrrClient.Get method. +type RecoveryPointsCrrClientGetOptions struct { // placeholder for future optional parameters } -// ProtectionContainersClientInquireOptions contains the optional parameters for the ProtectionContainersClient.Inquire method. -type ProtectionContainersClientInquireOptions struct { - // OData filter options. - Filter *string -} - -// ProtectionContainersClientRefreshOptions contains the optional parameters for the ProtectionContainersClient.Refresh method. -type ProtectionContainersClientRefreshOptions struct { +// RecoveryPointsCrrClientListOptions contains the optional parameters for the RecoveryPointsCrrClient.NewListPager method. +type RecoveryPointsCrrClientListOptions struct { // OData filter options. Filter *string } - -// ProtectionContainersClientUnregisterOptions contains the optional parameters for the ProtectionContainersClient.Unregister -// method. -type ProtectionContainersClientUnregisterOptions struct { - // placeholder for future optional parameters -} - -// ProtectionIntentClientCreateOrUpdateOptions contains the optional parameters for the ProtectionIntentClient.CreateOrUpdate -// method. -type ProtectionIntentClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ProtectionIntentClientDeleteOptions contains the optional parameters for the ProtectionIntentClient.Delete method. -type ProtectionIntentClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ProtectionIntentClientGetOptions contains the optional parameters for the ProtectionIntentClient.Get method. -type ProtectionIntentClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProtectionIntentClientValidateOptions contains the optional parameters for the ProtectionIntentClient.Validate method. -type ProtectionIntentClientValidateOptions struct { - // placeholder for future optional parameters -} - -// ProtectionPoliciesClientBeginDeleteOptions contains the optional parameters for the ProtectionPoliciesClient.BeginDelete -// method. -type ProtectionPoliciesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProtectionPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ProtectionPoliciesClient.CreateOrUpdate -// method. -type ProtectionPoliciesClientCreateOrUpdateOptions struct { - XMSAuthorizationAuxiliary *string -} - -// ProtectionPoliciesClientGetOptions contains the optional parameters for the ProtectionPoliciesClient.Get method. -type ProtectionPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProtectionPolicyOperationResultsClientGetOptions contains the optional parameters for the ProtectionPolicyOperationResultsClient.Get -// method. -type ProtectionPolicyOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProtectionPolicyOperationStatusesClientGetOptions contains the optional parameters for the ProtectionPolicyOperationStatusesClient.Get -// method. -type ProtectionPolicyOperationStatusesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -type RecoveryPointsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -type RecoveryPointsClientListOptions struct { - // OData filter options. - Filter *string -} - -// RecoveryPointsRecommendedForMoveClientListOptions contains the optional parameters for the RecoveryPointsRecommendedForMoveClient.NewListPager -// method. -type RecoveryPointsRecommendedForMoveClientListOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardProxiesClientGetOptions contains the optional parameters for the ResourceGuardProxiesClient.NewGetPager method. -type ResourceGuardProxiesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardProxyClientDeleteOptions contains the optional parameters for the ResourceGuardProxyClient.Delete method. -type ResourceGuardProxyClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardProxyClientGetOptions contains the optional parameters for the ResourceGuardProxyClient.Get method. -type ResourceGuardProxyClientGetOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardProxyClientPutOptions contains the optional parameters for the ResourceGuardProxyClient.Put method. -type ResourceGuardProxyClientPutOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardProxyClientUnlockDeleteOptions contains the optional parameters for the ResourceGuardProxyClient.UnlockDelete -// method. -type ResourceGuardProxyClientUnlockDeleteOptions struct { - // placeholder for future optional parameters -} - -// RestoresClientBeginTriggerOptions contains the optional parameters for the RestoresClient.BeginTrigger method. -type RestoresClientBeginTriggerOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string - XMSAuthorizationAuxiliary *string -} - -// SecurityPINsClientGetOptions contains the optional parameters for the SecurityPINsClient.Get method. -type SecurityPINsClientGetOptions struct { - // security pin request - Parameters *SecurityPinBase - XMSAuthorizationAuxiliary *string -} - -// TieringCostOperationStatusClientGetOptions contains the optional parameters for the TieringCostOperationStatusClient.Get -// method. -type TieringCostOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// ValidateOperationClientBeginTriggerOptions contains the optional parameters for the ValidateOperationClient.BeginTrigger -// method. -type ValidateOperationClientBeginTriggerOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ValidateOperationResultsClientGetOptions contains the optional parameters for the ValidateOperationResultsClient.Get method. -type ValidateOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ValidateOperationStatusesClientGetOptions contains the optional parameters for the ValidateOperationStatusesClient.Get -// method. -type ValidateOperationStatusesClientGetOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/polymorphic_helpers.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/polymorphic_helpers.go index 756075f8a5c3..5899a0868c39 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/polymorphic_helpers.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/polymorphic_helpers.go @@ -10,7 +10,7 @@ package armrecoveryservicesbackup import "encoding/json" -func unmarshalBackupEngineBaseClassification(rawMsg json.RawMessage) (BackupEngineBaseClassification, error) { +func unmarshalCrrAccessTokenClassification(rawMsg json.RawMessage) (CrrAccessTokenClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } @@ -18,62 +18,12 @@ func unmarshalBackupEngineBaseClassification(rawMsg json.RawMessage) (BackupEngi if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b BackupEngineBaseClassification - switch m["backupEngineType"] { - case string(BackupEngineTypeAzureBackupServerEngine): - b = &AzureBackupServerEngine{} - case string(BackupEngineTypeDpmBackupEngine): - b = &DpmBackupEngine{} - default: - b = &BackupEngineBase{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalBackupRequestClassification(rawMsg json.RawMessage) (BackupRequestClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b BackupRequestClassification + var b CrrAccessTokenClassification switch m["objectType"] { - case "AzureFileShareBackupRequest": - b = &AzureFileShareBackupRequest{} - case "AzureWorkloadBackupRequest": - b = &AzureWorkloadBackupRequest{} - case "IaasVMBackupRequest": - b = &IaasVMBackupRequest{} + case "WorkloadCrrAccessToken": + b = &WorkloadCrrAccessToken{} default: - b = &BackupRequest{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalILRRequestClassification(rawMsg json.RawMessage) (ILRRequestClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ILRRequestClassification - switch m["objectType"] { - case "AzureFileShareProvisionILRRequest": - b = &AzureFileShareProvisionILRRequest{} - case "IaasVMILRRegistrationRequest": - b = &IaasVMILRRegistrationRequest{} - default: - b = &ILRRequest{} + b = &CrrAccessToken{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -93,8 +43,6 @@ func unmarshalJobClassification(rawMsg json.RawMessage) (JobClassification, erro switch m["jobType"] { case "AzureIaaSVMJob": b = &AzureIaaSVMJob{} - case "AzureIaaSVMJobV2": - b = &AzureIaaSVMJobV2{} case "AzureStorageJob": b = &AzureStorageJob{} case "AzureWorkloadJob": @@ -103,8 +51,6 @@ func unmarshalJobClassification(rawMsg json.RawMessage) (JobClassification, erro b = &DpmJob{} case "MabJob": b = &MabJob{} - case "VaultJob": - b = &VaultJob{} default: b = &Job{} } @@ -114,29 +60,6 @@ func unmarshalJobClassification(rawMsg json.RawMessage) (JobClassification, erro return b, nil } -func unmarshalOperationResultInfoBaseClassification(rawMsg json.RawMessage) (OperationResultInfoBaseClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b OperationResultInfoBaseClassification - switch m["objectType"] { - case "ExportJobsOperationResultInfo": - b = &ExportJobsOperationResultInfo{} - case "OperationResultInfo": - b = &OperationResultInfo{} - default: - b = &OperationResultInfoBase{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - func unmarshalOperationStatusExtendedInfoClassification(rawMsg json.RawMessage) (OperationStatusExtendedInfoClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil @@ -153,8 +76,8 @@ func unmarshalOperationStatusExtendedInfoClassification(rawMsg json.RawMessage) b = &OperationStatusJobsExtendedInfo{} case "OperationStatusProvisionILRExtendedInfo": b = &OperationStatusProvisionILRExtendedInfo{} - case "OperationStatusValidateOperationExtendedInfo": - b = &OperationStatusValidateOperationExtendedInfo{} + case "OperationStatusRecoveryPointExtendedInfo": + b = &OperationStatusRecoveryPointExtendedInfo{} default: b = &OperationStatusExtendedInfo{} } @@ -164,29 +87,6 @@ func unmarshalOperationStatusExtendedInfoClassification(rawMsg json.RawMessage) return b, nil } -func unmarshalProtectableContainerClassification(rawMsg json.RawMessage) (ProtectableContainerClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ProtectableContainerClassification - switch m["protectableContainerType"] { - case string(ProtectableContainerTypeStorageContainer): - b = &AzureStorageProtectableContainer{} - case string(ProtectableContainerTypeVMAppContainer): - b = &AzureVMAppContainerProtectableContainer{} - default: - b = &ProtectableContainer{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - func unmarshalProtectedItemClassification(rawMsg json.RawMessage) (ProtectedItemClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil @@ -205,8 +105,6 @@ func unmarshalProtectedItemClassification(rawMsg json.RawMessage) (ProtectedItem b = &AzureVMWorkloadProtectedItem{} case "AzureVmWorkloadSAPAseDatabase": b = &AzureVMWorkloadSAPAseDatabaseProtectedItem{} - case "AzureVmWorkloadSAPHanaDBInstance": - b = &AzureVMWorkloadSAPHanaDBInstanceProtectedItem{} case "AzureVmWorkloadSAPHanaDatabase": b = &AzureVMWorkloadSAPHanaDatabaseProtectedItem{} case "AzureVmWorkloadSQLDatabase": @@ -232,109 +130,6 @@ func unmarshalProtectedItemClassification(rawMsg json.RawMessage) (ProtectedItem return b, nil } -func unmarshalProtectionContainerClassification(rawMsg json.RawMessage) (ProtectionContainerClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ProtectionContainerClassification - switch m["containerType"] { - case string(ProtectableContainerTypeAzureBackupServerContainer): - b = &AzureBackupServerContainer{} - case string(ProtectableContainerTypeAzureSQLContainer): - b = &AzureSQLContainer{} - case string(ProtectableContainerTypeAzureWorkloadContainer): - b = &AzureWorkloadContainer{} - case string(ProtectableContainerTypeDPMContainer): - b = &DpmContainer{} - case string(ProtectableContainerTypeGenericContainer): - b = &GenericContainer{} - case string(ProtectableContainerTypeIaasVMContainer): - b = &IaaSVMContainer{} - case string(ProtectableContainerTypeMicrosoftClassicComputeVirtualMachines): - b = &AzureIaaSClassicComputeVMContainer{} - case string(ProtectableContainerTypeMicrosoftComputeVirtualMachines): - b = &AzureIaaSComputeVMContainer{} - case string(ProtectableContainerTypeSQLAGWorkLoadContainer): - b = &AzureSQLAGWorkloadContainerProtectionContainer{} - case string(ProtectableContainerTypeStorageContainer): - b = &AzureStorageContainer{} - case string(ProtectableContainerTypeVMAppContainer): - b = &AzureVMAppContainerProtectionContainer{} - case string(ProtectableContainerTypeWindows): - b = &MabContainer{} - default: - b = &ProtectionContainer{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalProtectionIntentClassification(rawMsg json.RawMessage) (ProtectionIntentClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ProtectionIntentClassification - switch m["protectionIntentItemType"] { - case "ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent": - b = &AzureWorkloadAutoProtectionIntent{} - case "ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent": - b = &AzureWorkloadSQLAutoProtectionIntent{} - case string(ProtectionIntentItemTypeAzureResourceItem): - b = &AzureResourceProtectionIntent{} - case string(ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent): - b = &AzureWorkloadContainerAutoProtectionIntent{} - case string(ProtectionIntentItemTypeRecoveryServiceVaultItem): - b = &AzureRecoveryServiceVaultProtectionIntent{} - default: - b = &ProtectionIntent{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalProtectionPolicyClassification(rawMsg json.RawMessage) (ProtectionPolicyClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ProtectionPolicyClassification - switch m["backupManagementType"] { - case "AzureIaasVM": - b = &AzureIaaSVMProtectionPolicy{} - case "AzureSql": - b = &AzureSQLProtectionPolicy{} - case "AzureStorage": - b = &AzureFileShareProtectionPolicy{} - case "AzureWorkload": - b = &AzureVMWorkloadProtectionPolicy{} - case "GenericProtectionPolicy": - b = &GenericProtectionPolicy{} - case "MAB": - b = &MabProtectionPolicy{} - default: - b = &ProtectionPolicy{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - func unmarshalRecoveryPointClassification(rawMsg json.RawMessage) (RecoveryPointClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil @@ -390,24 +185,14 @@ func unmarshalRestoreRequestClassification(rawMsg json.RawMessage) (RestoreReque b = &AzureWorkloadRestoreRequest{} case "AzureWorkloadSAPHanaPointInTimeRestoreRequest": b = &AzureWorkloadSAPHanaPointInTimeRestoreRequest{} - case "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest": - b = &AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest{} case "AzureWorkloadSAPHanaRestoreRequest": b = &AzureWorkloadSAPHanaRestoreRequest{} - case "AzureWorkloadSAPHanaRestoreWithRehydrateRequest": - b = &AzureWorkloadSAPHanaRestoreWithRehydrateRequest{} case "AzureWorkloadSQLPointInTimeRestoreRequest": b = &AzureWorkloadSQLPointInTimeRestoreRequest{} - case "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest": - b = &AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest{} case "AzureWorkloadSQLRestoreRequest": b = &AzureWorkloadSQLRestoreRequest{} - case "AzureWorkloadSQLRestoreWithRehydrateRequest": - b = &AzureWorkloadSQLRestoreWithRehydrateRequest{} case "IaasVMRestoreRequest": b = &IaasVMRestoreRequest{} - case "IaasVMRestoreWithRehydrationRequest": - b = &IaasVMRestoreWithRehydrationRequest{} default: b = &RestoreRequest{} } @@ -416,198 +201,3 @@ func unmarshalRestoreRequestClassification(rawMsg json.RawMessage) (RestoreReque } return b, nil } - -func unmarshalRetentionPolicyClassification(rawMsg json.RawMessage) (RetentionPolicyClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RetentionPolicyClassification - switch m["retentionPolicyType"] { - case "LongTermRetentionPolicy": - b = &LongTermRetentionPolicy{} - case "SimpleRetentionPolicy": - b = &SimpleRetentionPolicy{} - default: - b = &RetentionPolicy{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalSchedulePolicyClassification(rawMsg json.RawMessage) (SchedulePolicyClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b SchedulePolicyClassification - switch m["schedulePolicyType"] { - case "LogSchedulePolicy": - b = &LogSchedulePolicy{} - case "LongTermSchedulePolicy": - b = &LongTermSchedulePolicy{} - case "SimpleSchedulePolicy": - b = &SimpleSchedulePolicy{} - case "SimpleSchedulePolicyV2": - b = &SimpleSchedulePolicyV2{} - default: - b = &SchedulePolicy{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTieringCostInfoClassification(rawMsg json.RawMessage) (TieringCostInfoClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b TieringCostInfoClassification - switch m["objectType"] { - case "TieringCostRehydrationInfo": - b = &TieringCostRehydrationInfo{} - case "TieringCostSavingInfo": - b = &TieringCostSavingInfo{} - default: - b = &TieringCostInfo{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalValidateOperationRequestClassification(rawMsg json.RawMessage) (ValidateOperationRequestClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ValidateOperationRequestClassification - switch m["objectType"] { - case "ValidateIaasVMRestoreOperationRequest": - b = &ValidateIaasVMRestoreOperationRequest{} - case "ValidateRestoreOperationRequest": - b = &ValidateRestoreOperationRequest{} - default: - b = &ValidateOperationRequest{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalVaultStorageConfigOperationResultResponseClassification(rawMsg json.RawMessage) (VaultStorageConfigOperationResultResponseClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b VaultStorageConfigOperationResultResponseClassification - switch m["objectType"] { - case "PrepareDataMoveResponse": - b = &PrepareDataMoveResponse{} - default: - b = &VaultStorageConfigOperationResultResponse{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalWorkloadItemClassification(rawMsg json.RawMessage) (WorkloadItemClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b WorkloadItemClassification - switch m["workloadItemType"] { - case "AzureVmWorkloadItem": - b = &AzureVMWorkloadItem{} - case "SAPAseDatabase": - b = &AzureVMWorkloadSAPAseDatabaseWorkloadItem{} - case "SAPAseSystem": - b = &AzureVMWorkloadSAPAseSystemWorkloadItem{} - case "SAPHanaDatabase": - b = &AzureVMWorkloadSAPHanaDatabaseWorkloadItem{} - case "SAPHanaSystem": - b = &AzureVMWorkloadSAPHanaSystemWorkloadItem{} - case "SQLDataBase": - b = &AzureVMWorkloadSQLDatabaseWorkloadItem{} - case "SQLInstance": - b = &AzureVMWorkloadSQLInstanceWorkloadItem{} - default: - b = &WorkloadItem{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalWorkloadProtectableItemClassification(rawMsg json.RawMessage) (WorkloadProtectableItemClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b WorkloadProtectableItemClassification - switch m["protectableItemType"] { - case "AzureFileShare": - b = &AzureFileShareProtectableItem{} - case "AzureVmWorkloadProtectableItem": - b = &AzureVMWorkloadProtectableItem{} - case "HanaHSRContainer": - b = &AzureVMWorkloadSAPHanaHSRProtectableItem{} - case "IaaSVMProtectableItem": - b = &IaaSVMProtectableItem{} - case "Microsoft.ClassicCompute/virtualMachines": - b = &AzureIaaSClassicComputeVMProtectableItem{} - case "Microsoft.Compute/virtualMachines": - b = &AzureIaaSComputeVMProtectableItem{} - case "SAPAseSystem": - b = &AzureVMWorkloadSAPAseSystemProtectableItem{} - case "SAPHanaDBInstance": - b = &AzureVMWorkloadSAPHanaDBInstance{} - case "SAPHanaDatabase": - b = &AzureVMWorkloadSAPHanaDatabaseProtectableItem{} - case "SAPHanaSystem": - b = &AzureVMWorkloadSAPHanaSystemProtectableItem{} - case "SQLAvailabilityGroupContainer": - b = &AzureVMWorkloadSQLAvailabilityGroupProtectableItem{} - case "SQLDataBase": - b = &AzureVMWorkloadSQLDatabaseProtectableItem{} - case "SQLInstance": - b = &AzureVMWorkloadSQLInstanceProtectableItem{} - default: - b = &WorkloadProtectableItem{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpoint_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpoint_client.go deleted file mode 100644 index ca347a271906..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpoint_client.go +++ /dev/null @@ -1,119 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// PrivateEndpointClient contains the methods for the PrivateEndpoint group. -// Don't use this type directly, use NewPrivateEndpointClient() instead. -type PrivateEndpointClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateEndpointClient creates a new instance of PrivateEndpointClient 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 NewPrivateEndpointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateEndpointClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// GetOperationStatus - Gets the operation status for a private endpoint connection. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - operationID - Operation id -// - options - PrivateEndpointClientGetOperationStatusOptions contains the optional parameters for the PrivateEndpointClient.GetOperationStatus -// method. -func (client *PrivateEndpointClient) GetOperationStatus(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, operationID string, options *PrivateEndpointClientGetOperationStatusOptions) (PrivateEndpointClientGetOperationStatusResponse, error) { - var err error - const operationName = "PrivateEndpointClient.GetOperationStatus" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getOperationStatusCreateRequest(ctx, vaultName, resourceGroupName, privateEndpointConnectionName, operationID, options) - if err != nil { - return PrivateEndpointClientGetOperationStatusResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointClientGetOperationStatusResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointClientGetOperationStatusResponse{}, err - } - resp, err := client.getOperationStatusHandleResponse(httpResp) - return resp, err -} - -// getOperationStatusCreateRequest creates the GetOperationStatus request. -func (client *PrivateEndpointClient) getOperationStatusCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, operationID string, options *PrivateEndpointClientGetOperationStatusOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getOperationStatusHandleResponse handles the GetOperationStatus response. -func (client *PrivateEndpointClient) getOperationStatusHandleResponse(resp *http.Response) (PrivateEndpointClientGetOperationStatusResponse, error) { - result := PrivateEndpointClientGetOperationStatusResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return PrivateEndpointClientGetOperationStatusResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpoint_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpoint_client_example_test.go deleted file mode 100644 index a3c07f559a24..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpoint_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/GetPrivateEndpointConnectionOperationStatus.json -func ExamplePrivateEndpointClient_GetOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointClient().GetOperationStatus(ctx, "gaallavaultbvtd2msi", "gaallaRG", "gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", "0f48183b-0a44-4dca-aec1-bba5daab888a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armrecoveryservicesbackup.OperationStatus{ - // Name: to.Ptr("0f48183b-0a44-4dca-aec1-bba5daab888a"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T11:59:47.590Z"); return t}()), - // ID: to.Ptr("0f48183b-0a44-4dca-aec1-bba5daab888a"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T11:59:47.590Z"); return t}()), - // Status: to.Ptr(armrecoveryservicesbackup.OperationStatusValuesSucceeded), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpointconnection_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpointconnection_client.go deleted file mode 100644 index 0b557db7955a..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpointconnection_client.go +++ /dev/null @@ -1,280 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// PrivateEndpointConnectionClient contains the methods for the PrivateEndpointConnection group. -// Don't use this type directly, use NewPrivateEndpointConnectionClient() instead. -type PrivateEndpointConnectionClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient 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 NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateEndpointConnectionClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginDelete - Delete Private Endpoint requests. This call is made by Backup Admin. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginDelete -// method. -func (client *PrivateEndpointConnectionClient) BeginDelete(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, vaultName, resourceGroupName, privateEndpointConnectionName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Delete Private Endpoint requests. This call is made by Backup Admin. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *PrivateEndpointConnectionClient) deleteOperation(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, privateEndpointConnectionName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get Private Endpoint Connection. This call is made by Backup Admin. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get -// method. -func (client *PrivateEndpointConnectionClient) Get(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (PrivateEndpointConnectionClientGetResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateEndpointConnectionClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientGetResponse, error) { - result := PrivateEndpointConnectionClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionResource); err != nil { - return PrivateEndpointConnectionClientGetResponse{}, err - } - return result, nil -} - -// BeginPut - Approve or Reject Private Endpoint requests. This call is made by Backup Admin. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - parameters - Request body for operation -// - options - PrivateEndpointConnectionClientBeginPutOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginPut -// method. -func (client *PrivateEndpointConnectionClient) BeginPut(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionResource, options *PrivateEndpointConnectionClientBeginPutOptions) (*runtime.Poller[PrivateEndpointConnectionClientPutResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.put(ctx, vaultName, resourceGroupName, privateEndpointConnectionName, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionClientPutResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionClientPutResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Put - Approve or Reject Private Endpoint requests. This call is made by Backup Admin. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *PrivateEndpointConnectionClient) put(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionResource, options *PrivateEndpointConnectionClientBeginPutOptions) (*http.Response, error) { - var err error - const operationName = "PrivateEndpointConnectionClient.BeginPut" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.putCreateRequest(ctx, vaultName, resourceGroupName, privateEndpointConnectionName, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// putCreateRequest creates the Put request. -func (client *PrivateEndpointConnectionClient) putCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionResource, options *PrivateEndpointConnectionClientBeginPutOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpointconnection_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpointconnection_client_example_test.go deleted file mode 100644 index c3b30c58852e..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/privateendpointconnection_client_example_test.go +++ /dev/null @@ -1,131 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/GetPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionClient().Get(ctx, "gaallavaultbvtd2msi", "gaallaRG", "gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionResource = armrecoveryservicesbackup.PrivateEndpointConnectionResource{ - // Name: to.Ptr("gaallatestpe1.3592346090307038890.backup.5704c932-249a-490b-a142-1396838cd3b"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/gaallaRG/providers/Microsoft.RecoveryServicesBVTD2/vaults/gaallavaultbvtd2msi/privateEndpointConnections/gaallatestpe3.3592346090307038890.backup.5704c932-249a-490b-a142-1396838cd3b"), - // Properties: &armrecoveryservicesbackup.PrivateEndpointConnection{ - // GroupIDs: []*armrecoveryservicesbackup.VaultSubResourceType{ - // to.Ptr(armrecoveryservicesbackup.VaultSubResourceTypeAzureBackupSecondary)}, - // PrivateEndpoint: &armrecoveryservicesbackup.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/gaallaRG/providers/Microsoft.Network/privateEndpoints/gaallatestpe3"), - // }, - // PrivateLinkServiceConnectionState: &armrecoveryservicesbackup.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@company.com"), - // Status: to.Ptr(armrecoveryservicesbackup.PrivateEndpointConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesbackup.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/PutPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionClient_BeginPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionClient().BeginPut(ctx, "gaallavaultbvtd2msi", "gaallaRG", "gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", armrecoveryservicesbackup.PrivateEndpointConnectionResource{ - Properties: &armrecoveryservicesbackup.PrivateEndpointConnection{ - GroupIDs: []*armrecoveryservicesbackup.VaultSubResourceType{ - to.Ptr(armrecoveryservicesbackup.VaultSubResourceTypeAzureBackupSecondary)}, - PrivateEndpoint: &armrecoveryservicesbackup.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/gaallaRG/providers/Microsoft.Network/privateEndpoints/gaallatestpe3"), - }, - PrivateLinkServiceConnectionState: &armrecoveryservicesbackup.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@company.com"), - Status: to.Ptr(armrecoveryservicesbackup.PrivateEndpointConnectionStatusApproved), - }, - ProvisioningState: to.Ptr(armrecoveryservicesbackup.ProvisioningStateSucceeded), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionResource = armrecoveryservicesbackup.PrivateEndpointConnectionResource{ - // Name: to.Ptr("gaallatestpe1.3592346090307038890.backup.5704c932-249a-490b-a142-1396838cd3b"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/gaallaRG/providers/Microsoft.RecoveryServicesBVTD2/vaults/gaallavaultbvtd2msi/privateEndpointConnections/gaallatestpe3.3592346090307038890.backup.5704c932-249a-490b-a142-1396838cd3b"), - // Properties: &armrecoveryservicesbackup.PrivateEndpointConnection{ - // GroupIDs: []*armrecoveryservicesbackup.VaultSubResourceType{ - // to.Ptr(armrecoveryservicesbackup.VaultSubResourceTypeAzureBackupSecondary)}, - // PrivateEndpoint: &armrecoveryservicesbackup.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/gaallaRG/providers/Microsoft.Network/privateEndpoints/gaallatestpe3"), - // }, - // PrivateLinkServiceConnectionState: &armrecoveryservicesbackup.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@company.com"), - // Status: to.Ptr(armrecoveryservicesbackup.PrivateEndpointConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesbackup.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/DeletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionClient().BeginDelete(ctx, "gaallavaultbvtd2msi", "gaallaRG", "gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectablecontainers_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectablecontainers_client.go deleted file mode 100644 index c67f7182be1f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectablecontainers_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectableContainersClient contains the methods for the ProtectableContainers group. -// Don't use this type directly, use NewProtectableContainersClient() instead. -type ProtectableContainersClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectableContainersClient creates a new instance of ProtectableContainersClient 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 NewProtectableContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectableContainersClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectableContainersClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the containers that can be registered to Recovery Services Vault. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - ProtectableContainersClientListOptions contains the optional parameters for the ProtectableContainersClient.NewListPager -// method. -func (client *ProtectableContainersClient) NewListPager(vaultName string, resourceGroupName string, fabricName string, options *ProtectableContainersClientListOptions) *runtime.Pager[ProtectableContainersClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ProtectableContainersClientListResponse]{ - More: func(page ProtectableContainersClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProtectableContainersClientListResponse) (ProtectableContainersClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProtectableContainersClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, fabricName, options) - }, nil) - if err != nil { - return ProtectableContainersClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ProtectableContainersClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, options *ProtectableContainersClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ProtectableContainersClient) listHandleResponse(resp *http.Response) (ProtectableContainersClientListResponse, error) { - result := ProtectableContainersClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectableContainerResourceList); err != nil { - return ProtectableContainersClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectablecontainers_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectablecontainers_client_example_test.go deleted file mode 100644 index 5ea2c01c4177..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectablecontainers_client_example_test.go +++ /dev/null @@ -1,71 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectableContainers_List.json -func ExampleProtectableContainersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProtectableContainersClient().NewListPager("testvault", "testRg", "Azure", &armrecoveryservicesbackup.ProtectableContainersClientListOptions{Filter: to.Ptr("backupManagementType eq 'AzureStorage' and workloadType eq 'AzureFileShare'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectableContainerResourceList = armrecoveryservicesbackup.ProtectableContainerResourceList{ - // Value: []*armrecoveryservicesbackup.ProtectableContainerResource{ - // { - // Name: to.Ptr("StorageContainer;storage;test-rg;testst"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectableContainers"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.RecoveryServices/vaults/testvault/backupFabrics/Azure/protectableContainers/StorageContainer;storage;test-rg;teststorage"), - // Properties: &armrecoveryservicesbackup.AzureStorageProtectableContainer{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureStorage), - // ContainerID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorage"), - // FriendlyName: to.Ptr("teststorage"), - // HealthStatus: to.Ptr("Healthy"), - // ProtectableContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeStorageContainer), - // }, - // }, - // { - // Name: to.Ptr("StorageContainer;ClassicStorage;test-rg;teststorage"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectableContainers"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.RecoveryServices/vaults/testvault/backupFabrics/Azure/protectableContainers/StorageContainer;ClassicStorage;test-rg;teststorage"), - // Properties: &armrecoveryservicesbackup.AzureStorageProtectableContainer{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureStorage), - // ContainerID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ClassicStorage/storageAccounts/teststorage"), - // FriendlyName: to.Ptr("teststorage"), - // HealthStatus: to.Ptr("Healthy"), - // ProtectableContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeStorageContainer), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationresults_client.go deleted file mode 100644 index 07c015b38a42..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationresults_client.go +++ /dev/null @@ -1,129 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectedItemOperationResultsClient contains the methods for the ProtectedItemOperationResults group. -// Don't use this type directly, use NewProtectedItemOperationResultsClient() instead. -type ProtectedItemOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectedItemOperationResultsClient creates a new instance of ProtectedItemOperationResultsClient 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 NewProtectedItemOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectedItemOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectedItemOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches the result of any operation on the backup item. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backup item. -// - containerName - Container name associated with the backup item. -// - protectedItemName - Backup item name whose details are to be fetched. -// - operationID - OperationID which represents the operation whose result needs to be fetched. -// - options - ProtectedItemOperationResultsClientGetOptions contains the optional parameters for the ProtectedItemOperationResultsClient.Get -// method. -func (client *ProtectedItemOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string, options *ProtectedItemOperationResultsClientGetOptions) (ProtectedItemOperationResultsClientGetResponse, error) { - var err error - const operationName = "ProtectedItemOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationID, options) - if err != nil { - return ProtectedItemOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemOperationResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectedItemOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string, options *ProtectedItemOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectedItemOperationResultsClient) getHandleResponse(resp *http.Response) (ProtectedItemOperationResultsClientGetResponse, error) { - result := ProtectedItemOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemResource); err != nil { - return ProtectedItemOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationresults_client_example_test.go deleted file mode 100644 index 0804c9e2c82f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationresults_client_example_test.go +++ /dev/null @@ -1,59 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectedItemOperationResults.json -func ExampleProtectedItemOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemOperationResultsClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectedItemResource = armrecoveryservicesbackup.ProtectedItemResource{ - // Name: to.Ptr("VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1/protectedItems/VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSComputeVMProtectedItem{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // ContainerName: to.Ptr("iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupPolicies/testPolicy1"), - // ProtectedItemType: to.Ptr("Microsoft.Compute/virtualMachines"), - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - // WorkloadType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - // FriendlyName: to.Ptr("netvmtestv2vm1"), - // HealthStatus: to.Ptr(armrecoveryservicesbackup.HealthStatusPassed), - // LastBackupStatus: to.Ptr("Completed"), - // LastBackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-22T12:25:32.048Z"); return t}()), - // ProtectedItemDataID: to.Ptr("636482643132986882"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStateProtected), - // ProtectionStatus: to.Ptr("Healthy"), - // VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationstatuses_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationstatuses_client.go deleted file mode 100644 index e3a41cf4253f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationstatuses_client.go +++ /dev/null @@ -1,131 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectedItemOperationStatusesClient contains the methods for the ProtectedItemOperationStatuses group. -// Don't use this type directly, use NewProtectedItemOperationStatusesClient() instead. -type ProtectedItemOperationStatusesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectedItemOperationStatusesClient creates a new instance of ProtectedItemOperationStatusesClient 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 NewProtectedItemOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectedItemOperationStatusesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectedItemOperationStatusesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches the status of an operation such as triggering a backup, restore. The status can be in progress, completed -// or failed. You can refer to the OperationStatus enum for all the possible states of -// the operation. Some operations create jobs. This method returns the list of jobs associated with the operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backup item. -// - containerName - Container name associated with the backup item. -// - protectedItemName - Backup item name whose details are to be fetched. -// - operationID - OperationID represents the operation whose status needs to be fetched. -// - options - ProtectedItemOperationStatusesClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusesClient.Get -// method. -func (client *ProtectedItemOperationStatusesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusesClientGetOptions) (ProtectedItemOperationStatusesClientGetResponse, error) { - var err error - const operationName = "ProtectedItemOperationStatusesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationID, options) - if err != nil { - return ProtectedItemOperationStatusesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemOperationStatusesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemOperationStatusesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectedItemOperationStatusesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectedItemOperationStatusesClient) getHandleResponse(resp *http.Response) (ProtectedItemOperationStatusesClientGetResponse, error) { - result := ProtectedItemOperationStatusesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ProtectedItemOperationStatusesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationstatuses_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationstatuses_client_example_test.go deleted file mode 100644 index db1efc9231e1..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditemoperationstatuses_client_example_test.go +++ /dev/null @@ -1,49 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectedItemOperationStatus.json -func ExampleProtectedItemOperationStatusesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemOperationStatusesClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armrecoveryservicesbackup.OperationStatus{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-29T06:04:18.207Z"); return t}()), - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.OperationStatusJobExtendedInfo{ - // ObjectType: to.Ptr("OperationStatusJobExtendedInfo"), - // JobID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-29T06:04:18.207Z"); return t}()), - // Status: to.Ptr(armrecoveryservicesbackup.OperationStatusValuesSucceeded), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditems_client.go deleted file mode 100644 index bd01d4070294..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditems_client.go +++ /dev/null @@ -1,286 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectedItemsClient contains the methods for the ProtectedItems group. -// Don't use this type directly, use NewProtectedItemsClient() instead. -type ProtectedItemsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectedItemsClient creates a new instance of ProtectedItemsClient 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 NewProtectedItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectedItemsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectedItemsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Enables backup of an item or to modifies the backup policy information of an already backed up item. This -// is an asynchronous operation. To know the status of the operation, call the -// GetItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backup item. -// - containerName - Container name associated with the backup item. -// - protectedItemName - Item name to be backed up. -// - parameters - resource backed up item -// - options - ProtectedItemsClientCreateOrUpdateOptions contains the optional parameters for the ProtectedItemsClient.CreateOrUpdate -// method. -func (client *ProtectedItemsClient) CreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ProtectedItemResource, options *ProtectedItemsClientCreateOrUpdateOptions) (ProtectedItemsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ProtectedItemsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters, options) - if err != nil { - return ProtectedItemsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ProtectedItemsClient) createOrUpdateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ProtectedItemResource, options *ProtectedItemsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.XMSAuthorizationAuxiliary != nil { - req.Raw().Header["x-ms-authorization-auxiliary"] = []string{*options.XMSAuthorizationAuxiliary} - } - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ProtectedItemsClient) createOrUpdateHandleResponse(resp *http.Response) (ProtectedItemsClientCreateOrUpdateResponse, error) { - result := ProtectedItemsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemResource); err != nil { - return ProtectedItemsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Used to disable backup of an item within a container. This is an asynchronous operation. To know the status of -// the request, call the GetItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backed up item. -// - containerName - Container name associated with the backed up item. -// - protectedItemName - Backed up item to be deleted. -// - options - ProtectedItemsClientDeleteOptions contains the optional parameters for the ProtectedItemsClient.Delete method. -func (client *ProtectedItemsClient) Delete(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *ProtectedItemsClientDeleteOptions) (ProtectedItemsClientDeleteResponse, error) { - var err error - const operationName = "ProtectedItemsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, options) - if err != nil { - return ProtectedItemsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemsClientDeleteResponse{}, err - } - return ProtectedItemsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ProtectedItemsClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *ProtectedItemsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Provides the details of the backed up item. This is an asynchronous operation. To know the status of the operation, -// call the GetItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backed up item. -// - containerName - Container name associated with the backed up item. -// - protectedItemName - Backed up item name whose details are to be fetched. -// - options - ProtectedItemsClientGetOptions contains the optional parameters for the ProtectedItemsClient.Get method. -func (client *ProtectedItemsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *ProtectedItemsClientGetOptions) (ProtectedItemsClientGetResponse, error) { - var err error - const operationName = "ProtectedItemsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, options) - if err != nil { - return ProtectedItemsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectedItemsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *ProtectedItemsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectedItemsClient) getHandleResponse(resp *http.Response) (ProtectedItemsClientGetResponse, error) { - result := ProtectedItemsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemResource); err != nil { - return ProtectedItemsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditems_client_example_test.go deleted file mode 100644 index a52d7495ed8f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protecteditems_client_example_test.go +++ /dev/null @@ -1,214 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ClassicCompute_ProtectedItem_Get.json -func ExampleProtectedItemsClient_Get_getProtectedClassicVirtualMachineDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemsClient().Get(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", "Azure", "iaasvmcontainer;iaasvmcontainer;iaasvm-rg;iaasvm-1", "vm;iaasvmcontainer;iaasvm-rg;iaasvm-1", &armrecoveryservicesbackup.ProtectedItemsClientGetOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectedItemResource = armrecoveryservicesbackup.ProtectedItemResource{ - // Name: to.Ptr("VM;iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainer;iaasvm-rg;iaasvm-1/protectedItems/VM;iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSClassicComputeVMProtectedItem{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // ContainerName: to.Ptr("iaasvmcontainer;iaasvm-rg;iaasvm-1"), - // LastRecoveryPoint: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-22T12:25:32.048Z"); return t}()), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupPolicies/testPolicy1"), - // ProtectedItemType: to.Ptr("Microsoft.ClassicCompute/virtualMachines"), - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.ClassicCompute/virtualMachines/iaasvm-1"), - // WorkloadType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - // FriendlyName: to.Ptr("iaasvm-1"), - // HealthStatus: to.Ptr(armrecoveryservicesbackup.HealthStatusPassed), - // LastBackupStatus: to.Ptr("Completed"), - // LastBackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-22T12:25:32.048Z"); return t}()), - // ProtectedItemDataID: to.Ptr("636482643132986882"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStateProtected), - // ProtectionStatus: to.Ptr("Healthy"), - // VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.ClassicCompute/virtualMachines/iaasvm-1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Compute_ProtectedItem_Get.json -func ExampleProtectedItemsClient_Get_getProtectedVirtualMachineDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemsClient().Get(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", "Azure", "iaasvmcontainer;iaasvmcontainerv2;iaasvm-rg;iaasvm-1", "vm;iaasvmcontainerv2;iaasvm-rg;iaasvm-1", &armrecoveryservicesbackup.ProtectedItemsClientGetOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectedItemResource = armrecoveryservicesbackup.ProtectedItemResource{ - // Name: to.Ptr("VM;iaasvmcontainerv2;iaasvm-rg;iaasvm-1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;iaasvm-rg;iaasvm-1/protectedItems/VM;iaasvmcontainerv2;iaasvm-rg;iaasvm-1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSComputeVMProtectedItem{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // ContainerName: to.Ptr("iaasvmcontainerv2;iaasvm-rg;iaasvm-1"), - // LastRecoveryPoint: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-22T12:25:32.048Z"); return t}()), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupPolicies/testPolicy1"), - // ProtectedItemType: to.Ptr("Microsoft.Compute/virtualMachines"), - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.Compute/virtualMachines/iaasvm-1"), - // WorkloadType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - // FriendlyName: to.Ptr("iaasvm-1"), - // HealthStatus: to.Ptr(armrecoveryservicesbackup.HealthStatusPassed), - // LastBackupStatus: to.Ptr("Completed"), - // LastBackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-22T12:25:32.048Z"); return t}()), - // ProtectedItemDataID: to.Ptr("636482643132986882"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStateProtected), - // ProtectionStatus: to.Ptr("Healthy"), - // VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/providers/Microsoft.Compute/virtualMachines/iaasvm-1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ConfigureProtection.json -func ExampleProtectedItemsClient_CreateOrUpdate_enableProtectionOnAzureIaasVm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemsClient().CreateOrUpdate(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", armrecoveryservicesbackup.ProtectedItemResource{ - Properties: &armrecoveryservicesbackup.AzureIaaSComputeVMProtectedItem{ - PolicyID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/DefaultPolicy"), - ProtectedItemType: to.Ptr("Microsoft.Compute/virtualMachines"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - }, - }, &armrecoveryservicesbackup.ProtectedItemsClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectedItemResource = armrecoveryservicesbackup.ProtectedItemResource{ - // Name: to.Ptr("VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1/protectedItems/VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSComputeVMProtectedItem{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // ContainerName: to.Ptr("iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupPolicies/testPolicy1"), - // ProtectedItemType: to.Ptr("Microsoft.Compute/virtualMachines"), - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - // WorkloadType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - // FriendlyName: to.Ptr("netvmtestv2vm1"), - // HealthStatus: to.Ptr(armrecoveryservicesbackup.HealthStatusPassed), - // LastBackupStatus: to.Ptr("Completed"), - // LastBackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-22T12:25:32.048Z"); return t}()), - // ProtectedItemDataID: to.Ptr("636482643132986882"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStateProtected), - // ProtectionStatus: to.Ptr("Healthy"), - // VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/StopProtection.json -func ExampleProtectedItemsClient_CreateOrUpdate_stopProtectionWithRetainDataOnAzureIaasVm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemsClient().CreateOrUpdate(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", armrecoveryservicesbackup.ProtectedItemResource{ - Properties: &armrecoveryservicesbackup.AzureIaaSComputeVMProtectedItem{ - ProtectedItemType: to.Ptr("Microsoft.Compute/virtualMachines"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStateProtectionStopped), - }, - }, &armrecoveryservicesbackup.ProtectedItemsClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectedItemResource = armrecoveryservicesbackup.ProtectedItemResource{ - // Name: to.Ptr("VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1/protectedItems/VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSComputeVMProtectedItem{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // ContainerName: to.Ptr("iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1"), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PythonSDKBackupTestRg/providers/Microsoft.RecoveryServices/vaults/PySDKBackupTestRsVault/backupPolicies/testPolicy1"), - // ProtectedItemType: to.Ptr("Microsoft.Compute/virtualMachines"), - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - // WorkloadType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - // FriendlyName: to.Ptr("netvmtestv2vm1"), - // HealthStatus: to.Ptr(armrecoveryservicesbackup.HealthStatusPassed), - // LastBackupStatus: to.Ptr("Completed"), - // LastBackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-22T12:25:32.048Z"); return t}()), - // ProtectedItemDataID: to.Ptr("636482643132986882"), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStateProtectionStopped), - // ProtectionStatus: to.Ptr("Healthy"), - // VirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete.json -func ExampleProtectedItemsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProtectedItemsClient().Delete(ctx, "PySDKBackupTestRsVault", "PythonSDKBackupTestRg", "Azure", "iaasvmcontainer;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", "vm;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontaineroperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontaineroperationresults_client.go deleted file mode 100644 index 43d40ce9352f..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontaineroperationresults_client.go +++ /dev/null @@ -1,124 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectionContainerOperationResultsClient contains the methods for the ProtectionContainerOperationResults group. -// Don't use this type directly, use NewProtectionContainerOperationResultsClient() instead. -type ProtectionContainerOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectionContainerOperationResultsClient creates a new instance of ProtectionContainerOperationResultsClient 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 NewProtectionContainerOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectionContainerOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectionContainerOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches the result of any operation on the container. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the container. -// - containerName - Container name whose information should be fetched. -// - operationID - Operation ID which represents the operation whose result needs to be fetched. -// - options - ProtectionContainerOperationResultsClientGetOptions contains the optional parameters for the ProtectionContainerOperationResultsClient.Get -// method. -func (client *ProtectionContainerOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, operationID string, options *ProtectionContainerOperationResultsClientGetOptions) (ProtectionContainerOperationResultsClientGetResponse, error) { - var err error - const operationName = "ProtectionContainerOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, operationID, options) - if err != nil { - return ProtectionContainerOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionContainerOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProtectionContainerOperationResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectionContainerOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, operationID string, options *ProtectionContainerOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectionContainerOperationResultsClient) getHandleResponse(resp *http.Response) (ProtectionContainerOperationResultsClientGetResponse, error) { - result := ProtectionContainerOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionContainerResource); err != nil { - return ProtectionContainerOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontaineroperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontaineroperationresults_client_example_test.go deleted file mode 100644 index 58b7af11ff9b..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontaineroperationresults_client_example_test.go +++ /dev/null @@ -1,77 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Inquire_Result.json -func ExampleProtectionContainerOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionContainerOperationResultsClient().Get(ctx, "testvault", "test-rg", "Azure", "VMAppContainer;Compute;testRG;testSQL", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionContainerResource = armrecoveryservicesbackup.ProtectionContainerResource{ - // Name: to.Ptr("VMAppContainer;Compute;testRG;testSQL"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/VMAppContainer;Compute;testRG;testSQL"), - // Properties: &armrecoveryservicesbackup.AzureVMAppContainerProtectionContainer{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureWorkload), - // ContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeVMAppContainer), - // FriendlyName: to.Ptr("testSQL"), - // ExtendedInfo: &armrecoveryservicesbackup.AzureWorkloadContainerExtendedInfo{ - // HostServerName: to.Ptr("testsql"), - // InquiryInfo: &armrecoveryservicesbackup.InquiryInfo{ - // ErrorDetail: &armrecoveryservicesbackup.ErrorDetail{ - // Code: to.Ptr("Success"), - // Message: to.Ptr("Not Available"), - // Recommendations: []*string{ - // to.Ptr("Not Available")}, - // }, - // InquiryDetails: []*armrecoveryservicesbackup.WorkloadInquiryDetails{ - // { - // Type: to.Ptr("sql"), - // InquiryValidation: &armrecoveryservicesbackup.InquiryValidation{ - // ErrorDetail: &armrecoveryservicesbackup.ErrorDetail{ - // Code: to.Ptr("Success"), - // Message: to.Ptr("Not Available"), - // Recommendations: []*string{ - // to.Ptr("Not Available")}, - // }, - // Status: to.Ptr("Success"), - // }, - // ItemCount: to.Ptr[int64](14), - // }}, - // Status: to.Ptr("Success"), - // }, - // NodesList: []*armrecoveryservicesbackup.DistributedNodesInfo{ - // }, - // }, - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testSQL"), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainerrefreshoperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainerrefreshoperationresults_client.go deleted file mode 100644 index 872b78940056..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainerrefreshoperationresults_client.go +++ /dev/null @@ -1,109 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectionContainerRefreshOperationResultsClient contains the methods for the ProtectionContainerRefreshOperationResults group. -// Don't use this type directly, use NewProtectionContainerRefreshOperationResultsClient() instead. -type ProtectionContainerRefreshOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectionContainerRefreshOperationResultsClient creates a new instance of ProtectionContainerRefreshOperationResultsClient 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 NewProtectionContainerRefreshOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectionContainerRefreshOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectionContainerRefreshOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Provides the result of the refresh operation triggered by the BeginRefresh operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the container. -// - operationID - Operation ID associated with the operation whose result needs to be fetched. -// - options - ProtectionContainerRefreshOperationResultsClientGetOptions contains the optional parameters for the ProtectionContainerRefreshOperationResultsClient.Get -// method. -func (client *ProtectionContainerRefreshOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, operationID string, options *ProtectionContainerRefreshOperationResultsClientGetOptions) (ProtectionContainerRefreshOperationResultsClientGetResponse, error) { - var err error - const operationName = "ProtectionContainerRefreshOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, operationID, options) - if err != nil { - return ProtectionContainerRefreshOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionContainerRefreshOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProtectionContainerRefreshOperationResultsClientGetResponse{}, err - } - return ProtectionContainerRefreshOperationResultsClientGetResponse{}, nil -} - -// getCreateRequest creates the Get request. -func (client *ProtectionContainerRefreshOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, operationID string, options *ProtectionContainerRefreshOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainerrefreshoperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainerrefreshoperationresults_client_example_test.go deleted file mode 100644 index 0ff1d70b8523..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainerrefreshoperationresults_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/RefreshContainers_OperationResults.json -func ExampleProtectionContainerRefreshOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProtectionContainerRefreshOperationResultsClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "Azure", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainers_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainers_client.go deleted file mode 100644 index 4b6097ddad10..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainers_client.go +++ /dev/null @@ -1,411 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectionContainersClient contains the methods for the ProtectionContainers group. -// Don't use this type directly, use NewProtectionContainersClient() instead. -type ProtectionContainersClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectionContainersClient creates a new instance of ProtectionContainersClient 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 NewProtectionContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectionContainersClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectionContainersClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets details of the specific container registered to your Recovery Services Vault. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Name of the fabric where the container belongs. -// - containerName - Name of the container whose details need to be fetched. -// - options - ProtectionContainersClientGetOptions contains the optional parameters for the ProtectionContainersClient.Get -// method. -func (client *ProtectionContainersClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *ProtectionContainersClientGetOptions) (ProtectionContainersClientGetResponse, error) { - var err error - const operationName = "ProtectionContainersClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, options) - if err != nil { - return ProtectionContainersClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionContainersClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectionContainersClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectionContainersClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *ProtectionContainersClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectionContainersClient) getHandleResponse(resp *http.Response) (ProtectionContainersClientGetResponse, error) { - result := ProtectionContainersClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionContainerResource); err != nil { - return ProtectionContainersClientGetResponse{}, err - } - return result, nil -} - -// Inquire - This is an async operation and the results should be tracked using location header or Azure-async-url. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric Name associated with the container. -// - containerName - Name of the container in which inquiry needs to be triggered. -// - options - ProtectionContainersClientInquireOptions contains the optional parameters for the ProtectionContainersClient.Inquire -// method. -func (client *ProtectionContainersClient) Inquire(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *ProtectionContainersClientInquireOptions) (ProtectionContainersClientInquireResponse, error) { - var err error - const operationName = "ProtectionContainersClient.Inquire" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.inquireCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, options) - if err != nil { - return ProtectionContainersClientInquireResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionContainersClientInquireResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ProtectionContainersClientInquireResponse{}, err - } - return ProtectionContainersClientInquireResponse{}, nil -} - -// inquireCreateRequest creates the Inquire request. -func (client *ProtectionContainersClient) inquireCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *ProtectionContainersClientInquireOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Refresh - Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an -// asynchronous operation. To know the status of the operation, call -// GetRefreshOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated the container. -// - options - ProtectionContainersClientRefreshOptions contains the optional parameters for the ProtectionContainersClient.Refresh -// method. -func (client *ProtectionContainersClient) Refresh(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, options *ProtectionContainersClientRefreshOptions) (ProtectionContainersClientRefreshResponse, error) { - var err error - const operationName = "ProtectionContainersClient.Refresh" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.refreshCreateRequest(ctx, vaultName, resourceGroupName, fabricName, options) - if err != nil { - return ProtectionContainersClientRefreshResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionContainersClientRefreshResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ProtectionContainersClientRefreshResponse{}, err - } - return ProtectionContainersClientRefreshResponse{}, nil -} - -// refreshCreateRequest creates the Refresh request. -func (client *ProtectionContainersClient) refreshCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, options *ProtectionContainersClientRefreshOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginRegister - Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation -// status, use location header to call get latest status of the operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the container. -// - containerName - Name of the container to be registered. -// - parameters - Request body for operation -// - options - ProtectionContainersClientBeginRegisterOptions contains the optional parameters for the ProtectionContainersClient.BeginRegister -// method. -func (client *ProtectionContainersClient) BeginRegister(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, parameters ProtectionContainerResource, options *ProtectionContainersClientBeginRegisterOptions) (*runtime.Poller[ProtectionContainersClientRegisterResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.register(ctx, vaultName, resourceGroupName, fabricName, containerName, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectionContainersClientRegisterResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProtectionContainersClientRegisterResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Register - Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation -// status, use location header to call get latest status of the operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *ProtectionContainersClient) register(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, parameters ProtectionContainerResource, options *ProtectionContainersClientBeginRegisterOptions) (*http.Response, error) { - var err error - const operationName = "ProtectionContainersClient.BeginRegister" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.registerCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// registerCreateRequest creates the Register request. -func (client *ProtectionContainersClient) registerCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, parameters ProtectionContainerResource, options *ProtectionContainersClientBeginRegisterOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// Unregister - Unregisters the given container from your Recovery Services Vault. This is an asynchronous operation. To determine -// whether the backend service has finished processing the request, call Get Container -// Operation Result API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Name of the fabric where the container belongs. -// - containerName - Name of the container which needs to be unregistered from the Recovery Services Vault. -// - options - ProtectionContainersClientUnregisterOptions contains the optional parameters for the ProtectionContainersClient.Unregister -// method. -func (client *ProtectionContainersClient) Unregister(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *ProtectionContainersClientUnregisterOptions) (ProtectionContainersClientUnregisterResponse, error) { - var err error - const operationName = "ProtectionContainersClient.Unregister" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.unregisterCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, options) - if err != nil { - return ProtectionContainersClientUnregisterResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionContainersClientUnregisterResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProtectionContainersClientUnregisterResponse{}, err - } - return ProtectionContainersClientUnregisterResponse{}, nil -} - -// unregisterCreateRequest creates the Unregister request. -func (client *ProtectionContainersClient) unregisterCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, options *ProtectionContainersClientUnregisterOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainers_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainers_client_example_test.go deleted file mode 100644 index 2dfb1091f302..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectioncontainers_client_example_test.go +++ /dev/null @@ -1,175 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionContainers_Get.json -func ExampleProtectionContainersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionContainersClient().Get(ctx, "testVault", "testRg", "Azure", "VMAppContainer;Compute;testRG;testSQL", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionContainerResource = armrecoveryservicesbackup.ProtectionContainerResource{ - // Name: to.Ptr("VMAppContainer;Compute;testRG;testSQL"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/VMAppContainer;Compute;testRG;testSQL"), - // Properties: &armrecoveryservicesbackup.AzureVMAppContainerProtectionContainer{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureWorkload), - // ContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeVMAppContainer), - // FriendlyName: to.Ptr("testSQL"), - // ExtendedInfo: &armrecoveryservicesbackup.AzureWorkloadContainerExtendedInfo{ - // HostServerName: to.Ptr("testsql"), - // InquiryInfo: &armrecoveryservicesbackup.InquiryInfo{ - // ErrorDetail: &armrecoveryservicesbackup.ErrorDetail{ - // Code: to.Ptr("Success"), - // Message: to.Ptr("Not Available"), - // Recommendations: []*string{ - // to.Ptr("Not Available")}, - // }, - // InquiryDetails: []*armrecoveryservicesbackup.WorkloadInquiryDetails{ - // { - // Type: to.Ptr("sql"), - // InquiryValidation: &armrecoveryservicesbackup.InquiryValidation{ - // ErrorDetail: &armrecoveryservicesbackup.ErrorDetail{ - // Code: to.Ptr("Success"), - // Message: to.Ptr("Not Available"), - // Recommendations: []*string{ - // to.Ptr("Not Available")}, - // }, - // Status: to.Ptr("Success"), - // }, - // ItemCount: to.Ptr[int64](14), - // }}, - // Status: to.Ptr("Success"), - // }, - // NodesList: []*armrecoveryservicesbackup.DistributedNodesInfo{ - // }, - // }, - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testSQL"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Register.json -func ExampleProtectionContainersClient_BeginRegister() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProtectionContainersClient().BeginRegister(ctx, "swaggertestvault", "SwaggerTestRg", "Azure", "StorageContainer;Storage;SwaggerTestRg;swaggertestsa", armrecoveryservicesbackup.ProtectionContainerResource{ - Properties: &armrecoveryservicesbackup.AzureStorageContainer{ - BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureStorage), - ContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeStorageContainer), - FriendlyName: to.Ptr("swaggertestsa"), - AcquireStorageAccountLock: to.Ptr(armrecoveryservicesbackup.AcquireStorageAccountLockAcquire), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/SwaggerTestRg/providers/Microsoft.Storage/storageAccounts/swaggertestsa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionContainerResource = armrecoveryservicesbackup.ProtectionContainerResource{ - // Name: to.Ptr("StorageContainer;Storage;SwaggerTestRg;swaggertestsa"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/swaggertestvault/backupFabrics/Azure/protectionContainers/StorageContainer;Storage;SwaggerTestRg;swaggertestsa"), - // Properties: &armrecoveryservicesbackup.AzureStorageContainer{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureStorage), - // ContainerType: to.Ptr(armrecoveryservicesbackup.ProtectableContainerTypeStorageContainer), - // FriendlyName: to.Ptr("swaggertestsa"), - // HealthStatus: to.Ptr("Healthy"), - // RegistrationStatus: to.Ptr("Registered"), - // AcquireStorageAccountLock: to.Ptr(armrecoveryservicesbackup.AcquireStorageAccountLockAcquire), - // ProtectedItemCount: to.Ptr[int64](0), - // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/SwaggerTestRg/providers/Microsoft.Storage/storageAccounts/swaggertestsa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionContainers_Unregister.json -func ExampleProtectionContainersClient_Unregister() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProtectionContainersClient().Unregister(ctx, "testVault", "testRg", "Azure", "storagecontainer;Storage;test-rg;teststorage", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Inquire.json -func ExampleProtectionContainersClient_Inquire() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProtectionContainersClient().Inquire(ctx, "testvault", "test-rg", "Azure", "storagecontainer;Storage;test-rg;teststorage", &armrecoveryservicesbackup.ProtectionContainersClientInquireOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/RefreshContainers.json -func ExampleProtectionContainersClient_Refresh() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProtectionContainersClient().Refresh(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "Azure", &armrecoveryservicesbackup.ProtectionContainersClientRefreshOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionintent_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionintent_client.go deleted file mode 100644 index 0adb09bd4bb8..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionintent_client.go +++ /dev/null @@ -1,328 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectionIntentClient contains the methods for the ProtectionIntent group. -// Don't use this type directly, use NewProtectionIntentClient() instead. -type ProtectionIntentClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectionIntentClient creates a new instance of ProtectionIntentClient 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 NewProtectionIntentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectionIntentClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectionIntentClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create Intent for Enabling backup of an item. This is a synchronous operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backup item. -// - intentObjectName - Intent object name. -// - parameters - resource backed up item -// - options - ProtectionIntentClientCreateOrUpdateOptions contains the optional parameters for the ProtectionIntentClient.CreateOrUpdate -// method. -func (client *ProtectionIntentClient) CreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, parameters ProtectionIntentResource, options *ProtectionIntentClientCreateOrUpdateOptions) (ProtectionIntentClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ProtectionIntentClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, vaultName, resourceGroupName, fabricName, intentObjectName, parameters, options) - if err != nil { - return ProtectionIntentClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionIntentClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectionIntentClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ProtectionIntentClient) createOrUpdateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, parameters ProtectionIntentResource, options *ProtectionIntentClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if intentObjectName == "" { - return nil, errors.New("parameter intentObjectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{intentObjectName}", url.PathEscape(intentObjectName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ProtectionIntentClient) createOrUpdateHandleResponse(resp *http.Response) (ProtectionIntentClientCreateOrUpdateResponse, error) { - result := ProtectionIntentClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionIntentResource); err != nil { - return ProtectionIntentClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Used to remove intent from an item -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the intent. -// - intentObjectName - Intent to be deleted. -// - options - ProtectionIntentClientDeleteOptions contains the optional parameters for the ProtectionIntentClient.Delete method. -func (client *ProtectionIntentClient) Delete(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, options *ProtectionIntentClientDeleteOptions) (ProtectionIntentClientDeleteResponse, error) { - var err error - const operationName = "ProtectionIntentClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, fabricName, intentObjectName, options) - if err != nil { - return ProtectionIntentClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionIntentClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ProtectionIntentClientDeleteResponse{}, err - } - return ProtectionIntentClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ProtectionIntentClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, options *ProtectionIntentClientDeleteOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if intentObjectName == "" { - return nil, errors.New("parameter intentObjectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{intentObjectName}", url.PathEscape(intentObjectName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// Get - Provides the details of the protection intent up item. This is an asynchronous operation. To know the status of the -// operation, call the GetItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backed up item. -// - intentObjectName - Backed up item name whose details are to be fetched. -// - options - ProtectionIntentClientGetOptions contains the optional parameters for the ProtectionIntentClient.Get method. -func (client *ProtectionIntentClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, options *ProtectionIntentClientGetOptions) (ProtectionIntentClientGetResponse, error) { - var err error - const operationName = "ProtectionIntentClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, intentObjectName, options) - if err != nil { - return ProtectionIntentClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionIntentClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectionIntentClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectionIntentClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, intentObjectName string, options *ProtectionIntentClientGetOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if intentObjectName == "" { - return nil, errors.New("parameter intentObjectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{intentObjectName}", url.PathEscape(intentObjectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectionIntentClient) getHandleResponse(resp *http.Response) (ProtectionIntentClientGetResponse, error) { - result := ProtectionIntentClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionIntentResource); err != nil { - return ProtectionIntentClientGetResponse{}, err - } - return result, nil -} - -// Validate - It will validate followings -// 1. Vault capacity -// 2. VM is already protected -// 3. Any VM related configuration passed in properties. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - azureRegion - Azure region to hit Api -// - parameters - Enable backup validation request on Virtual Machine -// - options - ProtectionIntentClientValidateOptions contains the optional parameters for the ProtectionIntentClient.Validate -// method. -func (client *ProtectionIntentClient) Validate(ctx context.Context, azureRegion string, parameters PreValidateEnableBackupRequest, options *ProtectionIntentClientValidateOptions) (ProtectionIntentClientValidateResponse, error) { - var err error - const operationName = "ProtectionIntentClient.Validate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.validateCreateRequest(ctx, azureRegion, parameters, options) - if err != nil { - return ProtectionIntentClientValidateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionIntentClientValidateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectionIntentClientValidateResponse{}, err - } - resp, err := client.validateHandleResponse(httpResp) - return resp, err -} - -// validateCreateRequest creates the Validate request. -func (client *ProtectionIntentClient) validateCreateRequest(ctx context.Context, azureRegion string, parameters PreValidateEnableBackupRequest, options *ProtectionIntentClientValidateOptions) (*policy.Request, error) { - urlPath := "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection" - if azureRegion == "" { - return nil, errors.New("parameter azureRegion cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureRegion}", url.PathEscape(azureRegion)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// validateHandleResponse handles the Validate response. -func (client *ProtectionIntentClient) validateHandleResponse(resp *http.Response) (ProtectionIntentClientValidateResponse, error) { - result := ProtectionIntentClientValidateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PreValidateEnableBackupResponse); err != nil { - return ProtectionIntentClientValidateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionintent_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionintent_client_example_test.go deleted file mode 100644 index cb56a18abec0..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionintent_client_example_test.go +++ /dev/null @@ -1,137 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionIntent_Validate.json -func ExampleProtectionIntentClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionIntentClient().Validate(ctx, "southeastasia", armrecoveryservicesbackup.PreValidateEnableBackupRequest{ - Properties: to.Ptr(""), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/arunaupgrade/providers/Microsoft.Compute/VirtualMachines/upgrade1"), - ResourceType: to.Ptr(armrecoveryservicesbackup.DataSourceTypeVM), - VaultID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/Vaults/myVault"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PreValidateEnableBackupResponse = armrecoveryservicesbackup.PreValidateEnableBackupResponse{ - // ContainerName: to.Ptr("iaasvmcontainer;iaasvmcontainerv2;arunaupgrade;upgrade1"), - // ErrorCode: to.Ptr("VirtualMachineAlreadyProtected"), - // ErrorMessage: to.Ptr("Virtual machine with same name and same resource group is already protected. Please select `Disable' choice above for backup and go to backup item corresponding to this VM in the vault"), - // ProtectedItemName: to.Ptr("vm;iaasvmcontainerv2;arunaupgrade;upgrade1"), - // Recommendation: to.Ptr("Please do not enable protection again."), - // Status: to.Ptr(armrecoveryservicesbackup.ValidationStatusFailed), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_Get.json -func ExampleProtectionIntentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionIntentClient().Get(ctx, "myVault", "myRG", "Azure", "249D9B07-D2EF-4202-AA64-65F35418564E", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionIntentResource = armrecoveryservicesbackup.ProtectionIntentResource{ - // Name: to.Ptr("249D9B07-D2EF-4202-AA64-65F35418564E"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupProtectionIntent"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupFabrics/Azure/backupProtectionIntent/249D9B07-D2EF-4202-AA64-65F35418564E"), - // Properties: &armrecoveryservicesbackup.AzureWorkloadContainerAutoProtectionIntent{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureWorkload), - // ItemID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupProtectionContainer/VMAppContainer;Compute;testVmName/backupProtectableItems/SQLInstance;MSSQLSERVER"), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupPolicies/myPolicy"), - // ProtectionIntentItemType: to.Ptr(armrecoveryservicesbackup.ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionIntent_CreateOrUpdate.json -func ExampleProtectionIntentClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionIntentClient().CreateOrUpdate(ctx, "myVault", "myRG", "Azure", "vm;iaasvmcontainerv2;chamsrgtest;chamscandel", armrecoveryservicesbackup.ProtectionIntentResource{ - Properties: &armrecoveryservicesbackup.AzureResourceProtectionIntent{ - PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupPolicies/myPolicy"), - ProtectionIntentItemType: to.Ptr(armrecoveryservicesbackup.ProtectionIntentItemTypeAzureResourceItem), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/chamsrgtest/providers/Microsoft.Compute/virtualMachines/chamscandel"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionIntentResource = armrecoveryservicesbackup.ProtectionIntentResource{ - // Name: to.Ptr("vm;iaasvmcontainerv2;chamsrgtest;chamscandel"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupProtectionIntent"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupFabrics/Azure/backupProtectionIntent/vm;iaasvmcontainerv2;chamsrgtest;chamscandel"), - // Properties: &armrecoveryservicesbackup.AzureResourceProtectionIntent{ - // BackupManagementType: to.Ptr(armrecoveryservicesbackup.BackupManagementTypeAzureIaasVM), - // PolicyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupPolicies/myPolicy"), - // ProtectionIntentItemType: to.Ptr(armrecoveryservicesbackup.ProtectionIntentItemTypeAzureResourceItem), - // ProtectionState: to.Ptr(armrecoveryservicesbackup.ProtectionStatusProtected), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_Delete.json -func ExampleProtectionIntentClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProtectionIntentClient().Delete(ctx, "myVault", "myRG", "Azure", "249D9B07-D2EF-4202-AA64-65F35418564E", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicies_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicies_client.go deleted file mode 100644 index 0e50af5f9e17..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicies_client.go +++ /dev/null @@ -1,275 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectionPoliciesClient contains the methods for the ProtectionPolicies group. -// Don't use this type directly, use NewProtectionPoliciesClient() instead. -type ProtectionPoliciesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectionPoliciesClient creates a new instance of ProtectionPoliciesClient 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 NewProtectionPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectionPoliciesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectionPoliciesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or modifies a backup policy. This is an asynchronous operation. Status of the operation can be -// fetched using GetPolicyOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - policyName - Backup policy to be created. -// - parameters - resource backup policy -// - options - ProtectionPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ProtectionPoliciesClient.CreateOrUpdate -// method. -func (client *ProtectionPoliciesClient) CreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, policyName string, parameters ProtectionPolicyResource, options *ProtectionPoliciesClientCreateOrUpdateOptions) (ProtectionPoliciesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ProtectionPoliciesClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, vaultName, resourceGroupName, policyName, parameters, options) - if err != nil { - return ProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ProtectionPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, policyName string, parameters ProtectionPolicyResource, options *ProtectionPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.XMSAuthorizationAuxiliary != nil { - req.Raw().Header["x-ms-authorization-auxiliary"] = []string{*options.XMSAuthorizationAuxiliary} - } - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ProtectionPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ProtectionPoliciesClientCreateOrUpdateResponse, error) { - result := ProtectionPoliciesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionPolicyResource); err != nil { - return ProtectionPoliciesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// BeginDelete - Deletes specified backup policy from your Recovery Services Vault. This is an asynchronous operation. Status -// of the operation can be fetched using GetProtectionPolicyOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - policyName - Backup policy to be deleted. -// - options - ProtectionPoliciesClientBeginDeleteOptions contains the optional parameters for the ProtectionPoliciesClient.BeginDelete -// method. -func (client *ProtectionPoliciesClient) BeginDelete(ctx context.Context, vaultName string, resourceGroupName string, policyName string, options *ProtectionPoliciesClientBeginDeleteOptions) (*runtime.Poller[ProtectionPoliciesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, vaultName, resourceGroupName, policyName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectionPoliciesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProtectionPoliciesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes specified backup policy from your Recovery Services Vault. This is an asynchronous operation. Status of -// the operation can be fetched using GetProtectionPolicyOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *ProtectionPoliciesClient) deleteOperation(ctx context.Context, vaultName string, resourceGroupName string, policyName string, options *ProtectionPoliciesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ProtectionPoliciesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, policyName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ProtectionPoliciesClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, policyName string, options *ProtectionPoliciesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Provides the details of the backup policies associated to Recovery Services Vault. This is an asynchronous operation. -// Status of the operation can be fetched using GetPolicyOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - policyName - Backup policy information to be fetched. -// - options - ProtectionPoliciesClientGetOptions contains the optional parameters for the ProtectionPoliciesClient.Get method. -func (client *ProtectionPoliciesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, policyName string, options *ProtectionPoliciesClientGetOptions) (ProtectionPoliciesClientGetResponse, error) { - var err error - const operationName = "ProtectionPoliciesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, policyName, options) - if err != nil { - return ProtectionPoliciesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionPoliciesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectionPoliciesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectionPoliciesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, policyName string, options *ProtectionPoliciesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectionPoliciesClient) getHandleResponse(resp *http.Response) (ProtectionPoliciesClientGetResponse, error) { - result := ProtectionPoliciesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionPolicyResource); err != nil { - return ProtectionPoliciesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicies_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicies_client_example_test.go deleted file mode 100644 index d7bcbd3d6494..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicies_client_example_test.go +++ /dev/null @@ -1,1397 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/v2-Get-Policy.json -func ExampleProtectionPoliciesClient_Get_getAzureIaasVmEnhancedProtectionPolicyDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "v2-daily-sample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("v2-daily-sample"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/v2-daily-sample"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // InstantRpRetentionRangeInDays: to.Ptr[int32](30), - // PolicyType: to.Ptr(armrecoveryservicesbackup.IAASVMPolicyTypeV2), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicyV2{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicyV2"), - // DailySchedule: &armrecoveryservicesbackup.DailySchedule{ - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // }, - // SnapshotConsistencyType: to.Ptr(armrecoveryservicesbackup.IaasVMSnapshotConsistencyTypeOnlyCrashConsistent), - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_Get.json -func ExampleProtectionPoliciesClient_Get_getAzureIaasVmProtectionPolicyDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "testPolicy1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hardened.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateAzureStorageVaultStandardProtectionPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "swaggertestvault", "SwaggerTestRg", "newPolicyV2", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureFileShareProtectionPolicy{ - BackupManagementType: to.Ptr("AzureStorage"), - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - ScheduleRunTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t }())}, - }, - TimeZone: to.Ptr("UTC"), - VaultRetentionPolicy: &armrecoveryservicesbackup.VaultRetentionPolicy{ - SnapshotRetentionInDays: to.Ptr[int32](5), - VaultRetention: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](30), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t }())}, - }, - MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](60), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t }())}, - }, - WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](12), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t }())}, - }, - YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](10), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t }())}, - }, - }, - }, - WorkLoadType: to.Ptr(armrecoveryservicesbackup.WorkloadTypeAzureFileShare), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("newPolicyV2"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/swaggertestvault/backupPolicies/newPolicyV2"), - // Properties: &armrecoveryservicesbackup.AzureFileShareProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureStorage"), - // ProtectedItemsCount: to.Ptr[int32](0), - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t}())}, - // }, - // TimeZone: to.Ptr("UTC"), - // VaultRetentionPolicy: &armrecoveryservicesbackup.VaultRetentionPolicy{ - // SnapshotRetentionInDays: to.Ptr[int32](5), - // VaultRetention: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](30), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t}())}, - // }, - // MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](60), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t}())}, - // }, - // WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](12), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t}())}, - // }, - // YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - // MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - // to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](10), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-18T09:30:00.000Z"); return t}())}, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Daily.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateDailyAzureStorageProtectionPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "swaggertestvault", "SwaggerTestRg", "dailyPolicy2", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureFileShareProtectionPolicy{ - BackupManagementType: to.Ptr("AzureStorage"), - RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](5), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t }())}, - }, - MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](60), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t }())}, - }, - WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](12), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t }())}, - }, - YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](10), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t }())}, - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - ScheduleRunTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t }())}, - }, - TimeZone: to.Ptr("UTC"), - WorkLoadType: to.Ptr(armrecoveryservicesbackup.WorkloadTypeAzureFileShare), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("dailyPolicy2"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/swaggertestvault/backupPolicies/dailyPolicy2"), - // Properties: &armrecoveryservicesbackup.AzureFileShareProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureStorage"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](5), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t}())}, - // }, - // MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](60), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t}())}, - // }, - // WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](12), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t}())}, - // }, - // YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - // MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - // to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](10), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("UTC"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/IaaS_v2_hourly.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateEnhancedAzureVmProtectionPolicyWithHourlyBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "v2-daily-sample", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - BackupManagementType: to.Ptr("AzureIaasVM"), - InstantRpRetentionRangeInDays: to.Ptr[int32](30), - PolicyType: to.Ptr(armrecoveryservicesbackup.IAASVMPolicyTypeV2), - RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](180), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](60), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](12), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](10), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicyV2{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicyV2"), - HourlySchedule: &armrecoveryservicesbackup.HourlySchedule{ - Interval: to.Ptr[int32](4), - ScheduleWindowDuration: to.Ptr[int32](16), - ScheduleWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }()), - }, - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeHourly), - }, - SnapshotConsistencyType: to.Ptr(armrecoveryservicesbackup.IaasVMSnapshotConsistencyTypeOnlyCrashConsistent), - TimeZone: to.Ptr("India Standard Time"), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("v2-daily-sample"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/v2-daily-sample"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // InstantRpRetentionRangeInDays: to.Ptr[int32](30), - // PolicyType: to.Ptr(armrecoveryservicesbackup.IAASVMPolicyTypeV2), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](180), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](60), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](12), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - // MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - // to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](10), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicyV2{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicyV2"), - // HourlySchedule: &armrecoveryservicesbackup.HourlySchedule{ - // Interval: to.Ptr[int32](4), - // ScheduleWindowDuration: to.Ptr[int32](16), - // ScheduleWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}()), - // }, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeHourly), - // }, - // SnapshotConsistencyType: to.Ptr(armrecoveryservicesbackup.IaasVMSnapshotConsistencyTypeOnlyCrashConsistent), - // TimeZone: to.Ptr("India Standard Time"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/IaaS_v2_daily.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateEnhancedAzureVmProtectionPolicyWithDailyBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "v2-daily-sample", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - BackupManagementType: to.Ptr("AzureIaasVM"), - InstantRpRetentionRangeInDays: to.Ptr[int32](30), - PolicyType: to.Ptr(armrecoveryservicesbackup.IAASVMPolicyTypeV2), - RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](180), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](60), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](12), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](10), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t }())}, - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicyV2{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicyV2"), - DailySchedule: &armrecoveryservicesbackup.DailySchedule{ - ScheduleRunTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - }, - SnapshotConsistencyType: to.Ptr(armrecoveryservicesbackup.IaasVMSnapshotConsistencyTypeOnlyCrashConsistent), - TimeZone: to.Ptr("India Standard Time"), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("v2-daily-sample"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/v2-daily-sample"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // InstantRpRetentionRangeInDays: to.Ptr[int32](30), - // PolicyType: to.Ptr(armrecoveryservicesbackup.IAASVMPolicyTypeV2), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](180), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](60), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](12), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - // MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - // to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](10), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-17T08:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicyV2{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicyV2"), - // DailySchedule: &armrecoveryservicesbackup.DailySchedule{ - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // }, - // SnapshotConsistencyType: to.Ptr(armrecoveryservicesbackup.IaasVMSnapshotConsistencyTypeOnlyCrashConsistent), - // TimeZone: to.Ptr("India Standard Time"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Complex.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateFullAzureVmProtectionPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "testPolicy1", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - BackupManagementType: to.Ptr("AzureIaasVM"), - RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](2), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekWednesday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst), - to.Ptr(armrecoveryservicesbackup.WeekOfMonthThird)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekMonday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekWednesday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](1), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - to.Ptr(armrecoveryservicesbackup.MonthOfYearFebruary), - to.Ptr(armrecoveryservicesbackup.MonthOfYearNovember)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](4), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekMonday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFourth)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - ScheduleRunDays: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekMonday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekWednesday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeWeekly), - ScheduleRunTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - TimeZone: to.Ptr("Pacific Standard Time"), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](2), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekWednesday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst), - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthThird)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekMonday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekWednesday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - // MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - // to.Ptr(armrecoveryservicesbackup.MonthOfYearFebruary), - // to.Ptr(armrecoveryservicesbackup.MonthOfYearNovember)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](4), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekMonday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFourth)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunDays: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekMonday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekWednesday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekThursday)}, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeWeekly), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionPolicies_CreateOrUpdate_Complex.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateFullAzureWorkloadProtectionPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "testPolicy1", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureVMWorkloadProtectionPolicy{ - BackupManagementType: to.Ptr("AzureWorkload"), - Settings: &armrecoveryservicesbackup.Settings{ - Issqlcompression: to.Ptr(false), - TimeZone: to.Ptr("Pacific Standard Time"), - }, - SubProtectionPolicy: []*armrecoveryservicesbackup.SubProtectionPolicy{ - { - PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeFull), - RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](1), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthSecond)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekTuesday)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](2), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary), - to.Ptr(armrecoveryservicesbackup.MonthOfYearJune), - to.Ptr(armrecoveryservicesbackup.MonthOfYearDecember)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](1), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthLast)}, - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - ScheduleRunDays: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday), - to.Ptr(armrecoveryservicesbackup.DayOfWeekTuesday)}, - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeWeekly), - ScheduleRunTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - }, - { - PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeDifferential), - RetentionPolicy: &armrecoveryservicesbackup.SimpleRetentionPolicy{ - RetentionPolicyType: to.Ptr("SimpleRetentionPolicy"), - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](8), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - ScheduleRunDays: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekFriday)}, - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeWeekly), - ScheduleRunTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t }())}, - }, - }, - { - PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeLog), - RetentionPolicy: &armrecoveryservicesbackup.SimpleRetentionPolicy{ - RetentionPolicyType: to.Ptr("SimpleRetentionPolicy"), - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](7), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.LogSchedulePolicy{ - SchedulePolicyType: to.Ptr("LogSchedulePolicy"), - ScheduleFrequencyInMins: to.Ptr[int32](60), - }, - }}, - WorkLoadType: to.Ptr(armrecoveryservicesbackup.WorkloadTypeSQLDataBase), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // Properties: &armrecoveryservicesbackup.AzureVMWorkloadProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureWorkload"), - // ProtectedItemsCount: to.Ptr[int32](0), - // Settings: &armrecoveryservicesbackup.Settings{ - // Issqlcompression: to.Ptr(false), - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // SubProtectionPolicy: []*armrecoveryservicesbackup.SubProtectionPolicy{ - // { - // PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeFull), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthSecond)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekTuesday)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](2), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - // MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - // to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary), - // to.Ptr(armrecoveryservicesbackup.MonthOfYearJune), - // to.Ptr(armrecoveryservicesbackup.MonthOfYearDecember)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthLast)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunDays: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday), - // to.Ptr(armrecoveryservicesbackup.DayOfWeekTuesday)}, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeWeekly), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // }, - // { - // PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeDifferential), - // RetentionPolicy: &armrecoveryservicesbackup.SimpleRetentionPolicy{ - // RetentionPolicyType: to.Ptr("SimpleRetentionPolicy"), - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](8), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunDays: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekFriday)}, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeWeekly), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // }, - // { - // PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeLog), - // RetentionPolicy: &armrecoveryservicesbackup.SimpleRetentionPolicy{ - // RetentionPolicyType: to.Ptr("SimpleRetentionPolicy"), - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](7), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.LogSchedulePolicy{ - // SchedulePolicyType: to.Ptr("LogSchedulePolicy"), - // ScheduleFrequencyInMins: to.Ptr[int32](60), - // }, - // }}, - // WorkLoadType: to.Ptr(armrecoveryservicesbackup.WorkloadTypeSQLDataBase), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hourly.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateHourlyAzureStorageProtectionPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "swaggertestvault", "SwaggerTestRg", "newPolicy2", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureFileShareProtectionPolicy{ - BackupManagementType: to.Ptr("AzureStorage"), - RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](5), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - }, - MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](60), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - }, - WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](12), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - }, - }, - YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](10), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - }, - RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - }, - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - HourlySchedule: &armrecoveryservicesbackup.HourlySchedule{ - Interval: to.Ptr[int32](4), - ScheduleWindowDuration: to.Ptr[int32](12), - ScheduleWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t }()), - }, - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeHourly), - }, - TimeZone: to.Ptr("UTC"), - WorkLoadType: to.Ptr(armrecoveryservicesbackup.WorkloadTypeAzureFileShare), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("newPolicy2"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/swaggertestvault/backupPolicies/newPolicy2"), - // Properties: &armrecoveryservicesbackup.AzureFileShareProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureStorage"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](5), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T20:00:00.000Z"); return t}())}, - // }, - // MonthlySchedule: &armrecoveryservicesbackup.MonthlyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](60), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeMonths), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T20:00:00.000Z"); return t}())}, - // }, - // WeeklySchedule: &armrecoveryservicesbackup.WeeklyRetentionSchedule{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](12), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeWeeks), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T20:00:00.000Z"); return t}())}, - // }, - // YearlySchedule: &armrecoveryservicesbackup.YearlyRetentionSchedule{ - // MonthsOfYear: []*armrecoveryservicesbackup.MonthOfYear{ - // to.Ptr(armrecoveryservicesbackup.MonthOfYearJanuary)}, - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](10), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeYears), - // }, - // RetentionScheduleFormatType: to.Ptr(armrecoveryservicesbackup.RetentionScheduleFormatWeekly), - // RetentionScheduleWeekly: &armrecoveryservicesbackup.WeeklyRetentionFormat{ - // DaysOfTheWeek: []*armrecoveryservicesbackup.DayOfWeek{ - // to.Ptr(armrecoveryservicesbackup.DayOfWeekSunday)}, - // WeeksOfTheMonth: []*armrecoveryservicesbackup.WeekOfMonth{ - // to.Ptr(armrecoveryservicesbackup.WeekOfMonthFirst)}, - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T20:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // HourlySchedule: &armrecoveryservicesbackup.HourlySchedule{ - // Interval: to.Ptr[int32](4), - // ScheduleWindowDuration: to.Ptr[int32](12), - // ScheduleWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-29T08:00:00.000Z"); return t}()), - // }, - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeHourly), - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("UTC"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Simple.json -func ExampleProtectionPoliciesClient_CreateOrUpdate_createOrUpdateSimpleAzureVmProtectionPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPoliciesClient().CreateOrUpdate(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "testPolicy1", armrecoveryservicesbackup.ProtectionPolicyResource{ - Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - BackupManagementType: to.Ptr("AzureIaasVM"), - RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - Count: to.Ptr[int32](1), - DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - }, - RetentionTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t }())}, - }, - }, - SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - ScheduleRunTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t }())}, - }, - TimeZone: to.Ptr("Pacific Standard Time"), - }, - }, &armrecoveryservicesbackup.ProtectionPoliciesClientCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](0), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_Delete.json -func ExampleProtectionPoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProtectionPoliciesClient().BeginDelete(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "testPolicy1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationresults_client.go deleted file mode 100644 index 4b9acc4a4c50..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationresults_client.go +++ /dev/null @@ -1,119 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectionPolicyOperationResultsClient contains the methods for the ProtectionPolicyOperationResults group. -// Don't use this type directly, use NewProtectionPolicyOperationResultsClient() instead. -type ProtectionPolicyOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectionPolicyOperationResultsClient creates a new instance of ProtectionPolicyOperationResultsClient 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 NewProtectionPolicyOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectionPolicyOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectionPolicyOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Provides the result of an operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - policyName - Backup policy name whose operation's result needs to be fetched. -// - operationID - Operation ID which represents the operation whose result needs to be fetched. -// - options - ProtectionPolicyOperationResultsClientGetOptions contains the optional parameters for the ProtectionPolicyOperationResultsClient.Get -// method. -func (client *ProtectionPolicyOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, policyName string, operationID string, options *ProtectionPolicyOperationResultsClientGetOptions) (ProtectionPolicyOperationResultsClientGetResponse, error) { - var err error - const operationName = "ProtectionPolicyOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, policyName, operationID, options) - if err != nil { - return ProtectionPolicyOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionPolicyOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectionPolicyOperationResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectionPolicyOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, policyName string, operationID string, options *ProtectionPolicyOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectionPolicyOperationResultsClient) getHandleResponse(resp *http.Response) (ProtectionPolicyOperationResultsClientGetResponse, error) { - result := ProtectionPolicyOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectionPolicyResource); err != nil { - return ProtectionPolicyOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationresults_client_example_test.go deleted file mode 100644 index 4e60b9581103..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationresults_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicyOperationResults_Get.json -func ExampleProtectionPolicyOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPolicyOperationResultsClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "testPolicy1", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProtectionPolicyResource = armrecoveryservicesbackup.ProtectionPolicyResource{ - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"), - // ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"), - // Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{ - // BackupManagementType: to.Ptr("AzureIaasVM"), - // ProtectedItemsCount: to.Ptr[int32](1), - // RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{ - // RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"), - // DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{ - // RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{ - // Count: to.Ptr[int32](1), - // DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays), - // }, - // RetentionTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // }, - // }, - // SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{ - // SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"), - // ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily), - // ScheduleRunTimes: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00.000Z"); return t}())}, - // ScheduleWeeklyFrequency: to.Ptr[int32](0), - // }, - // TimeZone: to.Ptr("Pacific Standard Time"), - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationstatuses_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationstatuses_client.go deleted file mode 100644 index 402338acc9c0..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationstatuses_client.go +++ /dev/null @@ -1,121 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ProtectionPolicyOperationStatusesClient contains the methods for the ProtectionPolicyOperationStatuses group. -// Don't use this type directly, use NewProtectionPolicyOperationStatusesClient() instead. -type ProtectionPolicyOperationStatusesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectionPolicyOperationStatusesClient creates a new instance of ProtectionPolicyOperationStatusesClient 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 NewProtectionPolicyOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectionPolicyOperationStatusesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectionPolicyOperationStatusesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Provides the status of the asynchronous operations like backup, restore. The status can be in progress, completed -// or failed. You can refer to the Operation Status enum for all the possible states of -// an operation. Some operations create jobs. This method returns the list of jobs associated with operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - policyName - Backup policy name whose operation's status needs to be fetched. -// - operationID - Operation ID which represents an operation whose status needs to be fetched. -// - options - ProtectionPolicyOperationStatusesClientGetOptions contains the optional parameters for the ProtectionPolicyOperationStatusesClient.Get -// method. -func (client *ProtectionPolicyOperationStatusesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, policyName string, operationID string, options *ProtectionPolicyOperationStatusesClientGetOptions) (ProtectionPolicyOperationStatusesClientGetResponse, error) { - var err error - const operationName = "ProtectionPolicyOperationStatusesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, policyName, operationID, options) - if err != nil { - return ProtectionPolicyOperationStatusesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectionPolicyOperationStatusesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectionPolicyOperationStatusesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectionPolicyOperationStatusesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, policyName string, operationID string, options *ProtectionPolicyOperationStatusesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectionPolicyOperationStatusesClient) getHandleResponse(resp *http.Response) (ProtectionPolicyOperationStatusesClientGetResponse, error) { - result := ProtectionPolicyOperationStatusesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ProtectionPolicyOperationStatusesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationstatuses_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationstatuses_client_example_test.go deleted file mode 100644 index 5cfdddb262cf..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/protectionpolicyoperationstatuses_client_example_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicyOperationStatuses_Get.json -func ExampleProtectionPolicyOperationStatusesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectionPolicyOperationStatusesClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "testPolicy1", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armrecoveryservicesbackup.OperationStatus{ - // Name: to.Ptr("GetProtectionPolicyOperationStatus"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T12:57:32.114Z"); return t}()), - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.OperationStatusJobsExtendedInfo{ - // ObjectType: to.Ptr("OperationStatusJobsExtendedInfo"), - // FailedJobsError: map[string]*string{ - // }, - // JobIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T12:57:32.114Z"); return t}()), - // Status: to.Ptr(armrecoveryservicesbackup.OperationStatusValuesSucceeded), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypoints_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypoints_client.go index 8631b85ee6fb..c0f1d124e2ea 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypoints_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypoints_client.go @@ -43,43 +43,44 @@ func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCrede return client, nil } -// Get - Provides the information of the backed up data identified using RecoveryPointID. This is an asynchronous operation. -// To know the status of the operation, call the GetProtectedItemOperationResult API. +// GetAccessToken - Returns the Access token for communication between BMS and Protection service // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-01 +// Generated from API version 2024-11-15 // - vaultName - The name of the recovery services vault. // - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with backed up item. -// - containerName - Container name associated with backed up item. -// - protectedItemName - Backed up item name whose backup data needs to be fetched. -// - recoveryPointID - RecoveryPointID represents the backed up data to be fetched. -// - options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -func (client *RecoveryPointsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { +// - fabricName - Fabric name associated with the container. +// - containerName - Name of the container. +// - protectedItemName - Name of the Protected Item. +// - recoveryPointID - Recovery Point Id +// - parameters - Get Access Token request +// - options - RecoveryPointsClientGetAccessTokenOptions contains the optional parameters for the RecoveryPointsClient.GetAccessToken +// method. +func (client *RecoveryPointsClient) GetAccessToken(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters AADPropertiesResource, options *RecoveryPointsClientGetAccessTokenOptions) (RecoveryPointsClientGetAccessTokenResponse, error) { var err error - const operationName = "RecoveryPointsClient.Get" + const operationName = "RecoveryPointsClient.GetAccessToken" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, options) + req, err := client.getAccessTokenCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters, options) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointsClientGetAccessTokenResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointsClientGetAccessTokenResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointsClientGetAccessTokenResponse{}, err } - resp, err := client.getHandleResponse(httpResp) + resp, err := client.getAccessTokenHandleResponse(httpResp) return resp, err } -// getCreateRequest creates the Get request. -func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}" +// getAccessTokenCreateRequest creates the GetAccessToken request. +func (client *RecoveryPointsClient) getAccessTokenCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters AADPropertiesResource, options *RecoveryPointsClientGetAccessTokenOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken" if vaultName == "" { return nil, errors.New("parameter vaultName cannot be empty") } @@ -108,104 +109,25 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, vaultN return nil, errors.New("parameter recoveryPointID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPointId}", url.PathEscape(recoveryPointID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") + reqQP.Set("api-version", "2024-11-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (RecoveryPointsClientGetResponse, error) { - result := RecoveryPointsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointResource); err != nil { - return RecoveryPointsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists the backup copies for the backed up item. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backed up item. -// - containerName - Container name associated with the backed up item. -// - protectedItemName - Backed up item whose backup copies are to be fetched. -// - options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -func (client *RecoveryPointsClient) NewListPager(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *RecoveryPointsClientListOptions) *runtime.Pager[RecoveryPointsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RecoveryPointsClientListResponse]{ - More: func(page RecoveryPointsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RecoveryPointsClientListResponse) (RecoveryPointsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, options) - }, nil) - if err != nil { - return RecoveryPointsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *RecoveryPointsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { + if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listHandleResponse handles the List response. -func (client *RecoveryPointsClient) listHandleResponse(resp *http.Response) (RecoveryPointsClientListResponse, error) { - result := RecoveryPointsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointResourceList); err != nil { - return RecoveryPointsClientListResponse{}, err +// getAccessTokenHandleResponse handles the GetAccessToken response. +func (client *RecoveryPointsClient) getAccessTokenHandleResponse(resp *http.Response) (RecoveryPointsClientGetAccessTokenResponse, error) { + result := RecoveryPointsClientGetAccessTokenResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CrrAccessTokenResource); err != nil { + return RecoveryPointsClientGetAccessTokenResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypoints_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypoints_client_example_test.go deleted file mode 100644 index 1f1065349cf6..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypoints_client_example_test.go +++ /dev/null @@ -1,208 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPoints_List.json -func ExampleRecoveryPointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoveryPointsClient().NewListPager("rshvault", "rshhtestmdvmrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", "VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", &armrecoveryservicesbackup.RecoveryPointsClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecoveryPointResourceList = armrecoveryservicesbackup.RecoveryPointResourceList{ - // Value: []*armrecoveryservicesbackup.RecoveryPointResource{ - // { - // Name: to.Ptr("22244821112382"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rshhtestmdvmrg/providers/Microsoft.RecoveryServices/vaults/rshvault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/protectedItems/VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/recoveryPoints/22244821112382"), - // Properties: &armrecoveryservicesbackup.IaasVMRecoveryPoint{ - // ObjectType: to.Ptr("IaasVMRecoveryPoint"), - // IsInstantIlrSessionActive: to.Ptr(false), - // IsManagedVirtualMachine: to.Ptr(true), - // IsSourceVMEncrypted: to.Ptr(false), - // OriginalStorageAccountOption: to.Ptr(false), - // RecoveryPointAdditionalInfo: to.Ptr(""), - // RecoveryPointMoveReadinessInfo: map[string]*armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // "Archive": &armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // IsReadyForMove: to.Ptr(true), - // }, - // }, - // RecoveryPointTierDetails: []*armrecoveryservicesbackup.RecoveryPointTierInformationV2{ - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeInstantRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusDeleted), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusValid), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-21T22:48:25.435Z"); return t}()), - // RecoveryPointType: to.Ptr("CrashConsistent"), - // SourceVMStorageType: to.Ptr("NormalStorage"), - // VirtualMachineSize: to.Ptr("Standard_D1"), - // }, - // }, - // { - // Name: to.Ptr("24977149827250"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rshhtestmdvmrg/providers/Microsoft.RecoveryServices/vaults/rshvault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/protectedItems/VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/recoveryPoints/24977149827250"), - // Properties: &armrecoveryservicesbackup.IaasVMRecoveryPoint{ - // ObjectType: to.Ptr("IaasVMRecoveryPoint"), - // IsInstantIlrSessionActive: to.Ptr(false), - // IsManagedVirtualMachine: to.Ptr(true), - // IsPrivateAccessEnabledOnAnyDisk: to.Ptr(true), - // IsSourceVMEncrypted: to.Ptr(false), - // OriginalStorageAccountOption: to.Ptr(false), - // RecoveryPointAdditionalInfo: to.Ptr(""), - // RecoveryPointMoveReadinessInfo: map[string]*armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // "ArchivedRP": &armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // AdditionalInfo: to.Ptr("Recovery point cannot be moved to archive tier since it has already been moved."), - // IsReadyForMove: to.Ptr(false), - // }, - // }, - // RecoveryPointTierDetails: []*armrecoveryservicesbackup.RecoveryPointTierInformationV2{ - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeInstantRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusDeleted), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusDeleted), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeArchivedRP), - // ExtendedInfo: map[string]*string{ - // "RehydratedRPExpiryTime": to.Ptr("2020-12-21T22:48:25.4353958Z"), - // }, - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusRehydrated), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-20T22:49:44.331Z"); return t}()), - // RecoveryPointType: to.Ptr("CrashConsistent"), - // SourceVMStorageType: to.Ptr("NormalStorage"), - // VirtualMachineSize: to.Ptr("Standard_D1"), - // Zones: []*string{ - // to.Ptr("1")}, - // }, - // }, - // { - // Name: to.Ptr("70477518625276"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/FijiValidation-asr-microsoftrrdclab3-408/providers/Microsoft.RecoveryServices/vaults/testVault408/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;fijivalidation-asr-microsoftrrdclab3-408;vm408/protectedItems/VM;iaasvmcontainerv2;fijivalidation-asr-microsoftrrdclab3-408;vm408/recoveryPoints/70477518625276"), - // Properties: &armrecoveryservicesbackup.IaasVMRecoveryPoint{ - // ObjectType: to.Ptr("IaasVMRecoveryPoint"), - // ExtendedLocation: &armrecoveryservicesbackup.ExtendedLocation{ - // Name: to.Ptr("microsoftrrdclab3"), - // Type: to.Ptr("EdgeZone"), - // }, - // IsInstantIlrSessionActive: to.Ptr(false), - // IsManagedVirtualMachine: to.Ptr(true), - // IsPrivateAccessEnabledOnAnyDisk: to.Ptr(false), - // IsSourceVMEncrypted: to.Ptr(true), - // OriginalStorageAccountOption: to.Ptr(false), - // OSType: to.Ptr("Windows"), - // RecoveryPointAdditionalInfo: to.Ptr(""), - // RecoveryPointMoveReadinessInfo: map[string]*armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // "ArchivedRP": &armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // AdditionalInfo: to.Ptr("We're still determining if this Recovery Point can be moved.. Please check again after some time."), - // IsReadyForMove: to.Ptr(false), - // }, - // }, - // RecoveryPointTierDetails: []*armrecoveryservicesbackup.RecoveryPointTierInformationV2{ - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeInstantRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusValid), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusValid), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-22T20:02:00.122Z"); return t}()), - // RecoveryPointType: to.Ptr("CrashConsistent"), - // SecurityType: to.Ptr("None"), - // SourceVMStorageType: to.Ptr("PremiumVMOnPartialPremiumStorage"), - // VirtualMachineSize: to.Ptr("Standard_D2s_v3"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPoints_Get.json -func ExampleRecoveryPointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoveryPointsClient().Get(ctx, "rshvault", "rshhtestmdvmrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", "VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", "26083826328862", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoveryPointResource = armrecoveryservicesbackup.RecoveryPointResource{ - // Name: to.Ptr("26083826328862"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rshhtestmdvmrg/providers/Microsoft.RecoveryServices/vaults/rshvault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/protectedItems/VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/recoveryPoints/26083826328862"), - // Properties: &armrecoveryservicesbackup.IaasVMRecoveryPoint{ - // ObjectType: to.Ptr("IaasVMRecoveryPoint"), - // IsInstantIlrSessionActive: to.Ptr(false), - // IsManagedVirtualMachine: to.Ptr(true), - // IsPrivateAccessEnabledOnAnyDisk: to.Ptr(true), - // IsSourceVMEncrypted: to.Ptr(false), - // OriginalStorageAccountOption: to.Ptr(false), - // RecoveryPointAdditionalInfo: to.Ptr(""), - // RecoveryPointMoveReadinessInfo: map[string]*armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // "ArchivedRP": &armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // IsReadyForMove: to.Ptr(true), - // }, - // }, - // RecoveryPointTierDetails: []*armrecoveryservicesbackup.RecoveryPointTierInformationV2{ - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusValid), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-22T22:32:46.608Z"); return t}()), - // RecoveryPointType: to.Ptr("CrashConsistent"), - // SourceVMStorageType: to.Ptr("NormalStorage"), - // VirtualMachineSize: to.Ptr("Standard_D1"), - // Zones: []*string{ - // to.Ptr("1")}, - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointscrr_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointscrr_client.go new file mode 100644 index 000000000000..2f486b882798 --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointscrr_client.go @@ -0,0 +1,211 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armrecoveryservicesbackup + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// RecoveryPointsCrrClient contains the methods for the RecoveryPointsCrr group. +// Don't use this type directly, use NewRecoveryPointsCrrClient() instead. +type RecoveryPointsCrrClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRecoveryPointsCrrClient creates a new instance of RecoveryPointsCrrClient 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 NewRecoveryPointsCrrClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsCrrClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RecoveryPointsCrrClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Provides the information of the backed up data identified using RecoveryPointID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-11-15 +// - vaultName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name associated with backed up item. +// - containerName - Container name associated with backed up item. +// - protectedItemName - Backed up item name whose backup data needs to be fetched. +// - recoveryPointID - RecoveryPointID represents the backed up data to be fetched. +// - options - RecoveryPointsCrrClientGetOptions contains the optional parameters for the RecoveryPointsCrrClient.Get method. +func (client *RecoveryPointsCrrClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *RecoveryPointsCrrClientGetOptions) (RecoveryPointsCrrClientGetResponse, error) { + var err error + const operationName = "RecoveryPointsCrrClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, options) + if err != nil { + return RecoveryPointsCrrClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RecoveryPointsCrrClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecoveryPointsCrrClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RecoveryPointsCrrClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, options *RecoveryPointsCrrClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}" + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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 fabricName == "" { + return nil, errors.New("parameter fabricName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if protectedItemName == "" { + return nil, errors.New("parameter protectedItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) + if recoveryPointID == "" { + return nil, errors.New("parameter recoveryPointID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{recoveryPointId}", url.PathEscape(recoveryPointID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-11-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RecoveryPointsCrrClient) getHandleResponse(resp *http.Response) (RecoveryPointsCrrClientGetResponse, error) { + result := RecoveryPointsCrrClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointResource); err != nil { + return RecoveryPointsCrrClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the backup copies for the backed up item. +// +// Generated from API version 2024-11-15 +// - vaultName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name associated with the backed up item. +// - containerName - Container name associated with the backed up item. +// - protectedItemName - Backed up item whose backup copies are to be fetched. +// - options - RecoveryPointsCrrClientListOptions contains the optional parameters for the RecoveryPointsCrrClient.NewListPager +// method. +func (client *RecoveryPointsCrrClient) NewListPager(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *RecoveryPointsCrrClientListOptions) *runtime.Pager[RecoveryPointsCrrClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RecoveryPointsCrrClientListResponse]{ + More: func(page RecoveryPointsCrrClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RecoveryPointsCrrClientListResponse) (RecoveryPointsCrrClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointsCrrClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, options) + }, nil) + if err != nil { + return RecoveryPointsCrrClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *RecoveryPointsCrrClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, options *RecoveryPointsCrrClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/" + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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 fabricName == "" { + return nil, errors.New("parameter fabricName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + if protectedItemName == "" { + return nil, errors.New("parameter protectedItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2024-11-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RecoveryPointsCrrClient) listHandleResponse(resp *http.Response) (RecoveryPointsCrrClientListResponse, error) { + result := RecoveryPointsCrrClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointResourceList); err != nil { + return RecoveryPointsCrrClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointsrecommendedformove_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointsrecommendedformove_client.go deleted file mode 100644 index 0040a45908d9..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointsrecommendedformove_client.go +++ /dev/null @@ -1,125 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// RecoveryPointsRecommendedForMoveClient contains the methods for the RecoveryPointsRecommendedForMove group. -// Don't use this type directly, use NewRecoveryPointsRecommendedForMoveClient() instead. -type RecoveryPointsRecommendedForMoveClient struct { - internal *arm.Client - subscriptionID string -} - -// NewRecoveryPointsRecommendedForMoveClient creates a new instance of RecoveryPointsRecommendedForMoveClient 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 NewRecoveryPointsRecommendedForMoveClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsRecommendedForMoveClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RecoveryPointsRecommendedForMoveClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the recovery points recommended for move to another tier -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - List Recovery points Recommended for Move Request -// - options - RecoveryPointsRecommendedForMoveClientListOptions contains the optional parameters for the RecoveryPointsRecommendedForMoveClient.NewListPager -// method. -func (client *RecoveryPointsRecommendedForMoveClient) NewListPager(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ListRecoveryPointsRecommendedForMoveRequest, options *RecoveryPointsRecommendedForMoveClientListOptions) *runtime.Pager[RecoveryPointsRecommendedForMoveClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RecoveryPointsRecommendedForMoveClientListResponse]{ - More: func(page RecoveryPointsRecommendedForMoveClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RecoveryPointsRecommendedForMoveClientListResponse) (RecoveryPointsRecommendedForMoveClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointsRecommendedForMoveClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters, options) - }, nil) - if err != nil { - return RecoveryPointsRecommendedForMoveClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *RecoveryPointsRecommendedForMoveClient) listCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ListRecoveryPointsRecommendedForMoveRequest, options *RecoveryPointsRecommendedForMoveClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// listHandleResponse handles the List response. -func (client *RecoveryPointsRecommendedForMoveClient) listHandleResponse(resp *http.Response) (RecoveryPointsRecommendedForMoveClientListResponse, error) { - result := RecoveryPointsRecommendedForMoveClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointResourceList); err != nil { - return RecoveryPointsRecommendedForMoveClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointsrecommendedformove_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointsrecommendedformove_client_example_test.go deleted file mode 100644 index d87ccca7dbb3..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/recoverypointsrecommendedformove_client_example_test.go +++ /dev/null @@ -1,123 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPointsRecommendedForMove_List.json -func ExampleRecoveryPointsRecommendedForMoveClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoveryPointsRecommendedForMoveClient().NewListPager("rshvault", "rshhtestmdvmrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", "VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", armrecoveryservicesbackup.ListRecoveryPointsRecommendedForMoveRequest{ - ExcludedRPList: []*string{ - to.Ptr("348916168024334"), - to.Ptr("348916168024335")}, - ObjectType: to.Ptr("ListRecoveryPointsRecommendedForMoveRequest"), - }, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecoveryPointResourceList = armrecoveryservicesbackup.RecoveryPointResourceList{ - // Value: []*armrecoveryservicesbackup.RecoveryPointResource{ - // { - // Name: to.Ptr("22244821112382"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rshhtestmdvmrg/providers/Microsoft.RecoveryServices/vaults/rshvault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/protectedItems/VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/recoveryPoints/22244821112382"), - // Properties: &armrecoveryservicesbackup.IaasVMRecoveryPoint{ - // ObjectType: to.Ptr("IaasVMRecoveryPoint"), - // IsInstantIlrSessionActive: to.Ptr(false), - // IsManagedVirtualMachine: to.Ptr(true), - // IsSourceVMEncrypted: to.Ptr(false), - // OriginalStorageAccountOption: to.Ptr(false), - // RecoveryPointAdditionalInfo: to.Ptr(""), - // RecoveryPointMoveReadinessInfo: map[string]*armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // "ArchivedRP": &armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // IsReadyForMove: to.Ptr(true), - // }, - // }, - // RecoveryPointTierDetails: []*armrecoveryservicesbackup.RecoveryPointTierInformationV2{ - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeInstantRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusDeleted), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusValid), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-21T22:48:25.435Z"); return t}()), - // RecoveryPointType: to.Ptr("CrashConsistent"), - // SourceVMStorageType: to.Ptr("NormalStorage"), - // VirtualMachineSize: to.Ptr("Standard_D1"), - // }, - // }, - // { - // Name: to.Ptr("24977149827250"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rshhtestmdvmrg/providers/Microsoft.RecoveryServices/vaults/rshvault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/protectedItems/VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall/recoveryPoints/24977149827250"), - // Properties: &armrecoveryservicesbackup.IaasVMRecoveryPoint{ - // ObjectType: to.Ptr("IaasVMRecoveryPoint"), - // IsInstantIlrSessionActive: to.Ptr(false), - // IsManagedVirtualMachine: to.Ptr(true), - // IsSourceVMEncrypted: to.Ptr(false), - // OriginalStorageAccountOption: to.Ptr(false), - // RecoveryPointAdditionalInfo: to.Ptr(""), - // RecoveryPointMoveReadinessInfo: map[string]*armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // "ArchivedRP": &armrecoveryservicesbackup.RecoveryPointMoveReadinessInfo{ - // IsReadyForMove: to.Ptr(true), - // }, - // }, - // RecoveryPointTierDetails: []*armrecoveryservicesbackup.RecoveryPointTierInformationV2{ - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeInstantRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusDeleted), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeHardenedRP), - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusDeleted), - // }, - // { - // Type: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierTypeArchivedRP), - // ExtendedInfo: map[string]*string{ - // "RehydratedRPExpiryTime": to.Ptr("2020-12-21T22:48:25.4353958Z"), - // }, - // Status: to.Ptr(armrecoveryservicesbackup.RecoveryPointTierStatusRehydrated), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-20T22:49:44.331Z"); return t}()), - // RecoveryPointType: to.Ptr("CrashConsistent"), - // SourceVMStorageType: to.Ptr("NormalStorage"), - // VirtualMachineSize: to.Ptr("Standard_D1"), - // Zones: []*string{ - // to.Ptr("1")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxies_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxies_client.go deleted file mode 100644 index d57d4d827410..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxies_client.go +++ /dev/null @@ -1,109 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ResourceGuardProxiesClient contains the methods for the ResourceGuardProxies group. -// Don't use this type directly, use NewResourceGuardProxiesClient() instead. -type ResourceGuardProxiesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewResourceGuardProxiesClient creates a new instance of ResourceGuardProxiesClient 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 NewResourceGuardProxiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceGuardProxiesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ResourceGuardProxiesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewGetPager - List the ResourceGuardProxies under vault -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - ResourceGuardProxiesClientGetOptions contains the optional parameters for the ResourceGuardProxiesClient.NewGetPager -// method. -func (client *ResourceGuardProxiesClient) NewGetPager(vaultName string, resourceGroupName string, options *ResourceGuardProxiesClientGetOptions) *runtime.Pager[ResourceGuardProxiesClientGetResponse] { - return runtime.NewPager(runtime.PagingHandler[ResourceGuardProxiesClientGetResponse]{ - More: func(page ResourceGuardProxiesClientGetResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ResourceGuardProxiesClientGetResponse) (ResourceGuardProxiesClientGetResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceGuardProxiesClient.NewGetPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.getCreateRequest(ctx, vaultName, resourceGroupName, options) - }, nil) - if err != nil { - return ResourceGuardProxiesClientGetResponse{}, err - } - return client.getHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// getCreateRequest creates the Get request. -func (client *ResourceGuardProxiesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *ResourceGuardProxiesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ResourceGuardProxiesClient) getHandleResponse(resp *http.Response) (ResourceGuardProxiesClientGetResponse, error) { - result := ResourceGuardProxiesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardProxyBaseResourceList); err != nil { - return ResourceGuardProxiesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxies_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxies_client_example_test.go deleted file mode 100644 index 79b58107cd02..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxies_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json -func ExampleResourceGuardProxiesClient_NewGetPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardProxiesClient().NewGetPager("sampleVault", "SampleResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceGuardProxyBaseResourceList = armrecoveryservicesbackup.ResourceGuardProxyBaseResourceList{ - // Value: []*armrecoveryservicesbackup.ResourceGuardProxyBaseResource{ - // { - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies"), - // ID: to.Ptr("/backupmanagement/resources/sampleVault/backupResourceGuardProxies/swaggerExample"), - // Properties: &armrecoveryservicesbackup.ResourceGuardProxyBase{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // LastUpdatedTime: to.Ptr("2021-02-11T12:20:47.8210031Z"), - // ResourceGuardOperationDetails: []*armrecoveryservicesbackup.ResourceGuardOperationDetail{ - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/deleteResourceGuardProxyRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // }, - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/disableSoftDeleteRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // }}, - // ResourceGuardResourceID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxy_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxy_client.go deleted file mode 100644 index 354513784a3c..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxy_client.go +++ /dev/null @@ -1,316 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ResourceGuardProxyClient contains the methods for the ResourceGuardProxy group. -// Don't use this type directly, use NewResourceGuardProxyClient() instead. -type ResourceGuardProxyClient struct { - internal *arm.Client - subscriptionID string -} - -// NewResourceGuardProxyClient creates a new instance of ResourceGuardProxyClient 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 NewResourceGuardProxyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceGuardProxyClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ResourceGuardProxyClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Delete - Delete ResourceGuardProxy under vault -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - ResourceGuardProxyClientDeleteOptions contains the optional parameters for the ResourceGuardProxyClient.Delete -// method. -func (client *ResourceGuardProxyClient) Delete(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, options *ResourceGuardProxyClientDeleteOptions) (ResourceGuardProxyClientDeleteResponse, error) { - var err error - const operationName = "ResourceGuardProxyClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, vaultName, resourceGroupName, resourceGuardProxyName, options) - if err != nil { - return ResourceGuardProxyClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ResourceGuardProxyClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ResourceGuardProxyClientDeleteResponse{}, err - } - return ResourceGuardProxyClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ResourceGuardProxyClient) deleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, options *ResourceGuardProxyClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns ResourceGuardProxy under vault and with the name referenced in request -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - ResourceGuardProxyClientGetOptions contains the optional parameters for the ResourceGuardProxyClient.Get method. -func (client *ResourceGuardProxyClient) Get(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, options *ResourceGuardProxyClientGetOptions) (ResourceGuardProxyClientGetResponse, error) { - var err error - const operationName = "ResourceGuardProxyClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, resourceGuardProxyName, options) - if err != nil { - return ResourceGuardProxyClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ResourceGuardProxyClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ResourceGuardProxyClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ResourceGuardProxyClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, options *ResourceGuardProxyClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ResourceGuardProxyClient) getHandleResponse(resp *http.Response) (ResourceGuardProxyClientGetResponse, error) { - result := ResourceGuardProxyClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardProxyBaseResource); err != nil { - return ResourceGuardProxyClientGetResponse{}, err - } - return result, nil -} - -// Put - Add or Update ResourceGuardProxy under vault Secures vault critical operations -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - Request body for operation -// - options - ResourceGuardProxyClientPutOptions contains the optional parameters for the ResourceGuardProxyClient.Put method. -func (client *ResourceGuardProxyClient) Put(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, parameters ResourceGuardProxyBaseResource, options *ResourceGuardProxyClientPutOptions) (ResourceGuardProxyClientPutResponse, error) { - var err error - const operationName = "ResourceGuardProxyClient.Put" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.putCreateRequest(ctx, vaultName, resourceGroupName, resourceGuardProxyName, parameters, options) - if err != nil { - return ResourceGuardProxyClientPutResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ResourceGuardProxyClientPutResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ResourceGuardProxyClientPutResponse{}, err - } - resp, err := client.putHandleResponse(httpResp) - return resp, err -} - -// putCreateRequest creates the Put request. -func (client *ResourceGuardProxyClient) putCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, parameters ResourceGuardProxyBaseResource, options *ResourceGuardProxyClientPutOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// putHandleResponse handles the Put response. -func (client *ResourceGuardProxyClient) putHandleResponse(resp *http.Response) (ResourceGuardProxyClientPutResponse, error) { - result := ResourceGuardProxyClientPutResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardProxyBaseResource); err != nil { - return ResourceGuardProxyClientPutResponse{}, err - } - return result, nil -} - -// UnlockDelete - Secures delete ResourceGuardProxy operations. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - Request body for operation -// - options - ResourceGuardProxyClientUnlockDeleteOptions contains the optional parameters for the ResourceGuardProxyClient.UnlockDelete -// method. -func (client *ResourceGuardProxyClient) UnlockDelete(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, parameters UnlockDeleteRequest, options *ResourceGuardProxyClientUnlockDeleteOptions) (ResourceGuardProxyClientUnlockDeleteResponse, error) { - var err error - const operationName = "ResourceGuardProxyClient.UnlockDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.unlockDeleteCreateRequest(ctx, vaultName, resourceGroupName, resourceGuardProxyName, parameters, options) - if err != nil { - return ResourceGuardProxyClientUnlockDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ResourceGuardProxyClientUnlockDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ResourceGuardProxyClientUnlockDeleteResponse{}, err - } - resp, err := client.unlockDeleteHandleResponse(httpResp) - return resp, err -} - -// unlockDeleteCreateRequest creates the UnlockDelete request. -func (client *ResourceGuardProxyClient) unlockDeleteCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, resourceGuardProxyName string, parameters UnlockDeleteRequest, options *ResourceGuardProxyClientUnlockDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// unlockDeleteHandleResponse handles the UnlockDelete response. -func (client *ResourceGuardProxyClient) unlockDeleteHandleResponse(resp *http.Response) (ResourceGuardProxyClientUnlockDeleteResponse, error) { - result := ResourceGuardProxyClientUnlockDeleteResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.UnlockDeleteResponse); err != nil { - return ResourceGuardProxyClientUnlockDeleteResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxy_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxy_client_example_test.go deleted file mode 100644 index a8f6ed522185..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/resourceguardproxy_client_example_test.go +++ /dev/null @@ -1,145 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json -func ExampleResourceGuardProxyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardProxyClient().Get(ctx, "sampleVault", "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceGuardProxyBaseResource = armrecoveryservicesbackup.ResourceGuardProxyBaseResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies"), - // ID: to.Ptr("/backupmanagement/resources/sampleVault/backupResourceGuardProxies/swaggerExample"), - // Properties: &armrecoveryservicesbackup.ResourceGuardProxyBase{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // LastUpdatedTime: to.Ptr("2021-02-11T12:20:47.8210031Z"), - // ResourceGuardOperationDetails: []*armrecoveryservicesbackup.ResourceGuardOperationDetail{ - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/deleteResourceGuardProxyRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // }, - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/resourceguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/disableSoftDeleteRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // }}, - // ResourceGuardResourceID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json -func ExampleResourceGuardProxyClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardProxyClient().Put(ctx, "sampleVault", "SampleResourceGroup", "swaggerExample", armrecoveryservicesbackup.ResourceGuardProxyBaseResource{ - Properties: &armrecoveryservicesbackup.ResourceGuardProxyBase{ - ResourceGuardResourceID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceGuardProxyBaseResource = armrecoveryservicesbackup.ResourceGuardProxyBaseResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies"), - // ID: to.Ptr("/backupmanagement/resources/sampleVault/backupResourceGuardProxies/swaggerExample"), - // Properties: &armrecoveryservicesbackup.ResourceGuardProxyBase{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // LastUpdatedTime: to.Ptr("2021-02-11T12:20:47.8210031Z"), - // ResourceGuardOperationDetails: []*armrecoveryservicesbackup.ResourceGuardOperationDetail{ - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/deleteResourceGuardProxyRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // }, - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/disableSoftDeleteRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // }}, - // ResourceGuardResourceID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json -func ExampleResourceGuardProxyClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewResourceGuardProxyClient().Delete(ctx, "sampleVault", "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json -func ExampleResourceGuardProxyClient_UnlockDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardProxyClient().UnlockDelete(ctx, "sampleVault", "SampleResourceGroup", "swaggerExample", armrecoveryservicesbackup.UnlockDeleteRequest{ - ResourceGuardOperationRequests: []*string{ - to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/deleteProtectedItemRequests/default")}, - ResourceToBeDeleted: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/gaallarg/providers/Microsoft.RecoveryServices/vaults/MercuryCrrVault/backupFabrics/Azure/protectionContainers/VMAppContainer;compute;crrtestrg;crrtestvm/protectedItems/SQLDataBase;mssqlserver;testdb"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UnlockDeleteResponse = armrecoveryservicesbackup.UnlockDeleteResponse{ - // UnlockDeleteExpiryTime: to.Ptr("2021-02-11T13:12:27.7870742Z"), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/responses.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/responses.go index 7d717bf25dd6..f704db3e03f4 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/responses.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/responses.go @@ -8,491 +8,81 @@ package armrecoveryservicesbackup -import "encoding/json" - -// BMSPrepareDataMoveOperationResultClientGetResponse contains the response from method BMSPrepareDataMoveOperationResultClient.Get. -type BMSPrepareDataMoveOperationResultClientGetResponse struct { - // Operation result response for Vault Storage Config - VaultStorageConfigOperationResultResponseClassification -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BMSPrepareDataMoveOperationResultClientGetResponse. -func (b *BMSPrepareDataMoveOperationResultClientGetResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalVaultStorageConfigOperationResultResponseClassification(data) - if err != nil { - return err - } - b.VaultStorageConfigOperationResultResponseClassification = res - return nil +// AADPropertiesClientGetResponse contains the response from method AADPropertiesClient.Get. +type AADPropertiesClientGetResponse struct { + AADPropertiesResource } -// BackupEnginesClientGetResponse contains the response from method BackupEnginesClient.Get. -type BackupEnginesClientGetResponse struct { - // The base backup engine class. All workload specific backup engines derive from this class. - BackupEngineBaseResource -} - -// BackupEnginesClientListResponse contains the response from method BackupEnginesClient.NewListPager. -type BackupEnginesClientListResponse struct { - // List of BackupEngineBase resources - BackupEngineBaseResourceList +// BackupCrrJobDetailsClientGetResponse contains the response from method BackupCrrJobDetailsClient.Get. +type BackupCrrJobDetailsClientGetResponse struct { + // Defines workload agnostic properties for a job. + JobResource } -// BackupJobsClientListResponse contains the response from method BackupJobsClient.NewListPager. -type BackupJobsClientListResponse struct { +// BackupCrrJobsClientListResponse contains the response from method BackupCrrJobsClient.NewListPager. +type BackupCrrJobsClientListResponse struct { // List of Job resources JobResourceList } -// BackupOperationResultsClientGetResponse contains the response from method BackupOperationResultsClient.Get. -type BackupOperationResultsClientGetResponse struct { - // placeholder for future response values -} - -// BackupOperationStatusesClientGetResponse contains the response from method BackupOperationStatusesClient.Get. -type BackupOperationStatusesClientGetResponse struct { - // Operation status. - OperationStatus -} - -// BackupPoliciesClientListResponse contains the response from method BackupPoliciesClient.NewListPager. -type BackupPoliciesClientListResponse struct { - // List of ProtectionPolicy resources - ProtectionPolicyResourceList -} - -// BackupProtectableItemsClientListResponse contains the response from method BackupProtectableItemsClient.NewListPager. -type BackupProtectableItemsClientListResponse struct { - // List of WorkloadProtectableItem resources - WorkloadProtectableItemResourceList -} - -// BackupProtectedItemsClientListResponse contains the response from method BackupProtectedItemsClient.NewListPager. -type BackupProtectedItemsClientListResponse struct { +// BackupProtectedItemsCrrClientListResponse contains the response from method BackupProtectedItemsCrrClient.NewListPager. +type BackupProtectedItemsCrrClientListResponse struct { // List of ProtectedItem resources ProtectedItemResourceList } -// BackupProtectionContainersClientListResponse contains the response from method BackupProtectionContainersClient.NewListPager. -type BackupProtectionContainersClientListResponse struct { - // List of ProtectionContainer resources - ProtectionContainerResourceList -} - -// BackupProtectionIntentClientListResponse contains the response from method BackupProtectionIntentClient.NewListPager. -type BackupProtectionIntentClientListResponse struct { - // List of ProtectionIntent resources - ProtectionIntentResourceList -} - -// BackupResourceEncryptionConfigsClientGetResponse contains the response from method BackupResourceEncryptionConfigsClient.Get. -type BackupResourceEncryptionConfigsClientGetResponse struct { - BackupResourceEncryptionConfigExtendedResource -} - -// BackupResourceEncryptionConfigsClientUpdateResponse contains the response from method BackupResourceEncryptionConfigsClient.Update. -type BackupResourceEncryptionConfigsClientUpdateResponse struct { - // placeholder for future response values -} - -// BackupResourceStorageConfigsNonCRRClientGetResponse contains the response from method BackupResourceStorageConfigsNonCRRClient.Get. -type BackupResourceStorageConfigsNonCRRClientGetResponse struct { +// BackupResourceStorageConfigsClientGetResponse contains the response from method BackupResourceStorageConfigsClient.Get. +type BackupResourceStorageConfigsClientGetResponse struct { // The resource storage details. BackupResourceConfigResource } -// BackupResourceStorageConfigsNonCRRClientPatchResponse contains the response from method BackupResourceStorageConfigsNonCRRClient.Patch. -type BackupResourceStorageConfigsNonCRRClientPatchResponse struct { +// BackupResourceStorageConfigsClientPatchResponse contains the response from method BackupResourceStorageConfigsClient.Patch. +type BackupResourceStorageConfigsClientPatchResponse struct { // placeholder for future response values } -// BackupResourceStorageConfigsNonCRRClientUpdateResponse contains the response from method BackupResourceStorageConfigsNonCRRClient.Update. -type BackupResourceStorageConfigsNonCRRClientUpdateResponse struct { +// BackupResourceStorageConfigsClientUpdateResponse contains the response from method BackupResourceStorageConfigsClient.Update. +type BackupResourceStorageConfigsClientUpdateResponse struct { // The resource storage details. BackupResourceConfigResource } -// BackupResourceVaultConfigsClientGetResponse contains the response from method BackupResourceVaultConfigsClient.Get. -type BackupResourceVaultConfigsClientGetResponse struct { - // Backup resource vault config details. - BackupResourceVaultConfigResource -} - -// BackupResourceVaultConfigsClientPutResponse contains the response from method BackupResourceVaultConfigsClient.Put. -type BackupResourceVaultConfigsClientPutResponse struct { - // Backup resource vault config details. - BackupResourceVaultConfigResource -} - -// BackupResourceVaultConfigsClientUpdateResponse contains the response from method BackupResourceVaultConfigsClient.Update. -type BackupResourceVaultConfigsClientUpdateResponse struct { - // Backup resource vault config details. - BackupResourceVaultConfigResource -} - -// BackupStatusClientGetResponse contains the response from method BackupStatusClient.Get. -type BackupStatusClientGetResponse struct { - // BackupStatus response. - BackupStatusResponse -} - -// BackupUsageSummariesClientListResponse contains the response from method BackupUsageSummariesClient.NewListPager. -type BackupUsageSummariesClientListResponse struct { +// BackupUsageSummariesCRRClientListResponse contains the response from method BackupUsageSummariesCRRClient.NewListPager. +type BackupUsageSummariesCRRClientListResponse struct { // Backup management usage for vault. BackupManagementUsageList } -// BackupWorkloadItemsClientListResponse contains the response from method BackupWorkloadItemsClient.NewListPager. -type BackupWorkloadItemsClientListResponse struct { - // List of WorkloadItem resources - WorkloadItemResourceList -} - -// BackupsClientTriggerResponse contains the response from method BackupsClient.Trigger. -type BackupsClientTriggerResponse struct { - // placeholder for future response values -} - -// ClientBMSPrepareDataMoveResponse contains the response from method Client.BeginBMSPrepareDataMove. -type ClientBMSPrepareDataMoveResponse struct { - // placeholder for future response values -} - -// ClientBMSTriggerDataMoveResponse contains the response from method Client.BeginBMSTriggerDataMove. -type ClientBMSTriggerDataMoveResponse struct { - // placeholder for future response values -} - -// ClientGetOperationStatusResponse contains the response from method Client.GetOperationStatus. -type ClientGetOperationStatusResponse struct { - // Operation status. - OperationStatus -} - -// ClientMoveRecoveryPointResponse contains the response from method Client.BeginMoveRecoveryPoint. -type ClientMoveRecoveryPointResponse struct { +// CrossRegionRestoreClientTriggerResponse contains the response from method CrossRegionRestoreClient.BeginTrigger. +type CrossRegionRestoreClientTriggerResponse struct { // placeholder for future response values } -// DeletedProtectionContainersClientListResponse contains the response from method DeletedProtectionContainersClient.NewListPager. -type DeletedProtectionContainersClientListResponse struct { - // List of ProtectionContainer resources - ProtectionContainerResourceList -} - -// ExportJobsOperationResultsClientGetResponse contains the response from method ExportJobsOperationResultsClient.Get. -type ExportJobsOperationResultsClientGetResponse struct { - // Base class for operation result info. - OperationResultInfoBaseResource -} - -// FeatureSupportClientValidateResponse contains the response from method FeatureSupportClient.Validate. -type FeatureSupportClientValidateResponse struct { - // Response for feature support requests for Azure IaasVm - AzureVMResourceFeatureSupportResponse -} - -// FetchTieringCostClientPostResponse contains the response from method FetchTieringCostClient.BeginPost. -type FetchTieringCostClientPostResponse struct { - // Base class for tiering cost response - TieringCostInfoClassification -} - -// MarshalJSON implements the json.Marshaller interface for type FetchTieringCostClientPostResponse. -func (f FetchTieringCostClientPostResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(f.TieringCostInfoClassification) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FetchTieringCostClientPostResponse. -func (f *FetchTieringCostClientPostResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalTieringCostInfoClassification(data) - if err != nil { - return err - } - f.TieringCostInfoClassification = res - return nil -} - -// GetTieringCostOperationResultClientGetResponse contains the response from method GetTieringCostOperationResultClient.Get. -type GetTieringCostOperationResultClientGetResponse struct { - // Base class for tiering cost response - TieringCostInfoClassification -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GetTieringCostOperationResultClientGetResponse. -func (g *GetTieringCostOperationResultClientGetResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalTieringCostInfoClassification(data) - if err != nil { - return err - } - g.TieringCostInfoClassification = res - return nil -} - -// ItemLevelRecoveryConnectionsClientProvisionResponse contains the response from method ItemLevelRecoveryConnectionsClient.Provision. -type ItemLevelRecoveryConnectionsClientProvisionResponse struct { +// CrrOperationResultsClientGetResponse contains the response from method CrrOperationResultsClient.Get. +type CrrOperationResultsClientGetResponse struct { // placeholder for future response values } -// ItemLevelRecoveryConnectionsClientRevokeResponse contains the response from method ItemLevelRecoveryConnectionsClient.Revoke. -type ItemLevelRecoveryConnectionsClientRevokeResponse struct { - // placeholder for future response values -} - -// JobCancellationsClientTriggerResponse contains the response from method JobCancellationsClient.Trigger. -type JobCancellationsClientTriggerResponse struct { - // placeholder for future response values -} - -// JobDetailsClientGetResponse contains the response from method JobDetailsClient.Get. -type JobDetailsClientGetResponse struct { - // Defines workload agnostic properties for a job. - JobResource -} - -// JobOperationResultsClientGetResponse contains the response from method JobOperationResultsClient.Get. -type JobOperationResultsClientGetResponse struct { - // placeholder for future response values -} - -// JobsClientExportResponse contains the response from method JobsClient.Export. -type JobsClientExportResponse struct { - // placeholder for future response values -} - -// OperationClientValidateResponse contains the response from method OperationClient.Validate. -type OperationClientValidateResponse struct { - ValidateOperationsResponse -} - -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // Operations List response which contains list of available APIs. - ClientDiscoveryResponse -} - -// PrivateEndpointClientGetOperationStatusResponse contains the response from method PrivateEndpointClient.GetOperationStatus. -type PrivateEndpointClientGetOperationStatusResponse struct { +// CrrOperationStatusClientGetResponse contains the response from method CrrOperationStatusClient.Get. +type CrrOperationStatusClientGetResponse struct { // Operation status. OperationStatus } -// PrivateEndpointConnectionClientDeleteResponse contains the response from method PrivateEndpointConnectionClient.BeginDelete. -type PrivateEndpointConnectionClientDeleteResponse struct { - // placeholder for future response values +// RecoveryPointsClientGetAccessTokenResponse contains the response from method RecoveryPointsClient.GetAccessToken. +type RecoveryPointsClientGetAccessTokenResponse struct { + CrrAccessTokenResource } -// PrivateEndpointConnectionClientGetResponse contains the response from method PrivateEndpointConnectionClient.Get. -type PrivateEndpointConnectionClientGetResponse struct { - // Private Endpoint Connection Response Properties - PrivateEndpointConnectionResource -} - -// PrivateEndpointConnectionClientPutResponse contains the response from method PrivateEndpointConnectionClient.BeginPut. -type PrivateEndpointConnectionClientPutResponse struct { - // Private Endpoint Connection Response Properties - PrivateEndpointConnectionResource -} - -// ProtectableContainersClientListResponse contains the response from method ProtectableContainersClient.NewListPager. -type ProtectableContainersClientListResponse struct { - // List of ProtectableContainer resources - ProtectableContainerResourceList -} - -// ProtectedItemOperationResultsClientGetResponse contains the response from method ProtectedItemOperationResultsClient.Get. -type ProtectedItemOperationResultsClientGetResponse struct { - // Base class for backup items. - ProtectedItemResource -} - -// ProtectedItemOperationStatusesClientGetResponse contains the response from method ProtectedItemOperationStatusesClient.Get. -type ProtectedItemOperationStatusesClientGetResponse struct { - // Operation status. - OperationStatus -} - -// ProtectedItemsClientCreateOrUpdateResponse contains the response from method ProtectedItemsClient.CreateOrUpdate. -type ProtectedItemsClientCreateOrUpdateResponse struct { - // Base class for backup items. - ProtectedItemResource -} - -// ProtectedItemsClientDeleteResponse contains the response from method ProtectedItemsClient.Delete. -type ProtectedItemsClientDeleteResponse struct { - // placeholder for future response values -} - -// ProtectedItemsClientGetResponse contains the response from method ProtectedItemsClient.Get. -type ProtectedItemsClientGetResponse struct { - // Base class for backup items. - ProtectedItemResource -} - -// ProtectionContainerOperationResultsClientGetResponse contains the response from method ProtectionContainerOperationResultsClient.Get. -type ProtectionContainerOperationResultsClientGetResponse struct { - // Base class for container with backup items. Containers with specific workloads are derived from this class. - ProtectionContainerResource -} - -// ProtectionContainerRefreshOperationResultsClientGetResponse contains the response from method ProtectionContainerRefreshOperationResultsClient.Get. -type ProtectionContainerRefreshOperationResultsClientGetResponse struct { - // placeholder for future response values -} - -// ProtectionContainersClientGetResponse contains the response from method ProtectionContainersClient.Get. -type ProtectionContainersClientGetResponse struct { - // Base class for container with backup items. Containers with specific workloads are derived from this class. - ProtectionContainerResource -} - -// ProtectionContainersClientInquireResponse contains the response from method ProtectionContainersClient.Inquire. -type ProtectionContainersClientInquireResponse struct { - // placeholder for future response values -} - -// ProtectionContainersClientRefreshResponse contains the response from method ProtectionContainersClient.Refresh. -type ProtectionContainersClientRefreshResponse struct { - // placeholder for future response values -} - -// ProtectionContainersClientRegisterResponse contains the response from method ProtectionContainersClient.BeginRegister. -type ProtectionContainersClientRegisterResponse struct { - // Base class for container with backup items. Containers with specific workloads are derived from this class. - ProtectionContainerResource -} - -// ProtectionContainersClientUnregisterResponse contains the response from method ProtectionContainersClient.Unregister. -type ProtectionContainersClientUnregisterResponse struct { - // placeholder for future response values -} - -// ProtectionIntentClientCreateOrUpdateResponse contains the response from method ProtectionIntentClient.CreateOrUpdate. -type ProtectionIntentClientCreateOrUpdateResponse struct { - // Base class for backup ProtectionIntent. - ProtectionIntentResource -} - -// ProtectionIntentClientDeleteResponse contains the response from method ProtectionIntentClient.Delete. -type ProtectionIntentClientDeleteResponse struct { - // placeholder for future response values -} - -// ProtectionIntentClientGetResponse contains the response from method ProtectionIntentClient.Get. -type ProtectionIntentClientGetResponse struct { - // Base class for backup ProtectionIntent. - ProtectionIntentResource -} - -// ProtectionIntentClientValidateResponse contains the response from method ProtectionIntentClient.Validate. -type ProtectionIntentClientValidateResponse struct { - // Response contract for enable backup validation request - PreValidateEnableBackupResponse -} - -// ProtectionPoliciesClientCreateOrUpdateResponse contains the response from method ProtectionPoliciesClient.CreateOrUpdate. -type ProtectionPoliciesClientCreateOrUpdateResponse struct { - // Base class for backup policy. Workload-specific backup policies are derived from this class. - ProtectionPolicyResource -} - -// ProtectionPoliciesClientDeleteResponse contains the response from method ProtectionPoliciesClient.BeginDelete. -type ProtectionPoliciesClientDeleteResponse struct { - // placeholder for future response values -} - -// ProtectionPoliciesClientGetResponse contains the response from method ProtectionPoliciesClient.Get. -type ProtectionPoliciesClientGetResponse struct { - // Base class for backup policy. Workload-specific backup policies are derived from this class. - ProtectionPolicyResource -} - -// ProtectionPolicyOperationResultsClientGetResponse contains the response from method ProtectionPolicyOperationResultsClient.Get. -type ProtectionPolicyOperationResultsClientGetResponse struct { - // Base class for backup policy. Workload-specific backup policies are derived from this class. - ProtectionPolicyResource -} - -// ProtectionPolicyOperationStatusesClientGetResponse contains the response from method ProtectionPolicyOperationStatusesClient.Get. -type ProtectionPolicyOperationStatusesClientGetResponse struct { - // Operation status. - OperationStatus -} - -// RecoveryPointsClientGetResponse contains the response from method RecoveryPointsClient.Get. -type RecoveryPointsClientGetResponse struct { +// RecoveryPointsCrrClientGetResponse contains the response from method RecoveryPointsCrrClient.Get. +type RecoveryPointsCrrClientGetResponse struct { // Base class for backup copies. Workload-specific backup copies are derived from this class. RecoveryPointResource } -// RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.NewListPager. -type RecoveryPointsClientListResponse struct { +// RecoveryPointsCrrClientListResponse contains the response from method RecoveryPointsCrrClient.NewListPager. +type RecoveryPointsCrrClientListResponse struct { // List of RecoveryPoint resources RecoveryPointResourceList } - -// RecoveryPointsRecommendedForMoveClientListResponse contains the response from method RecoveryPointsRecommendedForMoveClient.NewListPager. -type RecoveryPointsRecommendedForMoveClientListResponse struct { - // List of RecoveryPoint resources - RecoveryPointResourceList -} - -// ResourceGuardProxiesClientGetResponse contains the response from method ResourceGuardProxiesClient.NewGetPager. -type ResourceGuardProxiesClientGetResponse struct { - // List of ResourceGuardProxyBase resources - ResourceGuardProxyBaseResourceList -} - -// ResourceGuardProxyClientDeleteResponse contains the response from method ResourceGuardProxyClient.Delete. -type ResourceGuardProxyClientDeleteResponse struct { - // placeholder for future response values -} - -// ResourceGuardProxyClientGetResponse contains the response from method ResourceGuardProxyClient.Get. -type ResourceGuardProxyClientGetResponse struct { - ResourceGuardProxyBaseResource -} - -// ResourceGuardProxyClientPutResponse contains the response from method ResourceGuardProxyClient.Put. -type ResourceGuardProxyClientPutResponse struct { - ResourceGuardProxyBaseResource -} - -// ResourceGuardProxyClientUnlockDeleteResponse contains the response from method ResourceGuardProxyClient.UnlockDelete. -type ResourceGuardProxyClientUnlockDeleteResponse struct { - // Response of Unlock Delete API. - UnlockDeleteResponse -} - -// RestoresClientTriggerResponse contains the response from method RestoresClient.BeginTrigger. -type RestoresClientTriggerResponse struct { - // placeholder for future response values -} - -// SecurityPINsClientGetResponse contains the response from method SecurityPINsClient.Get. -type SecurityPINsClientGetResponse struct { - // The token information details. - TokenInformation -} - -// TieringCostOperationStatusClientGetResponse contains the response from method TieringCostOperationStatusClient.Get. -type TieringCostOperationStatusClientGetResponse struct { - // Operation status. - OperationStatus -} - -// ValidateOperationClientTriggerResponse contains the response from method ValidateOperationClient.BeginTrigger. -type ValidateOperationClientTriggerResponse struct { - // placeholder for future response values -} - -// ValidateOperationResultsClientGetResponse contains the response from method ValidateOperationResultsClient.Get. -type ValidateOperationResultsClientGetResponse struct { - ValidateOperationsResponse -} - -// ValidateOperationStatusesClientGetResponse contains the response from method ValidateOperationStatusesClient.Get. -type ValidateOperationStatusesClientGetResponse struct { - // Operation status. - OperationStatus -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/restores_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/restores_client.go deleted file mode 100644 index 19f2f58c644a..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/restores_client.go +++ /dev/null @@ -1,148 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// RestoresClient contains the methods for the Restores group. -// Don't use this type directly, use NewRestoresClient() instead. -type RestoresClient struct { - internal *arm.Client - subscriptionID string -} - -// NewRestoresClient creates a new instance of RestoresClient 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 NewRestoresClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RestoresClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RestoresClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginTrigger - Restores the specified backed up data. This is an asynchronous operation. To know the status of this API -// call, use GetProtectedItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - fabricName - Fabric name associated with the backed up items. -// - containerName - Container name associated with the backed up items. -// - protectedItemName - Backed up item to be restored. -// - recoveryPointID - Recovery point ID which represents the backed up data to be restored. -// - parameters - resource restore request -// - options - RestoresClientBeginTriggerOptions contains the optional parameters for the RestoresClient.BeginTrigger method. -func (client *RestoresClient) BeginTrigger(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters RestoreRequestResource, options *RestoresClientBeginTriggerOptions) (*runtime.Poller[RestoresClientTriggerResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.trigger(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RestoresClientTriggerResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RestoresClientTriggerResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Trigger - Restores the specified backed up data. This is an asynchronous operation. To know the status of this API call, -// use GetProtectedItemOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *RestoresClient) trigger(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters RestoreRequestResource, options *RestoresClientBeginTriggerOptions) (*http.Response, error) { - var err error - const operationName = "RestoresClient.BeginTrigger" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.triggerCreateRequest(ctx, vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// triggerCreateRequest creates the Trigger request. -func (client *RestoresClient) triggerCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters RestoreRequestResource, options *RestoresClientBeginTriggerOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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 fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if containerName == "" { - return nil, errors.New("parameter containerName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - if recoveryPointID == "" { - return nil, errors.New("parameter recoveryPointID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{recoveryPointId}", url.PathEscape(recoveryPointID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.XMSAuthorizationAuxiliary != nil { - req.Raw().Header["x-ms-authorization-auxiliary"] = []string{*options.XMSAuthorizationAuxiliary} - } - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/restores_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/restores_client_example_test.go deleted file mode 100644 index 5806020f31ca..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/restores_client_example_test.go +++ /dev/null @@ -1,271 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json -func ExampleRestoresClient_BeginTrigger_restoreDisksWithIaasVmRestoreRequest() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestoresClient().BeginTrigger(ctx, "testVault", "netsdktestrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", armrecoveryservicesbackup.RestoreRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMRestoreRequest{ - ObjectType: to.Ptr("IaasVMRestoreRequest"), - CreateNewCloudService: to.Ptr(true), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - IdentityInfo: &armrecoveryservicesbackup.IdentityInfo{ - IsSystemAssignedIdentity: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi"), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeRestoreDisks), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"), - TargetDiskNetworkAccessSettings: &armrecoveryservicesbackup.TargetDiskNetworkAccessSettings{ - TargetDiskAccessID: to.Ptr("/subscriptions/e7a191f5-713c-4bdb-b5e4-cf3dd90230ef/resourceGroups/arpja/providers/Microsoft.Compute/diskAccesses/arpja-diskaccess-ccy"), - TargetDiskNetworkAccessOption: to.Ptr(armrecoveryservicesbackup.TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks), - }, - }, - }, &armrecoveryservicesbackup.RestoresClientBeginTriggerOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json -func ExampleRestoresClient_BeginTrigger_restoreDisksWithIaasVmRestoreRequestWithIdentityBasedRestoreDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestoresClient().BeginTrigger(ctx, "testVault", "netsdktestrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", armrecoveryservicesbackup.RestoreRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMRestoreRequest{ - ObjectType: to.Ptr("IaasVMRestoreRequest"), - CreateNewCloudService: to.Ptr(true), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - IdentityBasedRestoreDetails: &armrecoveryservicesbackup.IdentityBasedRestoreDetails{ - TargetStorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"), - }, - IdentityInfo: &armrecoveryservicesbackup.IdentityInfo{ - IsSystemAssignedIdentity: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi"), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeRestoreDisks), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - }, - }, &armrecoveryservicesbackup.RestoresClientBeginTriggerOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json -func ExampleRestoresClient_BeginTrigger_restoreDisksWithIaasVmRestoreWithRehydrationRequest() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestoresClient().BeginTrigger(ctx, "testVault", "netsdktestrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", armrecoveryservicesbackup.RestoreRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMRestoreWithRehydrationRequest{ - ObjectType: to.Ptr("IaasVMRestoreWithRehydrationRequest"), - CreateNewCloudService: to.Ptr(true), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeRestoreDisks), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"), - RecoveryPointRehydrationInfo: &armrecoveryservicesbackup.RecoveryPointRehydrationInfo{ - RehydrationPriority: to.Ptr(armrecoveryservicesbackup.RehydrationPriorityStandard), - RehydrationRetentionDuration: to.Ptr("P7D"), - }, - }, - }, &armrecoveryservicesbackup.RestoresClientBeginTriggerOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json -func ExampleRestoresClient_BeginTrigger_restoreToNewAzureIaasVmWithIaasVmRestoreRequest() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestoresClient().BeginTrigger(ctx, "testVault", "netsdktestrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", armrecoveryservicesbackup.RestoreRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMRestoreRequest{ - ObjectType: to.Ptr("IaasVMRestoreRequest"), - CreateNewCloudService: to.Ptr(false), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - IdentityInfo: &armrecoveryservicesbackup.IdentityInfo{ - IsSystemAssignedIdentity: to.Ptr(true), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeAlternateLocation), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Storage/storageAccounts/testingAccount"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet/subnets/default"), - TargetResourceGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2"), - TargetVirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2/providers/Microsoft.Compute/virtualmachines/RSMDALRVM981435"), - VirtualNetworkID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet"), - }, - }, &armrecoveryservicesbackup.RestoresClientBeginTriggerOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json -func ExampleRestoresClient_BeginTrigger_restoreToNewAzureIaasVmWithIaasVmRestoreRequestWithIdentityBasedRestoreDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestoresClient().BeginTrigger(ctx, "testVault", "netsdktestrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", armrecoveryservicesbackup.RestoreRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMRestoreRequest{ - ObjectType: to.Ptr("IaasVMRestoreRequest"), - CreateNewCloudService: to.Ptr(false), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - IdentityBasedRestoreDetails: &armrecoveryservicesbackup.IdentityBasedRestoreDetails{ - TargetStorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Storage/storageAccounts/testingAccount"), - }, - IdentityInfo: &armrecoveryservicesbackup.IdentityInfo{ - IsSystemAssignedIdentity: to.Ptr(true), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeAlternateLocation), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet/subnets/default"), - TargetResourceGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2"), - TargetVirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2/providers/Microsoft.Compute/virtualmachines/RSMDALRVM981435"), - VirtualNetworkID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet"), - }, - }, &armrecoveryservicesbackup.RestoresClientBeginTriggerOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json -func ExampleRestoresClient_BeginTrigger_restoreToNewAzureIaasVmWithIaasVmRestoreWithRehydrationRequest() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestoresClient().BeginTrigger(ctx, "testVault", "netsdktestrg", "Azure", "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", armrecoveryservicesbackup.RestoreRequestResource{ - Properties: &armrecoveryservicesbackup.IaasVMRestoreWithRehydrationRequest{ - ObjectType: to.Ptr("IaasVMRestoreWithRehydrationRequest"), - CreateNewCloudService: to.Ptr(false), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeAlternateLocation), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Storage/storageAccounts/testingAccount"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet/subnets/default"), - TargetResourceGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2"), - TargetVirtualMachineID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2/providers/Microsoft.Compute/virtualmachines/RSMDALRVM981435"), - VirtualNetworkID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet"), - RecoveryPointRehydrationInfo: &armrecoveryservicesbackup.RecoveryPointRehydrationInfo{ - RehydrationPriority: to.Ptr(armrecoveryservicesbackup.RehydrationPriorityHigh), - RehydrationRetentionDuration: to.Ptr("P7D"), - }, - }, - }, &armrecoveryservicesbackup.RestoresClientBeginTriggerOptions{XMSAuthorizationAuxiliary: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/securitypins_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/securitypins_client.go deleted file mode 100644 index 4ff0d3b5b06e..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/securitypins_client.go +++ /dev/null @@ -1,117 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// SecurityPINsClient contains the methods for the SecurityPINs group. -// Don't use this type directly, use NewSecurityPINsClient() instead. -type SecurityPINsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSecurityPINsClient creates a new instance of SecurityPINsClient 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 NewSecurityPINsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityPINsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SecurityPINsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get the security PIN. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - options - SecurityPINsClientGetOptions contains the optional parameters for the SecurityPINsClient.Get method. -func (client *SecurityPINsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, options *SecurityPINsClientGetOptions) (SecurityPINsClientGetResponse, error) { - var err error - const operationName = "SecurityPINsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, options) - if err != nil { - return SecurityPINsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SecurityPINsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SecurityPINsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SecurityPINsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, options *SecurityPINsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.XMSAuthorizationAuxiliary != nil { - req.Raw().Header["x-ms-authorization-auxiliary"] = []string{*options.XMSAuthorizationAuxiliary} - } - if options != nil && options.Parameters != nil { - if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *SecurityPINsClient) getHandleResponse(resp *http.Response) (SecurityPINsClientGetResponse, error) { - result := SecurityPINsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TokenInformation); err != nil { - return SecurityPINsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/securitypins_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/securitypins_client_example_test.go deleted file mode 100644 index 53b96addf7ac..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/securitypins_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupSecurityPin_Get.json -func ExampleSecurityPINsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityPINsClient().Get(ctx, "SwaggerTest", "SwaggerTestRg", &armrecoveryservicesbackup.SecurityPINsClientGetOptions{XMSAuthorizationAuxiliary: nil, - Parameters: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TokenInformation = armrecoveryservicesbackup.TokenInformation{ - // ExpiryTimeInUTCTicks: to.Ptr[int64](636495150137443100), - // SecurityPIN: to.Ptr("200432"), - // Token: to.Ptr("200432"), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/tieringcostoperationstatus_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/tieringcostoperationstatus_client.go deleted file mode 100644 index de107e329293..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/tieringcostoperationstatus_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// TieringCostOperationStatusClient contains the methods for the TieringCostOperationStatus group. -// Don't use this type directly, use NewTieringCostOperationStatusClient() instead. -type TieringCostOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewTieringCostOperationStatusClient creates a new instance of TieringCostOperationStatusClient 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 NewTieringCostOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TieringCostOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TieringCostOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets the status of async operations of tiering cost -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - vaultName - The name of the recovery services vault. -// - options - TieringCostOperationStatusClientGetOptions contains the optional parameters for the TieringCostOperationStatusClient.Get -// method. -func (client *TieringCostOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *TieringCostOperationStatusClientGetOptions) (TieringCostOperationStatusClientGetResponse, error) { - var err error - const operationName = "TieringCostOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) - if err != nil { - return TieringCostOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TieringCostOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TieringCostOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *TieringCostOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *TieringCostOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTieringCost/default/operationsStatus/{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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *TieringCostOperationStatusClient) getHandleResponse(resp *http.Response) (TieringCostOperationStatusClientGetResponse, error) { - result := TieringCostOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return TieringCostOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/tieringcostoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/tieringcostoperationstatus_client_example_test.go deleted file mode 100644 index 078f1c1fa0f6..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/tieringcostoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/GetTieringCostOperationStatus.json -func ExampleTieringCostOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTieringCostOperationStatusClient().Get(ctx, "gaallaRG", "gaallavaultbvtd2msi", "0f48183b-0a44-4dca-aec1-bba5daab888a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armrecoveryservicesbackup.OperationStatus{ - // Name: to.Ptr("0f48183b-0a44-4dca-aec1-bba5daab888a"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T11:59:47.590Z"); return t}()), - // ID: to.Ptr("0f48183b-0a44-4dca-aec1-bba5daab888a"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T11:59:47.590Z"); return t}()), - // Status: to.Ptr(armrecoveryservicesbackup.OperationStatusValuesSucceeded), - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperation_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperation_client.go deleted file mode 100644 index 2fe0dc5ae8c8..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperation_client.go +++ /dev/null @@ -1,126 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ValidateOperationClient contains the methods for the ValidateOperation group. -// Don't use this type directly, use NewValidateOperationClient() instead. -type ValidateOperationClient struct { - internal *arm.Client - subscriptionID string -} - -// NewValidateOperationClient creates a new instance of ValidateOperationClient 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 NewValidateOperationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ValidateOperationClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ValidateOperationClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginTrigger - Validate operation for specified backed up item in the form of an asynchronous operation. Returns tracking -// headers which can be tracked using GetValidateOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - parameters - resource validate operation request -// - options - ValidateOperationClientBeginTriggerOptions contains the optional parameters for the ValidateOperationClient.BeginTrigger -// method. -func (client *ValidateOperationClient) BeginTrigger(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateOperationRequestResource, options *ValidateOperationClientBeginTriggerOptions) (*runtime.Poller[ValidateOperationClientTriggerResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.trigger(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ValidateOperationClientTriggerResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ValidateOperationClientTriggerResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Trigger - Validate operation for specified backed up item in the form of an asynchronous operation. Returns tracking headers -// which can be tracked using GetValidateOperationResult API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -func (client *ValidateOperationClient) trigger(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateOperationRequestResource, options *ValidateOperationClientBeginTriggerOptions) (*http.Response, error) { - var err error - const operationName = "ValidateOperationClient.BeginTrigger" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.triggerCreateRequest(ctx, vaultName, resourceGroupName, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// triggerCreateRequest creates the Trigger request. -func (client *ValidateOperationClient) triggerCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateOperationRequestResource, options *ValidateOperationClientBeginTriggerOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperation_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperation_client_example_test.go deleted file mode 100644 index ad991ed2f7ba..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperation_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerValidateOperation_RestoreDisk.json -func ExampleValidateOperationClient_BeginTrigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewValidateOperationClient().BeginTrigger(ctx, "testVault", "testRG", armrecoveryservicesbackup.ValidateOperationRequestResource{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVault/providers/Microsoft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;testRG;testvmName/protectedItems/VM;iaasvmcontainerv2;testRG;testvmName/recoveryPoints/348916168024334"), - Properties: &armrecoveryservicesbackup.ValidateIaasVMRestoreOperationRequest{ - ObjectType: to.Ptr("ValidateIaasVMRestoreOperationRequest"), - RestoreRequest: &armrecoveryservicesbackup.IaasVMRestoreRequest{ - ObjectType: to.Ptr("IaasVMRestoreRequest"), - CreateNewCloudService: to.Ptr(true), - EncryptionDetails: &armrecoveryservicesbackup.EncryptionDetails{ - EncryptionEnabled: to.Ptr(false), - }, - IdentityInfo: &armrecoveryservicesbackup.IdentityInfo{ - IsSystemAssignedIdentity: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi"), - }, - OriginalStorageAccountOption: to.Ptr(false), - RecoveryPointID: to.Ptr("348916168024334"), - RecoveryType: to.Ptr(armrecoveryservicesbackup.RecoveryTypeRestoreDisks), - Region: to.Ptr("southeastasia"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1"), - StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationresults_client.go deleted file mode 100644 index b17c59edecc8..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationresults_client.go +++ /dev/null @@ -1,114 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ValidateOperationResultsClient contains the methods for the ValidateOperationResults group. -// Don't use this type directly, use NewValidateOperationResultsClient() instead. -type ValidateOperationResultsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewValidateOperationResultsClient creates a new instance of ValidateOperationResultsClient 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 NewValidateOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ValidateOperationResultsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ValidateOperationResultsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches the result of a triggered validate operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - operationID - OperationID which represents the operation whose result needs to be fetched. -// - options - ValidateOperationResultsClientGetOptions contains the optional parameters for the ValidateOperationResultsClient.Get -// method. -func (client *ValidateOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ValidateOperationResultsClientGetOptions) (ValidateOperationResultsClientGetResponse, error) { - var err error - const operationName = "ValidateOperationResultsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) - if err != nil { - return ValidateOperationResultsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ValidateOperationResultsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return ValidateOperationResultsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ValidateOperationResultsClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ValidateOperationResultsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ValidateOperationResultsClient) getHandleResponse(resp *http.Response) (ValidateOperationResultsClientGetResponse, error) { - result := ValidateOperationResultsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ValidateOperationsResponse); err != nil { - return ValidateOperationResultsClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationresults_client_example_test.go deleted file mode 100644 index 285ca3fa9c47..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationresults_client_example_test.go +++ /dev/null @@ -1,49 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperationResults.json -func ExampleValidateOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewValidateOperationResultsClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ValidateOperationsResponse = armrecoveryservicesbackup.ValidateOperationsResponse{ - // ValidateOperationResponse: &armrecoveryservicesbackup.ValidateOperationResponse{ - // ValidationResults: []*armrecoveryservicesbackup.ErrorDetail{ - // { - // Code: to.Ptr("UserErrorCoreCountSubscriptionQuotaReached"), - // Message: to.Ptr("Core Count subscription quota has been reached."), - // Recommendations: []*string{ - // to.Ptr("Contact Azure support to increase the limits.")}, - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationstatuses_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationstatuses_client.go deleted file mode 100644 index 437acbcdca26..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationstatuses_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armrecoveryservicesbackup - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "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" -) - -// ValidateOperationStatusesClient contains the methods for the ValidateOperationStatuses group. -// Don't use this type directly, use NewValidateOperationStatusesClient() instead. -type ValidateOperationStatusesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewValidateOperationStatusesClient creates a new instance of ValidateOperationStatusesClient 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 NewValidateOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ValidateOperationStatusesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ValidateOperationStatusesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Fetches the status of a triggered validate operation. The status can be in progress, completed or failed. You can -// refer to the OperationStatus enum for all the possible states of the operation. If -// operation has completed, this method returns the list of errors obtained while validating the operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - vaultName - The name of the recovery services vault. -// - resourceGroupName - The name of the resource group where the recovery services vault is present. -// - operationID - OperationID represents the operation whose status needs to be fetched. -// - options - ValidateOperationStatusesClientGetOptions contains the optional parameters for the ValidateOperationStatusesClient.Get -// method. -func (client *ValidateOperationStatusesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ValidateOperationStatusesClientGetOptions) (ValidateOperationStatusesClientGetResponse, error) { - var err error - const operationName = "ValidateOperationStatusesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, vaultName, resourceGroupName, operationID, options) - if err != nil { - return ValidateOperationStatusesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ValidateOperationStatusesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ValidateOperationStatusesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ValidateOperationStatusesClient) getCreateRequest(ctx context.Context, vaultName string, resourceGroupName string, operationID string, options *ValidateOperationStatusesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}" - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ValidateOperationStatusesClient) getHandleResponse(resp *http.Response) (ValidateOperationStatusesClientGetResponse, error) { - result := ValidateOperationStatusesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ValidateOperationStatusesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationstatuses_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationstatuses_client_example_test.go deleted file mode 100644 index 4a63cb5fb546..000000000000 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/validateoperationstatuses_client_example_test.go +++ /dev/null @@ -1,57 +0,0 @@ -//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. -// DO NOT EDIT. - -package armrecoveryservicesbackup_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperationStatus.json -func ExampleValidateOperationStatusesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesbackup.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewValidateOperationStatusesClient().Get(ctx, "NetSDKTestRsVault", "SwaggerTestRg", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armrecoveryservicesbackup.OperationStatus{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-29T06:04:18.207Z"); return t}()), - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armrecoveryservicesbackup.OperationStatusValidateOperationExtendedInfo{ - // ObjectType: to.Ptr("OperationStatusValidateOperationExtendedInfo"), - // ValidateOperationResponse: &armrecoveryservicesbackup.ValidateOperationResponse{ - // ValidationResults: []*armrecoveryservicesbackup.ErrorDetail{ - // { - // Code: to.Ptr("UserErrorCoreCountSubscriptionQuotaReached"), - // Message: to.Ptr("Core Count subscription quota has been reached."), - // Recommendations: []*string{ - // to.Ptr("Contact Azure support to increase the limits.")}, - // }}, - // }, - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-29T06:04:18.207Z"); return t}()), - // Status: to.Ptr(armrecoveryservicesbackup.OperationStatusValuesSucceeded), - // } -}