diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md index 37c95b5fb9244..6debeb27c0532 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md @@ -1,14 +1,1509 @@ # Release History -## 1.5.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2024-11-12) -### Features Added +- Azure Resource Manager RecoveryServicesBackup client library for Java. This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-preview-2024-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.DataSourceType` was removed + +#### `models.BackupStatusRequest` was modified + +* `withResourceType(models.DataSourceType)` was removed +* `models.DataSourceType resourceType()` -> `models.DataSourceTypeAutoGenerated2 resourceType()` + +#### `models.ProtectedItem` was modified + +* `models.DataSourceType workloadType()` -> `models.DataSourceTypeAutoGenerated3 workloadType()` + +#### `models.PreValidateEnableBackupRequest` was modified + +* `models.DataSourceType resourceType()` -> `models.DataSourceTypeAutoGenerated resourceType()` +* `withResourceType(models.DataSourceType)` was removed + +### Features Added + +* `models.AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest` was added + +* `models.AzureWorkloadSapAsePointInTimeRestoreRequest` was added + +* `models.AzureWorkloadAnyDatabaseRecoveryPoint` was added + +* `models.AzureVmWorkloadOracleDatabaseProtectableItem` was added + +* `models.AzureVmWorkloadOracleDatabaseProtectedItem` was added + +* `models.AzureWorkloadAnyDatabaseRestoreRequest` was added + +* `models.AzureWorkloadAnyDatabasePointInTimeRestoreRequest` was added + +* `models.AzureVmWorkloadAnyDatabaseProtectedItem` was added + +* `models.AzureWorkloadOraclePointInTimeRestoreRequest` was added + +* `models.AzureWorkloadSapAseRestoreRequest` was added + +* `models.DataSourceTypeAutoGenerated2` was added + +* `models.DataSourceTypeAutoGenerated3` was added + +* `models.AzureWorkloadOracleRestoreWithRehydrateRequest` was added + +* `models.AzureWorkloadSapAsePointInTimeRecoveryPoint` was added + +* `models.DataSourceTypeAutoGenerated` was added + +* `models.AzureVmWorkloadOracleDatabaseWorkloadItem` was added + +* `models.AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest` was added + +* `models.AzureWorkloadOracleRecoveryPoint` was added + +* `models.AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest` was added + +* `models.AzureWorkloadOracleRestoreRequest` was added + +* `models.AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest` was added + +* `models.AzureWorkloadAnyDatabasePointInTimeRecoveryPoint` was added + +* `models.VMWorkloadPolicyType` was added + +* `models.AzureVmWorkloadAnyDatabaseWorkloadItem` was added + +* `models.AzureVmWorkloadSapHanaScaleoutProtectableItem` was added + +* `models.UpdateRecoveryPointRequest` was added + +* `models.PatchRecoveryPointPropertiesInput` was added + +* `models.AzureWorkloadOraclePointInTimeRecoveryPoint` was added + +* `models.AzureWorkloadSapAseRecoveryPoint` was added + +* `models.AzureVmWorkloadAnyDatabaseProtectableItem` was added + +* `models.AzureWorkloadSapAseRestoreWithRehydrateRequest` was added + +* `models.PatchRecoveryPointInput` was added + +#### `models.AzureWorkloadSqlPointInTimeRecoveryPoint` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MabJobTaskDetails` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSClassicComputeVMContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IaaSvmContainer` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.OperationStatusExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.TargetRestoreInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RestoreFileSpecs` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSComputeVMProtectedItem` was modified + +* `healthStatus()` was added +* `vaultId()` was added +* `backupManagementType()` was added +* `workloadType()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `friendlyName()` was added +* `lastBackupTime()` was added +* `protectedItemDataId()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `virtualMachineId()` was added + +#### `models.AzureWorkloadPointInTimeRecoveryPoint` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureFileShareProvisionIlrRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RetentionDuration` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSapHanaHsr` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadRecoveryPoint` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationStatusValidateOperationExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ProtectionIntentResourceList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVMAppContainerProtectableContainer` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadSapHanaSystemWorkloadItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IaasVMRestoreRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationStatusProvisionIlrExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadSapHanaDatabaseWorkloadItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MabFileFolderProtectedItem` was modified + +* `backupManagementType()` was added +* `workloadType()` was added +* `vaultId()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.GenericRecoveryPoint` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.IaasVMBackupRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ListRecoveryPointsRecommendedForMoveRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DpmBackupEngine` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MabContainerExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadSqlRecoveryPoint` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.RecoveryPoints` was modified + +* `updateWithResponse(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,models.UpdateRecoveryPointRequest,com.azure.core.util.Context)` was added +* `update(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,models.UpdateRecoveryPointRequest)` was added + +#### `models.GenericContainerExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureStorageProtectableContainer` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.NameInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MoveRPAcrossTiersRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSapHanaDBInstance` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.FetchTieringCostInfoForRehydrationRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.BackupEngineBase` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.OperationWorkerResponse` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.RestoreRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ProtectableContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.PrepareDataMoveRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureFileShareBackupRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.IdentityInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadSapHanaDatabaseProtectedItem` was modified + +* `vaultId()` was added +* `workloadType()` was added +* `protectionStatus()` was added +* `backupManagementType()` was added +* `friendlyName()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.LongTermSchedulePolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSqlInstanceProtectableItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSqlAvailabilityGroupProtectableItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.YearlyRetentionSchedule` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSapAseDatabaseProtectedItem` was modified + +* `backupManagementType()` was added +* `workloadType()` was added +* `protectionStatus()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `vaultId()` was added +* `friendlyName()` was added + +#### `models.AzureFileShareProtectableItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RecoveryPointMoveReadinessInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.PointInTimeRange` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadErrorInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadSqlRestoreWithRehydrateRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.MabContainer` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.UserAssignedIdentityProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureIaaSvmJobExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ResourceHealthDetails` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadJobTaskDetails` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSvmErrorInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BackupResourceVaultConfig` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.GenericProtectionPolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.SqlDataDirectory` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BackupResourceEncryptionConfig` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ClientDiscoveryForServiceSpecification` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IaasVMRestoreWithRehydrationRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ValidateOperationRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadSapHanaPointInTimeRestoreRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadSqlPointInTimeRestoreRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadSqlAutoProtectionIntent` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.BackupRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ResourceGuardOperationDetail` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SubProtectionPolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DpmContainerExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MabJob` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureStorageJobTaskDetails` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureFileShareRestoreRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.KeyAndSecretDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ErrorDetail` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ProtectionContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadContainerExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadSapHanaPointInTimeRecoveryPoint` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSComputeVMProtectableItem` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.MonthlyRetentionSchedule` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.RetentionPolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TargetDiskNetworkAccessSettings` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.PrivateEndpoint` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.JobResourceList` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadSapHanaRestoreWithRehydrateRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BackupResourceEncryptionConfigExtended` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MabErrorInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.RecoveryPointResourceList` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.Settings` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureIaaSvmProtectedItem` was modified + +* `backupManagementType()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `vaultId()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `workloadType()` was added + +#### `models.ContainerIdentityInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadContainerAutoProtectionIntent` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.InstantItemRecoveryTarget` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ProtectionPolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ValidateOperationResponse` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ProtectableContainerResourceList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DpmErrorInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.InstantRPAdditionalDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.WorkloadItem` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.HourlySchedule` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.VaultJobExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.RecoveryPointProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadJob` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.OperationResultInfoBase` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DpmProtectedItemExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSvmJob` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.FetchTieringCostSavingsInfoForVaultRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureStorageErrorInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ExtendedProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DailyRetentionFormat` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SimpleRetentionPolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.BackupStatusRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `withResourceType(models.DataSourceTypeAutoGenerated2)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.WorkloadInquiryDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DpmJobExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.WorkloadItemResourceList` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.EncryptionDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.PreBackupValidation` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.UserAssignedManagedIdentityDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureIaaSvmProtectionPolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.LongTermRetentionPolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadSapAseSystemWorkloadItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IaasVmilrRegistrationRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.InquiryValidation` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DpmJobTaskDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MabFileFolderProtectedItemExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureSqlProtectedItemExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DailyRetentionSchedule` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.RecoveryPointDiskConfiguration` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ResourceGuardProxyBaseResourceList` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RestoreRequestResource` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added +* `id()` was added +* `name()` was added + +#### `models.ProtectedItemResourceList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.UnlockDeleteRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureSqlProtectionPolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ProtectionContainerResourceList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ValidateIaasVMRestoreOperationRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureStorageJob` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.WeeklyRetentionSchedule` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.WeeklySchedule` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSqlDatabaseProtectedItem` was modified + +* `vaultId()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `workloadType()` was added +* `friendlyName()` was added +* `backupManagementType()` was added +* `protectionStatus()` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RecoveryPointRehydrationInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.WorkloadProtectableItem` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SimpleSchedulePolicyV2` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.VaultRetentionPolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadProtectedItem` was modified + +* `vaultId()` was added +* `backupManagementType()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `workloadType()` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSqlInstanceWorkloadItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IdentityBasedRestoreDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.BackupManagementUsageList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadProtectionPolicy` was modified + +* `withVmWorkloadPolicyType(models.VMWorkloadPolicyType)` was added +* `vmWorkloadPolicyType()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SchedulePolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ProtectionIntent` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ProtectionPolicyResourceList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureResourceProtectionIntent` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.SecurityPinBase` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BackupEngineBaseResourceList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ProtectedItem` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureSqlContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSapHanaSystemProtectableItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureSqlagWorkloadContainerProtectionContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RecoveryPointTierInformationV2` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BackupResourceEncryptionConfigResource` was modified + +* `type()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `id()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `name()` was added + +#### `models.AzureWorkloadSqlRecoveryPointExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureIaaSvmJobTaskDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.InquiryInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadSapAseDatabaseWorkloadItem` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.KekDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.MabJobExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TriggerDataMoveRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadRestoreRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.VaultJob` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IlrRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSqlDatabaseWorkloadItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadProtectableItem` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SecuredVMDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.GenericContainer` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVMAppContainerProtectionContainer` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ClientDiscoveryDisplay` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.TieringCostRehydrationInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.IaasVMRecoveryPoint` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ClientDiscoveryForProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IlrRequestResource` was modified + +* `type()` was added +* `id()` was added +* `name()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureVmWorkloadSapHanaDBInstanceProtectedItem` was modified + +* `workloadType()` was added +* `friendlyName()` was added +* `vaultId()` was added +* `backupManagementType()` was added +* `protectionStatus()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.IaaSvmProtectableItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureBackupServerContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureBackupServerEngine` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DailySchedule` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSClassicComputeVMProtectableItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExportJobsOperationResultInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TieringPolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ValidateOperationRequestResource` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureFileShareRecoveryPoint` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationStatusJobExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ResourceList` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadBackupRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ResourceGuardProxyBase` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.FeatureSupportRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ValidateRestoreOperationRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.RecoveryPointTierInformation` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadAutoProtectionIntent` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.WorkloadProtectableItemResourceList` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.FetchTieringCostInfoRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.Day` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DpmJob` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVMResourceFeatureSupportRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BackupEngineExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSvmHealthDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `code()` was added +* `title()` was added +* `recommendations()` was added +* `message()` was added + +#### `models.PrivateLinkServiceConnectionState` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SnapshotRestoreParameters` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureIaaSClassicComputeVMProtectedItem` was modified + +* `vaultId()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `healthStatus()` was added +* `protectedItemDataId()` was added +* `virtualMachineId()` was added +* `workloadType()` was added +* `lastBackupTime()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `backupManagementType()` was added +* `friendlyName()` was added + +#### `models.GenericProtectedItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `backupManagementType()` was added +* `vaultId()` was added +* `workloadType()` was added + +#### `models.VaultJobErrorInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadProtectedItemExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadSapHanaRecoveryPoint` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.OperationStatusJobsExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RecoveryPoint` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationStatusError` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.PrivateEndpointConnection` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureBackupGoalFeatureSupportRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSqlDatabaseProtectableItem` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SimpleSchedulePolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SqlDataDirectoryMapping` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSapAseSystemProtectableItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ClientScriptForConnect` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.MabProtectionPolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.SnapshotBackupAdditionalDetails` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureFileshareProtectedItem` was modified + +* `workloadType()` was added +* `vaultId()` was added +* `backupManagementType()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureStorageJobExtendedInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.Job` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.PreValidateEnableBackupRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `withResourceType(models.DataSourceTypeAutoGenerated)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.KpiResourceHealthDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.WeeklyRetentionFormat` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DistributedNodesInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadJobExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureRecoveryServiceVaultProtectionIntent` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureFileshareProtectedItemExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureFileShareProtectionPolicy` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DiskExclusionProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.FetchTieringCostSavingsInfoForProtectedItemRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureSqlProtectedItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `backupManagementType()` was added +* `workloadType()` was added +* `vaultId()` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.BackupRequestResource` was modified + +* `type()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `name()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `id()` was added + +#### `models.AzureIaaSvmProtectedItemExtendedInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationResultInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ClientDiscoveryForLogSpecification` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadSapHanaRestoreRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.LogSchedulePolicy` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExtendedLocation` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DiskInformation` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadPointInTimeRestoreRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureWorkloadSqlRestoreRequest` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.BekDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureIaaSvmJobV2` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.PrepareDataMoveResponse` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureStorageContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TieringCostSavingInfo` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.FetchTieringCostSavingsInfoForPolicyRequest` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.MabContainerHealthDetails` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TargetAfsRestoreInfo` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureIaaSComputeVMContainer` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ClientDiscoveryResponse` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DpmContainer` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.BackupResourceConfig` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DpmProtectedItem` was modified + +* `vaultId()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `backupManagementType()` was added +* `workloadType()` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AzureVmWorkloadSapHanaDatabaseProtectableItem` was modified -### Other Changes +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added ## 1.4.0 (2024-05-23) diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/README.md b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/README.md index 7509e47d5f71f..6ce21751a0f6f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/README.md +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/README.md @@ -2,7 +2,7 @@ Azure Resource Manager RecoveryServicesBackup client library for Java. -This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-2024-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-preview-2024-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-recoveryservicesbackup - 1.4.0 + 1.5.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `AZURE_CLIENT_ID` for Azure client ID. -- `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. - -With above configuration, `azure` client can be authenticated using the following code: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -75,100 +71,77 @@ See [API design][design] for general introduction on design and key concepts on ## Examples ```java -OffsetDateTime scheduleDateTime = OffsetDateTime.parse( - OffsetDateTime.now(Clock.systemUTC()) - .withNano(0).withMinute(0).withSecond(0) - .plusDays(1).format(DateTimeFormatter.ISO_INSTANT)); - -List lstSubProtectionPolicy = Arrays.asList( - new SubProtectionPolicy() - .withPolicyType(PolicyType.FULL) - .withSchedulePolicy( - new SimpleSchedulePolicy() - .withScheduleRunFrequency(ScheduleRunType.WEEKLY) - .withScheduleRunDays(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY)) - .withScheduleRunTimes(Arrays.asList(scheduleDateTime))) - .withRetentionPolicy( - new LongTermRetentionPolicy() - .withWeeklySchedule( - new WeeklyRetentionSchedule() - .withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY)) - .withRetentionTimes(Arrays.asList(scheduleDateTime)) - .withRetentionDuration( - new RetentionDuration() - .withCount(2) +OffsetDateTime scheduleDateTime = OffsetDateTime.parse(OffsetDateTime.now(Clock.systemUTC()) + .withNano(0) + .withMinute(0) + .withSecond(0) + .plusDays(1) + .format(DateTimeFormatter.ISO_INSTANT)); + +List lstSubProtectionPolicy + = Arrays + .asList( + new SubProtectionPolicy().withPolicyType(PolicyType.FULL) + .withSchedulePolicy( + new SimpleSchedulePolicy().withScheduleRunFrequency(ScheduleRunType.WEEKLY) + .withScheduleRunDays(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY)) + .withScheduleRunTimes(Arrays.asList(scheduleDateTime))) + .withRetentionPolicy( + new LongTermRetentionPolicy() + .withWeeklySchedule(new WeeklyRetentionSchedule() + .withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.TUESDAY)) + .withRetentionTimes(Arrays.asList(scheduleDateTime)) + .withRetentionDuration(new RetentionDuration().withCount(2) .withDurationType(RetentionDurationType.WEEKS))) - .withMonthlySchedule( - new MonthlyRetentionSchedule() - .withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY) - .withRetentionScheduleWeekly( - new WeeklyRetentionFormat() + .withMonthlySchedule(new MonthlyRetentionSchedule() + .withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY) + .withRetentionScheduleWeekly(new WeeklyRetentionFormat() .withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY)) .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.SECOND))) - .withRetentionTimes(Arrays.asList(scheduleDateTime)) - .withRetentionDuration( - new RetentionDuration() + .withRetentionTimes(Arrays.asList(scheduleDateTime)) + .withRetentionDuration(new RetentionDuration() .withCount(1) .withDurationType(RetentionDurationType.MONTHS))) - .withYearlySchedule( - new YearlyRetentionSchedule() - .withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY) - .withMonthsOfYear(Arrays.asList(MonthOfYear.JANUARY, MonthOfYear.JUNE, MonthOfYear.DECEMBER)) - .withRetentionScheduleWeekly( - new WeeklyRetentionFormat() + .withYearlySchedule(new YearlyRetentionSchedule() + .withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY) + .withMonthsOfYear( + Arrays.asList(MonthOfYear.JANUARY, MonthOfYear.JUNE, MonthOfYear.DECEMBER)) + .withRetentionScheduleWeekly(new WeeklyRetentionFormat() .withDaysOfTheWeek(Arrays.asList(DayOfWeek.SUNDAY)) .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.LAST))) - .withRetentionTimes(Arrays.asList(scheduleDateTime)) - .withRetentionDuration( - new RetentionDuration() - .withCount(1) + .withRetentionTimes(Arrays.asList(scheduleDateTime)) + .withRetentionDuration(new RetentionDuration().withCount(1) .withDurationType(RetentionDurationType.YEARS)))), - new SubProtectionPolicy() - .withPolicyType(PolicyType.DIFFERENTIAL) - .withSchedulePolicy( - new SimpleSchedulePolicy() - .withScheduleRunFrequency(ScheduleRunType.WEEKLY) - .withScheduleRunDays(Arrays.asList(DayOfWeek.FRIDAY)) - .withScheduleRunTimes(Arrays.asList(scheduleDateTime))) - .withRetentionPolicy( - new SimpleRetentionPolicy() - .withRetentionDuration( - new RetentionDuration() - .withCount(8) - .withDurationType(RetentionDurationType.DAYS))), - new SubProtectionPolicy() - .withPolicyType(PolicyType.LOG) - .withSchedulePolicy(new LogSchedulePolicy().withScheduleFrequencyInMins(60)) - .withRetentionPolicy( - new SimpleRetentionPolicy() - .withRetentionDuration( - new RetentionDuration() - .withCount(7) - .withDurationType(RetentionDurationType.DAYS)))); + new SubProtectionPolicy().withPolicyType(PolicyType.DIFFERENTIAL) + .withSchedulePolicy( + new SimpleSchedulePolicy().withScheduleRunFrequency(ScheduleRunType.WEEKLY) + .withScheduleRunDays(Arrays.asList(DayOfWeek.FRIDAY)) + .withScheduleRunTimes(Arrays.asList(scheduleDateTime))) + .withRetentionPolicy(new SimpleRetentionPolicy().withRetentionDuration( + new RetentionDuration().withCount(8).withDurationType(RetentionDurationType.DAYS))), + new SubProtectionPolicy().withPolicyType(PolicyType.LOG) + .withSchedulePolicy(new LogSchedulePolicy().withScheduleFrequencyInMins(60)) + .withRetentionPolicy(new SimpleRetentionPolicy().withRetentionDuration( + new RetentionDuration().withCount(7).withDurationType(RetentionDurationType.DAYS)))); vault = recoveryServicesManager.vaults() .define(vaultName) .withRegion(REGION) .withExistingResourceGroup(resourceGroupName) .withSku(new Sku().withName(SkuName.RS0).withTier("Standard")) - .withProperties(new VaultProperties() - .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withProperties(new VaultProperties().withPublicNetworkAccess(PublicNetworkAccess.ENABLED) .withRestoreSettings(new RestoreSettings() - .withCrossSubscriptionRestoreSettings( - new CrossSubscriptionRestoreSettings() - .withCrossSubscriptionRestoreState(CrossSubscriptionRestoreState.ENABLED)))) + .withCrossSubscriptionRestoreSettings(new CrossSubscriptionRestoreSettings() + .withCrossSubscriptionRestoreState(CrossSubscriptionRestoreState.ENABLED)))) .create(); protectionPolicyResource = recoveryServicesBackupManager.protectionPolicies() .define(policyName) .withRegion(REGION) .withExistingVault(vaultName, resourceGroupName) - .withProperties( - new AzureVmWorkloadProtectionPolicy() - .withWorkLoadType(WorkloadType.SQLDATA_BASE) - .withSettings(new Settings().withTimeZone("Pacific Standard Time").withIssqlcompression(false)) - .withSubProtectionPolicy(lstSubProtectionPolicy) - ) + .withProperties(new AzureVmWorkloadProtectionPolicy().withWorkLoadType(WorkloadType.SQLDATA_BASE) + .withSettings(new Settings().withTimeZone("Pacific Standard Time").withIssqlcompression(false)) + .withSubProtectionPolicy(lstSubProtectionPolicy)) .create(); ``` [Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md) @@ -194,6 +167,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md index 35020655e9fb5..4dbf2ceb9a914 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md @@ -193,6 +193,7 @@ - [Get](#recoverypoints_get) - [List](#recoverypoints_list) +- [Update](#recoverypoints_update) ## RecoveryPointsRecommendedForMove @@ -247,7 +248,9 @@ */ public final class BackupEnginesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Dpm/BackupEngines_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Dpm/BackupEngines_Get.json */ /** * Sample code: Get Dpm/AzureBackupServer/Lajolla Backup Engine Details. @@ -270,7 +273,9 @@ public final class BackupEnginesGetSamples { */ public final class BackupEnginesListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Dpm/BackupEngines_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Dpm/BackupEngines_List.json */ /** * Sample code: List Dpm/AzureBackupServer/Lajolla Backup Engines. @@ -292,7 +297,9 @@ public final class BackupEnginesListSamples { */ public final class BackupJobsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobs.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ListJobs.json */ /** * Sample code: List All Jobs. @@ -305,7 +312,9 @@ public final class BackupJobsListSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobsWithAllSupportedFilters.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ListJobsWithAllSupportedFilters.json */ /** * Sample code: List Jobs With Filters. @@ -321,7 +330,9 @@ public final class BackupJobsListSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobsWithStartTimeAndEndTimeFilters.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ListJobsWithStartTimeAndEndTimeFilters.json */ /** * Sample code: List Jobs With Time Filter. @@ -346,7 +357,9 @@ public final class BackupJobsListSamples { */ public final class BackupOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete_OperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ProtectedItem_Delete_OperationResult.json */ /** * Sample code: Get Result for Protected Item Delete Operation. @@ -370,7 +383,9 @@ public final class BackupOperationResultsGetSamples { */ public final class BackupOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete_OperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ProtectedItem_Delete_OperationStatus.json */ /** * Sample code: Get Protected Item Delete Operation Status. @@ -394,7 +409,9 @@ public final class BackupOperationStatusesGetSamples { */ public final class BackupPoliciesListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupPolicies_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupPolicies_List.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureWorkload. @@ -409,7 +426,9 @@ public final class BackupPoliciesListSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/v2-List-Policies.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/v2-List-Policies.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureIaasVm with both V1 and V2 @@ -425,7 +444,9 @@ public final class BackupPoliciesListSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupPolicies_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupPolicies_List.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureIaasVm. @@ -449,7 +470,9 @@ public final class BackupPoliciesListSamples { */ public final class BackupProtectableItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupProtectableItems_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupProtectableItems_List.json */ /** * Sample code: List protectable items with backupManagementType filter as AzureIaasVm. @@ -473,7 +496,9 @@ public final class BackupProtectableItemsListSamples { */ public final class BackupProtectedItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupProtectedItems_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupProtectedItems_List.json */ /** * Sample code: List protected items with backupManagementType filter as AzureIaasVm. @@ -497,7 +522,9 @@ public final class BackupProtectedItemsListSamples { */ public final class BackupProtectionContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_List.json */ /** * Sample code: List Backup Protection Containers. @@ -520,7 +547,9 @@ public final class BackupProtectionContainersListSamples { */ public final class BackupProtectionIntentListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupProtectionIntent_List.json */ /** * Sample code: List protection intent with backupManagementType filter. @@ -542,7 +571,9 @@ public final class BackupProtectionIntentListSamples { */ public final class BackupResourceEncryptionConfigsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupResourceEncryptionConfig_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupResourceEncryptionConfig_Get.json */ /** * Sample code: Get Vault Encryption Configuration. @@ -570,7 +601,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.InfrastructureEnc */ public final class BackupResourceEncryptionConfigsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupResourceEncryptionConfig_Put.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupResourceEncryptionConfig_Put.json */ /** * Sample code: Update Vault Encryption Configuration. @@ -599,7 +632,9 @@ public final class BackupResourceEncryptionConfigsUpdateSamples { */ public final class BackupResourceStorageConfigsNonCrrGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupStorageConfig_Get.json */ /** * Sample code: Get Vault Storage Configuration. @@ -627,7 +662,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; */ public final class BackupResourceStorageConfigsNonCrrPatchSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Patch.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupStorageConfig_Patch.json */ /** * Sample code: Update Vault Storage Configuration. @@ -659,7 +696,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; */ public final class BackupResourceStorageConfigsNonCrrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Put.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupStorageConfig_Put.json */ /** * Sample code: Update Vault Storage Configuration. @@ -686,7 +725,9 @@ public final class BackupResourceStorageConfigsNonCrrUpdateSamples { */ public final class BackupResourceVaultConfigsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupResourceVaultConfigs_Get.json */ /** * Sample code: Get Vault Security Config. @@ -714,7 +755,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.SoftDeleteFeature */ public final class BackupResourceVaultConfigsPutSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Put.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupResourceVaultConfigs_Put.json */ /** * Sample code: Update Vault Security Config. @@ -745,7 +788,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.EnhancedSecurityS */ public final class BackupResourceVaultConfigsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Patch.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupResourceVaultConfigs_Patch.json */ /** * Sample code: Update Vault Security Config. @@ -767,14 +812,16 @@ public final class BackupResourceVaultConfigsUpdateSamples { ```java import com.azure.resourcemanager.recoveryservicesbackup.models.BackupStatusRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType; +import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceTypeAutoGenerated2; /** * Samples for BackupStatus Get. */ public final class BackupStatusGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/GetBackupStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/GetBackupStatus.json */ /** * Sample code: Get Azure Virtual Machine Backup Status. @@ -784,7 +831,8 @@ public final class BackupStatusGetSamples { public static void getAzureVirtualMachineBackupStatus( com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { manager.backupStatus() - .getWithResponse("southeastasia", new BackupStatusRequest().withResourceType(DataSourceType.VM) + .getWithResponse("southeastasia", new BackupStatusRequest() + .withResourceType(DataSourceTypeAutoGenerated2.VM) .withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Compute/VirtualMachines/testVm"), com.azure.core.util.Context.NONE); @@ -800,7 +848,9 @@ public final class BackupStatusGetSamples { */ public final class BackupUsageSummariesListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupProtectedItem_UsageSummary_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupProtectedItem_UsageSummary_Get.json */ /** * Sample code: Get Protected Items Usages Summary. @@ -815,7 +865,9 @@ public final class BackupUsageSummariesListSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupProtectionContainers_UsageSummary_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupProtectionContainers_UsageSummary_Get.json */ /** * Sample code: Get Protected Containers Usages Summary. @@ -839,7 +891,9 @@ public final class BackupUsageSummariesListSamples { */ public final class BackupWorkloadItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupWorkloadItems_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupWorkloadItems_List.json */ /** * Sample code: List Workload Items in Container. @@ -866,7 +920,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMBackupReque */ public final class BackupsTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerBackup_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/TriggerBackup_Post.json */ /** * Sample code: Trigger Backup. @@ -892,7 +948,9 @@ public final class BackupsTriggerSamples { */ public final class BmsPrepareDataMoveOperationResultGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/PrepareDataMoveOperationResult_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/PrepareDataMoveOperationResult_Get.json */ /** * Sample code: Get operation result for PrepareDataMove. @@ -916,7 +974,9 @@ public final class BmsPrepareDataMoveOperationResultGetSamples { */ public final class DeletedProtectionContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/SoftDeletedContainers_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/SoftDeletedContainers_List.json */ /** * Sample code: List Backup Protection Containers. @@ -939,7 +999,9 @@ public final class DeletedProtectionContainersListSamples { */ public final class ExportJobsOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ExportJobsOperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ExportJobsOperationResult.json */ /** * Sample code: Export Jobs Operation Results. @@ -965,7 +1027,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVMResourceFe */ public final class FeatureSupportValidateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupFeature_Validate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupFeature_Validate.json */ /** * Sample code: Check Azure Vm Backup Feature Support. @@ -997,7 +1061,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriori */ public final class FetchTieringCostPostSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForRehydrate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForRehydrate.json */ /** * Sample code: Get the rehydration cost for recovery point. @@ -1018,7 +1084,9 @@ public final class FetchTieringCostPostSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForProtectedItem.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForProtectedItem.json */ /** * Sample code: Get the tiering savings cost info for protected item. @@ -1038,7 +1106,9 @@ public final class FetchTieringCostPostSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForPolicy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForPolicy.json */ /** * Sample code: Get the tiering savings cost info for policy. @@ -1056,7 +1126,9 @@ public final class FetchTieringCostPostSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForVault.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForVault.json */ /** * Sample code: Get the tiering savings cost info for vault. @@ -1082,7 +1154,9 @@ public final class FetchTieringCostPostSamples { */ public final class GetTieringCostOperationResultGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/GetTieringCostOperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/GetTieringCostOperationResult.json */ /** * Sample code: Fetch Tiering Cost Operation Result. @@ -1109,7 +1183,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequestResourc */ public final class ItemLevelRecoveryConnectionsProvisionSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Provision_Ilr.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/Provision_Ilr.json */ /** * Sample code: Provision Instant Item Level Recovery for Azure Vm. @@ -1141,7 +1217,9 @@ public final class ItemLevelRecoveryConnectionsProvisionSamples { */ public final class ItemLevelRecoveryConnectionsRevokeSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Revoke_Ilr.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/Revoke_Ilr.json */ /** * Sample code: Revoke Instant Item Level Recovery for Azure Vm. @@ -1166,7 +1244,9 @@ public final class ItemLevelRecoveryConnectionsRevokeSamples { */ public final class JobCancellationsTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerCancelJob.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/TriggerCancelJob.json */ /** * Sample code: Cancel Job. @@ -1190,7 +1270,9 @@ public final class JobCancellationsTriggerSamples { */ public final class JobDetailsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/GetJobDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/GetJobDetails.json */ /** * Sample code: Get Job Details. @@ -1214,7 +1296,9 @@ public final class JobDetailsGetSamples { */ public final class JobOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/CancelJobOperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/CancelJobOperationResult.json */ /** * Sample code: Cancel Job Operation Result. @@ -1238,7 +1322,9 @@ public final class JobOperationResultsGetSamples { */ public final class JobsExportSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerExportJobs.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/TriggerExportJobs.json */ /** * Sample code: Export Jobs. @@ -1268,7 +1354,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperation */ public final class OperationOperationValidateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperation_RestoreDisk.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperation_RestoreDisk.json */ /** * Sample code: Validate Operation. @@ -1298,7 +1386,9 @@ public final class OperationOperationValidateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperation_RestoreDisk_IdentityBasedRestoreDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperation_RestoreDisk_IdentityBasedRestoreDetails.json */ /** * Sample code: Validate Operation with identityBasedRestoreDetails. @@ -1337,7 +1427,9 @@ public final class OperationOperationValidateSamples { */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ListOperations.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ListOperations.json */ /** * Sample code: ListOperations. @@ -1359,7 +1451,9 @@ public final class OperationsListSamples { */ public final class PrivateEndpointGetOperationStatusSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/GetPrivateEndpointConnectionOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/GetPrivateEndpointConnectionOperationStatus.json */ /** * Sample code: Get OperationStatus. @@ -1384,7 +1478,9 @@ public final class PrivateEndpointGetOperationStatusSamples { */ public final class PrivateEndpointConnectionDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/DeletePrivateEndpointConnection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/DeletePrivateEndpointConnection.json */ /** * Sample code: Delete PrivateEndpointConnection. @@ -1408,7 +1504,9 @@ public final class PrivateEndpointConnectionDeleteSamples { */ public final class PrivateEndpointConnectionGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/GetPrivateEndpointConnection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/GetPrivateEndpointConnection.json */ /** * Sample code: Get PrivateEndpointConnection. @@ -1441,7 +1539,9 @@ import java.util.Arrays; */ public final class PrivateEndpointConnectionPutSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/PutPrivateEndpointConnection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/PutPrivateEndpointConnection.json */ /** * Sample code: Update PrivateEndpointConnection. @@ -1475,7 +1575,9 @@ public final class PrivateEndpointConnectionPutSamples { */ public final class ProtectableContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectableContainers_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectableContainers_List.json */ /** * Sample code: List protectable items with backupManagementType filter as AzureStorage. @@ -1500,7 +1602,9 @@ public final class ProtectableContainersListSamples { */ public final class ProtectedItemOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectedItemOperationResults.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectedItemOperationResults.json */ /** * Sample code: Get Operation Results of Protected Vm. @@ -1526,7 +1630,9 @@ public final class ProtectedItemOperationResultsGetSamples { */ public final class ProtectedItemOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectedItemOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectedItemOperationStatus.json */ /** * Sample code: Get Operation Status of Protected Vm. @@ -1555,7 +1661,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionState; */ public final class ProtectedItemsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/StopProtection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/StopProtection.json */ /** * Sample code: Stop Protection with retain data on Azure IaasVm. @@ -1576,7 +1684,9 @@ public final class ProtectedItemsCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ConfigureProtection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ConfigureProtection.json */ /** * Sample code: Enable Protection on Azure IaasVm. @@ -1607,7 +1717,9 @@ public final class ProtectedItemsCreateOrUpdateSamples { */ public final class ProtectedItemsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ProtectedItem_Delete.json */ /** * Sample code: Delete Protection from Azure Virtual Machine. @@ -1632,7 +1744,9 @@ public final class ProtectedItemsDeleteSamples { */ public final class ProtectedItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ClassicCompute_ProtectedItem_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ClassicCompute_ProtectedItem_Get.json */ /** * Sample code: Get Protected Classic Virtual Machine Details. @@ -1648,7 +1762,9 @@ public final class ProtectedItemsGetSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Compute_ProtectedItem_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/Compute_ProtectedItem_Get.json */ /** * Sample code: Get Protected Virtual Machine Details. @@ -1673,7 +1789,9 @@ public final class ProtectedItemsGetSamples { */ public final class ProtectionContainerOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Inquire_Result.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_Inquire_Result.json */ /** * Sample code: Get Azure Storage Protection Container Operation Result. @@ -1697,7 +1815,9 @@ public final class ProtectionContainerOperationResultsGetSamples { */ public final class ProtectionContainerRefreshOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/RefreshContainers_OperationResults.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/RefreshContainers_OperationResults.json */ /** * Sample code: Azure Vm Discovery Operation Result. @@ -1721,7 +1841,9 @@ public final class ProtectionContainerRefreshOperationResultsGetSamples { */ public final class ProtectionContainersGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionContainers_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/ProtectionContainers_Get.json */ /** * Sample code: Get Protection Container Details. @@ -1745,7 +1867,9 @@ public final class ProtectionContainersGetSamples { */ public final class ProtectionContainersInquireSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Inquire.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_Inquire.json */ /** * Sample code: Inquire Azure Storage Protection Containers. @@ -1769,7 +1893,9 @@ public final class ProtectionContainersInquireSamples { */ public final class ProtectionContainersRefreshSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/RefreshContainers.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/RefreshContainers.json */ /** * Sample code: Trigger Azure Vm Discovery. @@ -1796,7 +1922,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementT */ public final class ProtectionContainersRegisterSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Register.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_Register.json */ /** * Sample code: RegisterAzure Storage ProtectionContainers. @@ -1827,7 +1955,9 @@ public final class ProtectionContainersRegisterSamples { */ public final class ProtectionContainersUnregisterSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionContainers_Unregister.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/ProtectionContainers_Unregister.json */ /** * Sample code: Unregister Protection Container. @@ -1853,7 +1983,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.AzureResourceProt */ public final class ProtectionIntentCreateOrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionIntent_CreateOrUpdate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionIntent_CreateOrUpdate.json */ /** * Sample code: Create or Update Azure Vm Protection Intent. @@ -1883,7 +2015,9 @@ public final class ProtectionIntentCreateOrUpdateSamples { */ public final class ProtectionIntentDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_Delete.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupProtectionIntent_Delete.json */ /** * Sample code: Delete Protection intent from item. @@ -1907,7 +2041,9 @@ public final class ProtectionIntentDeleteSamples { */ public final class ProtectionIntentGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupProtectionIntent_Get.json */ /** * Sample code: Get ProtectionIntent for an item. @@ -1926,7 +2062,7 @@ public final class ProtectionIntentGetSamples { ### ProtectionIntent_Validate ```java -import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType; +import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceTypeAutoGenerated; import com.azure.resourcemanager.recoveryservicesbackup.models.PreValidateEnableBackupRequest; /** @@ -1934,7 +2070,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.PreValidateEnable */ public final class ProtectionIntentValidateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionIntent_Validate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionIntent_Validate.json */ /** * Sample code: Validate Enable Protection on Azure Vm. @@ -1945,7 +2083,7 @@ public final class ProtectionIntentValidateSamples { com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { manager.protectionIntents() .validateWithResponse("southeastasia", new PreValidateEnableBackupRequest() - .withResourceType(DataSourceType.VM) + .withResourceType(DataSourceTypeAutoGenerated.VM) .withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/arunaupgrade/providers/Microsoft.Compute/VirtualMachines/upgrade1") .withVaultId( @@ -1965,12 +2103,12 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionSch import com.azure.resourcemanager.recoveryservicesbackup.models.DailySchedule; import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; import com.azure.resourcemanager.recoveryservicesbackup.models.HourlySchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaasvmPolicyType; import com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMSnapshotConsistencyType; +import com.azure.resourcemanager.recoveryservicesbackup.models.IaasvmPolicyType; import com.azure.resourcemanager.recoveryservicesbackup.models.LogSchedulePolicy; import com.azure.resourcemanager.recoveryservicesbackup.models.LongTermRetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.MonthlyRetentionSchedule; import com.azure.resourcemanager.recoveryservicesbackup.models.MonthOfYear; +import com.azure.resourcemanager.recoveryservicesbackup.models.MonthlyRetentionSchedule; import com.azure.resourcemanager.recoveryservicesbackup.models.PolicyType; import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; @@ -1982,9 +2120,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.SimpleSchedulePol import com.azure.resourcemanager.recoveryservicesbackup.models.SimpleSchedulePolicyV2; import com.azure.resourcemanager.recoveryservicesbackup.models.SubProtectionPolicy; import com.azure.resourcemanager.recoveryservicesbackup.models.VaultRetentionPolicy; +import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat; import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionSchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType; import com.azure.resourcemanager.recoveryservicesbackup.models.YearlyRetentionSchedule; import java.time.OffsetDateTime; @@ -1995,7 +2133,9 @@ import java.util.Arrays; */ public final class ProtectionPoliciesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionPolicies_CreateOrUpdate_Complex.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/ProtectionPolicies_CreateOrUpdate_Complex.json */ /** * Sample code: Create or Update Full Azure Workload Protection Policy. @@ -2059,7 +2199,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Simple.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Simple.json */ /** * Sample code: Create or Update Simple Azure Vm Protection Policy. @@ -2084,7 +2226,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Daily.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Daily.json */ /** * Sample code: Create or Update Daily Azure Storage Protection Policy. @@ -2135,7 +2279,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hardened.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hardened.json */ /** * Sample code: Create or Update Azure Storage Vault Standard Protection Policy. @@ -2191,7 +2337,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hourly.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hourly.json */ /** * Sample code: Create or Update Hourly Azure Storage Protection Policy. @@ -2237,7 +2385,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Complex.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Complex.json */ /** * Sample code: Create or Update Full Azure Vm Protection Policy. @@ -2288,7 +2438,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/IaaS_v2_hourly.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/IaaS_v2_hourly.json */ /** * Sample code: Create or Update Enhanced Azure Vm Protection Policy with Hourly backup. @@ -2343,7 +2495,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/IaaS_v2_daily.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/IaaS_v2_daily.json */ /** * Sample code: Create or Update Enhanced Azure Vm Protection Policy with daily backup. @@ -2406,7 +2560,9 @@ public final class ProtectionPoliciesCreateOrUpdateSamples { */ public final class ProtectionPoliciesDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_Delete.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_Delete.json */ /** * Sample code: Delete Azure Vm Protection Policy. @@ -2429,7 +2585,9 @@ public final class ProtectionPoliciesDeleteSamples { */ public final class ProtectionPoliciesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_Get.json */ /** * Sample code: Get Azure IaasVm Protection Policy Details. @@ -2443,7 +2601,9 @@ public final class ProtectionPoliciesGetSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/v2-Get-Policy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/v2-Get-Policy.json */ /** * Sample code: Get Azure IaasVm Enhanced Protection Policy Details. @@ -2466,7 +2626,9 @@ public final class ProtectionPoliciesGetSamples { */ public final class ProtectionPolicyOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicyOperationResults_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicyOperationResults_Get.json */ /** * Sample code: Get Protection Policy Operation Results. @@ -2490,7 +2652,9 @@ public final class ProtectionPolicyOperationResultsGetSamples { */ public final class ProtectionPolicyOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicyOperationStatuses_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicyOperationStatuses_Get.json */ /** * Sample code: Get Protection Policy Operation Status. @@ -2514,7 +2678,9 @@ public final class ProtectionPolicyOperationStatusesGetSamples { */ public final class RecoveryPointsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPoints_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/RecoveryPoints_Get.json */ /** * Sample code: Get Azure Vm Recovery Point Details. @@ -2539,7 +2705,9 @@ public final class RecoveryPointsGetSamples { */ public final class RecoveryPointsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPoints_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/RecoveryPoints_List.json */ /** * Sample code: Get Protected Azure Vm Recovery Points. @@ -2556,6 +2724,42 @@ public final class RecoveryPointsListSamples { } ``` +### RecoveryPoints_Update + +```java +import com.azure.resourcemanager.recoveryservicesbackup.models.PatchRecoveryPointInput; +import com.azure.resourcemanager.recoveryservicesbackup.models.PatchRecoveryPointPropertiesInput; +import com.azure.resourcemanager.recoveryservicesbackup.models.UpdateRecoveryPointRequest; +import java.time.OffsetDateTime; + +/** + * Samples for RecoveryPoints Update. + */ +public final class RecoveryPointsUpdateSamples { + /* + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/RecoveryPoints_Update.json + */ + /** + * Sample code: Update Azure Vm Recovery Point Details. + * + * @param manager Entry point to RecoveryServicesBackupManager. + */ + public static void updateAzureVmRecoveryPointDetails( + com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { + manager.recoveryPoints() + .updateWithResponse("hanasnapshottesting", "HanaSnapshotTest", "Azure", + "VMAppContainer;compute;hanasnapshottesting;hana-eacan-2", "SAPHanaDatabase;hye;hye", + "2265668074516978193", + new UpdateRecoveryPointRequest().withProperties( + new PatchRecoveryPointInput().withRecoveryPointProperties(new PatchRecoveryPointPropertiesInput() + .withExpiryTime(OffsetDateTime.parse("2025-01-02T00:00:00.0000000Z")))), + com.azure.core.util.Context.NONE); + } +} +``` + ### RecoveryPointsRecommendedForMove_List ```java @@ -2567,7 +2771,9 @@ import java.util.Arrays; */ public final class RecoveryPointsRecommendedForMoveListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPointsRecommendedForMove_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/RecoveryPointsRecommendedForMove_List.json */ /** * Sample code: Get Protected Azure Vm Recovery Points Recommended for Move. @@ -2596,7 +2802,9 @@ public final class RecoveryPointsRecommendedForMoveListSamples { */ public final class ResourceGuardProxiesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json */ /** * Sample code: Get VaultGuardProxies. @@ -2618,7 +2826,9 @@ public final class ResourceGuardProxiesGetSamples { */ public final class ResourceGuardProxyOperationDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json */ /** * Sample code: Delete ResourceGuardProxy. @@ -2642,7 +2852,9 @@ public final class ResourceGuardProxyOperationDeleteSamples { */ public final class ResourceGuardProxyOperationGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json */ /** * Sample code: Get ResourceGuardProxy. @@ -2667,7 +2879,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProx */ public final class ResourceGuardProxyOperationPutSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json */ /** * Sample code: Create ResourceGuardProxy. @@ -2698,7 +2912,9 @@ import java.util.Arrays; */ public final class ResourceGuardProxyOperationUnlockDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json */ /** * Sample code: UnlockDelete ResourceGuardProxy. @@ -2729,7 +2945,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.PrepareDataMoveRe */ public final class ResourceProviderBmsPrepareDataMoveSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/PrepareDataMove_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/PrepareDataMove_Post.json */ /** * Sample code: Prepare Data Move. @@ -2758,7 +2976,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.TriggerDataMoveRe */ public final class ResourceProviderBmsTriggerDataMoveSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/TriggerDataMove_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/TriggerDataMove_Post.json */ /** * Sample code: Trigger Data Move. @@ -2786,7 +3006,9 @@ public final class ResourceProviderBmsTriggerDataMoveSamples { */ public final class ResourceProviderGetOperationStatusSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/BackupDataMoveOperationStatus_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/BackupDataMoveOperationStatus_Get.json */ /** * Sample code: Get OperationStatus. @@ -2813,7 +3035,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTier */ public final class ResourceProviderMoveRecoveryPointSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TriggerRecoveryPointMove_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TriggerRecoveryPointMove_Post.json */ /** * Sample code: Trigger RP Move Operation. @@ -2848,13 +3072,51 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriori import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequestResource; import com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessOption; import com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessSettings; +import java.util.Arrays; /** * Samples for Restores Trigger. */ public final class RestoresTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ResourceGuardEnabled.json + */ + /** + * Sample code: Trigger Restore with MUA. + * + * @param manager Entry point to RecoveryServicesBackupManager. + */ + public static void + triggerRestoreWithMUA(com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { + manager.restores() + .trigger("testVault", "netsdktestrg", "Azure", + "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", + new RestoreRequestResource().withProperties(new IaasVMRestoreRequest() + .withResourceGuardOperationRequests(Arrays.asList( + "/subscriptions/063bf7bc-e4dc-4cde-8840-8416fbd7921e/resourcegroups/ankurRG1/providers/Microsoft.DataProtection/resourceGuards/RG341/triggerRestoreRequests/default")) + .withRecoveryPointId("348916168024334") + .withRecoveryType(RecoveryType.RESTORE_DISKS) + .withSourceResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1") + .withRegion("southeastasia") + .withCreateNewCloudService(true) + .withOriginalStorageAccountOption(false) + .withEncryptionDetails(new EncryptionDetails().withEncryptionEnabled(false)) + .withIdentityInfo(new IdentityInfo().withIsSystemAssignedIdentity(false) + .withManagedIdentityResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi")) + .withIdentityBasedRestoreDetails(new IdentityBasedRestoreDetails().withTargetStorageAccountId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreWithRehydrationRequest. @@ -2893,7 +3155,9 @@ public final class RestoresTriggerSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest. @@ -2930,7 +3194,9 @@ public final class RestoresTriggerSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreWithRehydrationRequest. @@ -2961,7 +3227,9 @@ public final class RestoresTriggerSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest with identityBasedRestoreDetails. @@ -2998,7 +3266,9 @@ public final class RestoresTriggerSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreRequest. @@ -3034,7 +3304,9 @@ public final class RestoresTriggerSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json */ /** * Sample code: Restore Disks with IaasVMRestoreRequest with IdentityBasedRestoreDetails. @@ -3075,7 +3347,9 @@ public final class RestoresTriggerSamples { */ public final class SecurityPINsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupSecurityPin_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupSecurityPin_Get.json */ /** * Sample code: Get Vault Security Pin. @@ -3097,7 +3371,9 @@ public final class SecurityPINsGetSamples { */ public final class TieringCostOperationStatusGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/GetTieringCostOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/GetTieringCostOperationStatus.json */ /** * Sample code: Fetch Tiering Cost Operation Status. @@ -3128,7 +3404,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperation */ public final class ValidateOperationTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerValidateOperation_RestoreDisk.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerValidateOperation_RestoreDisk.json */ /** * Sample code: Trigger Validate Operation. @@ -3167,7 +3445,9 @@ public final class ValidateOperationTriggerSamples { */ public final class ValidateOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperationResults.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperationResults.json */ /** * Sample code: Get Operation Results of Validate Operation. @@ -3191,7 +3471,9 @@ public final class ValidateOperationResultsGetSamples { */ public final class ValidateOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperationStatus.json */ /** * Sample code: Get Operation Status of Validate Operation. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml index 6ac547d6f605a..9002b5d5edaac 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -18,7 +18,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. jar Microsoft Azure SDK for RecoveryServicesBackup Management - This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-2024-04. + This package contains Microsoft Azure SDK for RecoveryServicesBackup Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure RecoveryServices Backup service. Package tag package-preview-2024-11-01. https://github.com/Azure/azure-sdk-for-java @@ -46,6 +46,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. 0 0 true + false diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManager.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManager.java index c03cd74c053ee..57a5e9bdfad5d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManager.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManager.java @@ -11,8 +11,8 @@ import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; @@ -36,10 +36,10 @@ import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceEncryptionConfigsImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceStorageConfigsNonCrrsImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceVaultConfigsImpl; -import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupsImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupStatusImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupUsageSummariesImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupWorkloadItemsImpl; +import com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupsImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.BmsPrepareDataMoveOperationResultsImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.DeletedProtectionContainersImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.ExportJobsOperationResultsImpl; @@ -76,8 +76,8 @@ import com.azure.resourcemanager.recoveryservicesbackup.implementation.SecurityPINsImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.TieringCostOperationStatusImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationResultsImpl; -import com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationsImpl; import com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationStatusesImpl; +import com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationsImpl; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngines; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupJobs; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupOperationResults; @@ -90,10 +90,10 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceEncryptionConfigs; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceStorageConfigsNonCrrs; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfigs; -import com.azure.resourcemanager.recoveryservicesbackup.models.Backups; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupStatus; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupUsageSummaries; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupWorkloadItems; +import com.azure.resourcemanager.recoveryservicesbackup.models.Backups; import com.azure.resourcemanager.recoveryservicesbackup.models.BmsPrepareDataMoveOperationResults; import com.azure.resourcemanager.recoveryservicesbackup.models.DeletedProtectionContainers; import com.azure.resourcemanager.recoveryservicesbackup.models.ExportJobsOperationResults; @@ -129,8 +129,8 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.SecurityPINs; import com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostOperationStatus; import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationResults; -import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperations; import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationStatuses; +import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperations; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -415,7 +415,7 @@ public RecoveryServicesBackupManager authenticate(TokenCredential credential, Az .append("-") .append("com.azure.resourcemanager.recoveryservicesbackup") .append("/") - .append("1.4.0"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/RecoveryPointsClient.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/RecoveryPointsClient.java index 22d909dc12302..3efd754cc7793 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/RecoveryPointsClient.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/RecoveryPointsClient.java @@ -10,6 +10,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.RecoveryPointResourceInner; +import com.azure.resourcemanager.recoveryservicesbackup.models.UpdateRecoveryPointRequest; /** * An instance of this class provides access to all the operations defined in RecoveryPointsClient. @@ -91,4 +92,44 @@ Response getWithResponse(String vaultName, String re @ServiceMethod(returns = ReturnType.SINGLE) RecoveryPointResourceInner get(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId); + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String vaultName, + String fabricName, String containerName, String protectedItemName, String recoveryPointId, + UpdateRecoveryPointRequest parameters, Context context); + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoveryPointResourceInner update(String resourceGroupName, String vaultName, String fabricName, + String containerName, String protectedItemName, String recoveryPointId, UpdateRecoveryPointRequest parameters); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/AzureVMResourceFeatureSupportResponseInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/AzureVMResourceFeatureSupportResponseInner.java index e2daa1dbe6df2..aa91d018d1f1a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/AzureVMResourceFeatureSupportResponseInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/AzureVMResourceFeatureSupportResponseInner.java @@ -5,18 +5,22 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.SupportStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Response for feature support requests for Azure IaasVm. */ @Fluent -public final class AzureVMResourceFeatureSupportResponseInner { +public final class AzureVMResourceFeatureSupportResponseInner + implements JsonSerializable { /* * Support status of feature */ - @JsonProperty(value = "supportStatus") private SupportStatus supportStatus; /** @@ -52,4 +56,42 @@ public AzureVMResourceFeatureSupportResponseInner withSupportStatus(SupportStatu */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("supportStatus", this.supportStatus == null ? null : this.supportStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVMResourceFeatureSupportResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVMResourceFeatureSupportResponseInner if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVMResourceFeatureSupportResponseInner. + */ + public static AzureVMResourceFeatureSupportResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVMResourceFeatureSupportResponseInner deserializedAzureVMResourceFeatureSupportResponseInner + = new AzureVMResourceFeatureSupportResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("supportStatus".equals(fieldName)) { + deserializedAzureVMResourceFeatureSupportResponseInner.supportStatus + = SupportStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVMResourceFeatureSupportResponseInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupEngineBaseResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupEngineBaseResourceInner.java index bc070238f517e..20f1fcdaa4ec2 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupEngineBaseResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupEngineBaseResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBase; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class BackupEngineBaseResourceInner extends Resource { /* * BackupEngineBaseResource properties */ - @JsonProperty(value = "properties") private BackupEngineBase properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of BackupEngineBaseResourceInner class. */ @@ -73,6 +89,36 @@ public BackupEngineBaseResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,58 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupEngineBaseResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupEngineBaseResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupEngineBaseResourceInner. + */ + public static BackupEngineBaseResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupEngineBaseResourceInner deserializedBackupEngineBaseResourceInner + = new BackupEngineBaseResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBackupEngineBaseResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBackupEngineBaseResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBackupEngineBaseResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedBackupEngineBaseResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedBackupEngineBaseResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedBackupEngineBaseResourceInner.properties = BackupEngineBase.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedBackupEngineBaseResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupEngineBaseResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupManagementUsageInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupManagementUsageInner.java index d3021d58d84aa..243febb2cb24b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupManagementUsageInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupManagementUsageInner.java @@ -5,50 +5,50 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.NameInfo; import com.azure.resourcemanager.recoveryservicesbackup.models.UsagesUnit; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Backup management usages of a vault. */ @Fluent -public final class BackupManagementUsageInner { +public final class BackupManagementUsageInner implements JsonSerializable { /* * Unit of the usage. */ - @JsonProperty(value = "unit") private UsagesUnit unit; /* * Quota period of usage. */ - @JsonProperty(value = "quotaPeriod") private String quotaPeriod; /* * Next reset time of usage. */ - @JsonProperty(value = "nextResetTime") private OffsetDateTime nextResetTime; /* * Current value of usage. */ - @JsonProperty(value = "currentValue") private Long currentValue; /* * Limit of usage. */ - @JsonProperty(value = "limit") private Long limit; /* * Name of usage. */ - @JsonProperty(value = "name") private NameInfo name; /** @@ -187,4 +187,57 @@ public void validate() { name().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("unit", this.unit == null ? null : this.unit.toString()); + jsonWriter.writeStringField("quotaPeriod", this.quotaPeriod); + jsonWriter.writeStringField("nextResetTime", + this.nextResetTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.nextResetTime)); + jsonWriter.writeNumberField("currentValue", this.currentValue); + jsonWriter.writeNumberField("limit", this.limit); + jsonWriter.writeJsonField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupManagementUsageInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupManagementUsageInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupManagementUsageInner. + */ + public static BackupManagementUsageInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupManagementUsageInner deserializedBackupManagementUsageInner = new BackupManagementUsageInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("unit".equals(fieldName)) { + deserializedBackupManagementUsageInner.unit = UsagesUnit.fromString(reader.getString()); + } else if ("quotaPeriod".equals(fieldName)) { + deserializedBackupManagementUsageInner.quotaPeriod = reader.getString(); + } else if ("nextResetTime".equals(fieldName)) { + deserializedBackupManagementUsageInner.nextResetTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("currentValue".equals(fieldName)) { + deserializedBackupManagementUsageInner.currentValue = reader.getNullable(JsonReader::getLong); + } else if ("limit".equals(fieldName)) { + deserializedBackupManagementUsageInner.limit = reader.getNullable(JsonReader::getLong); + } else if ("name".equals(fieldName)) { + deserializedBackupManagementUsageInner.name = NameInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupManagementUsageInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceConfigResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceConfigResourceInner.java index 75040f022a409..7a6590061db49 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceConfigResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceConfigResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfig; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class BackupResourceConfigResourceInner extends Resource { /* * BackupResourceConfigResource properties */ - @JsonProperty(value = "properties") private BackupResourceConfig properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of BackupResourceConfigResourceInner class. */ @@ -73,6 +89,36 @@ public BackupResourceConfigResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,58 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceConfigResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceConfigResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupResourceConfigResourceInner. + */ + public static BackupResourceConfigResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceConfigResourceInner deserializedBackupResourceConfigResourceInner + = new BackupResourceConfigResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBackupResourceConfigResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBackupResourceConfigResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBackupResourceConfigResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedBackupResourceConfigResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedBackupResourceConfigResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedBackupResourceConfigResourceInner.properties = BackupResourceConfig.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedBackupResourceConfigResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceConfigResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceEncryptionConfigExtendedResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceEncryptionConfigExtendedResourceInner.java index 288123f4d123a..35c88d48cb76b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceEncryptionConfigExtendedResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceEncryptionConfigExtendedResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceEncryptionConfigExtended; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class BackupResourceEncryptionConfigExtendedResourceInner extends R /* * BackupResourceEncryptionConfigExtendedResource properties */ - @JsonProperty(value = "properties") private BackupResourceEncryptionConfigExtended properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of BackupResourceEncryptionConfigExtendedResourceInner class. */ @@ -74,6 +90,36 @@ public BackupResourceEncryptionConfigExtendedResourceInner withEtag(String etag) return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -102,4 +148,60 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceEncryptionConfigExtendedResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceEncryptionConfigExtendedResourceInner if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupResourceEncryptionConfigExtendedResourceInner. + */ + public static BackupResourceEncryptionConfigExtendedResourceInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceEncryptionConfigExtendedResourceInner deserializedBackupResourceEncryptionConfigExtendedResourceInner + = new BackupResourceEncryptionConfigExtendedResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtendedResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtendedResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtendedResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtendedResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedBackupResourceEncryptionConfigExtendedResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtendedResourceInner.properties + = BackupResourceEncryptionConfigExtended.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtendedResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceEncryptionConfigExtendedResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceVaultConfigResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceVaultConfigResourceInner.java index 536be11b951d3..7c7b29803cb23 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceVaultConfigResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupResourceVaultConfigResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfig; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class BackupResourceVaultConfigResourceInner extends Resource { /* * BackupResourceVaultConfigResource properties */ - @JsonProperty(value = "properties") private BackupResourceVaultConfig properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of BackupResourceVaultConfigResourceInner class. */ @@ -73,6 +89,36 @@ public BackupResourceVaultConfigResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,59 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceVaultConfigResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceVaultConfigResourceInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupResourceVaultConfigResourceInner. + */ + public static BackupResourceVaultConfigResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceVaultConfigResourceInner deserializedBackupResourceVaultConfigResourceInner + = new BackupResourceVaultConfigResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBackupResourceVaultConfigResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBackupResourceVaultConfigResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBackupResourceVaultConfigResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedBackupResourceVaultConfigResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedBackupResourceVaultConfigResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedBackupResourceVaultConfigResourceInner.properties + = BackupResourceVaultConfig.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedBackupResourceVaultConfigResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceVaultConfigResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupStatusResponseInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupStatusResponseInner.java index ed04a300f9047..fe64909171912 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupStatusResponseInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/BackupStatusResponseInner.java @@ -5,80 +5,73 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.AcquireStorageAccountLock; import com.azure.resourcemanager.recoveryservicesbackup.models.FabricName; import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * BackupStatus response. */ @Fluent -public final class BackupStatusResponseInner { +public final class BackupStatusResponseInner implements JsonSerializable { /* * Specifies whether the container is registered or not */ - @JsonProperty(value = "protectionStatus") private ProtectionStatus protectionStatus; /* * Specifies the arm resource id of the vault */ - @JsonProperty(value = "vaultId") private String vaultId; /* * Specifies the fabric name - Azure or AD */ - @JsonProperty(value = "fabricName") private FabricName fabricName; /* * Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;csname;vmname. */ - @JsonProperty(value = "containerName") private String containerName; /* * Specifies the product specific ds name. E.g. vm;iaasvmcontainer;csname;vmname. */ - @JsonProperty(value = "protectedItemName") private String protectedItemName; /* * ErrorCode in case of intent failed */ - @JsonProperty(value = "errorCode") private String errorCode; /* * ErrorMessage in case of intent failed. */ - @JsonProperty(value = "errorMessage") private String errorMessage; /* * Specifies the policy name which is used for protection */ - @JsonProperty(value = "policyName") private String policyName; /* * Container registration status */ - @JsonProperty(value = "registrationStatus") private String registrationStatus; /* * Number of protected items */ - @JsonProperty(value = "protectedItemsCount") private Integer protectedItemsCount; /* * Specifies whether the storage account lock has been acquired or not */ - @JsonProperty(value = "acquireStorageAccountLock") private AcquireStorageAccountLock acquireStorageAccountLock; /** @@ -319,4 +312,74 @@ public AcquireStorageAccountLock acquireStorageAccountLock() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("protectionStatus", + this.protectionStatus == null ? null : this.protectionStatus.toString()); + jsonWriter.writeStringField("vaultId", this.vaultId); + jsonWriter.writeStringField("fabricName", this.fabricName == null ? null : this.fabricName.toString()); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("protectedItemName", this.protectedItemName); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeStringField("policyName", this.policyName); + jsonWriter.writeStringField("registrationStatus", this.registrationStatus); + jsonWriter.writeNumberField("protectedItemsCount", this.protectedItemsCount); + jsonWriter.writeStringField("acquireStorageAccountLock", + this.acquireStorageAccountLock == null ? null : this.acquireStorageAccountLock.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupStatusResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupStatusResponseInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupStatusResponseInner. + */ + public static BackupStatusResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupStatusResponseInner deserializedBackupStatusResponseInner = new BackupStatusResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectionStatus".equals(fieldName)) { + deserializedBackupStatusResponseInner.protectionStatus + = ProtectionStatus.fromString(reader.getString()); + } else if ("vaultId".equals(fieldName)) { + deserializedBackupStatusResponseInner.vaultId = reader.getString(); + } else if ("fabricName".equals(fieldName)) { + deserializedBackupStatusResponseInner.fabricName = FabricName.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedBackupStatusResponseInner.containerName = reader.getString(); + } else if ("protectedItemName".equals(fieldName)) { + deserializedBackupStatusResponseInner.protectedItemName = reader.getString(); + } else if ("errorCode".equals(fieldName)) { + deserializedBackupStatusResponseInner.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedBackupStatusResponseInner.errorMessage = reader.getString(); + } else if ("policyName".equals(fieldName)) { + deserializedBackupStatusResponseInner.policyName = reader.getString(); + } else if ("registrationStatus".equals(fieldName)) { + deserializedBackupStatusResponseInner.registrationStatus = reader.getString(); + } else if ("protectedItemsCount".equals(fieldName)) { + deserializedBackupStatusResponseInner.protectedItemsCount = reader.getNullable(JsonReader::getInt); + } else if ("acquireStorageAccountLock".equals(fieldName)) { + deserializedBackupStatusResponseInner.acquireStorageAccountLock + = AcquireStorageAccountLock.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupStatusResponseInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ClientDiscoveryValueForSingleApiInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ClientDiscoveryValueForSingleApiInner.java index 1a0dba677e60d..b27e4331ff9bf 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ClientDiscoveryValueForSingleApiInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ClientDiscoveryValueForSingleApiInner.java @@ -5,37 +5,38 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryDisplay; import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Available operation details. */ @Fluent -public final class ClientDiscoveryValueForSingleApiInner { +public final class ClientDiscoveryValueForSingleApiInner + implements JsonSerializable { /* * Name of the Operation. */ - @JsonProperty(value = "name") private String name; /* * Contains the localized display information for this particular operation */ - @JsonProperty(value = "display") private ClientDiscoveryDisplay display; /* * The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX */ - @JsonProperty(value = "origin") private String origin; /* * ShoeBox properties for the given operation. */ - @JsonProperty(value = "properties") private ClientDiscoveryForProperties properties; /** @@ -139,4 +140,51 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("display", this.display); + jsonWriter.writeStringField("origin", this.origin); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientDiscoveryValueForSingleApiInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientDiscoveryValueForSingleApiInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientDiscoveryValueForSingleApiInner. + */ + public static ClientDiscoveryValueForSingleApiInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientDiscoveryValueForSingleApiInner deserializedClientDiscoveryValueForSingleApiInner + = new ClientDiscoveryValueForSingleApiInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedClientDiscoveryValueForSingleApiInner.name = reader.getString(); + } else if ("display".equals(fieldName)) { + deserializedClientDiscoveryValueForSingleApiInner.display = ClientDiscoveryDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedClientDiscoveryValueForSingleApiInner.origin = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedClientDiscoveryValueForSingleApiInner.properties + = ClientDiscoveryForProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClientDiscoveryValueForSingleApiInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/JobResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/JobResourceInner.java index 447b7f6fd1233..f270ac4dbe135 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/JobResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/JobResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.Job; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class JobResourceInner extends Resource { /* * JobResource properties */ - @JsonProperty(value = "properties") private Job properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of JobResourceInner class. */ @@ -73,6 +89,36 @@ public JobResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,57 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobResourceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobResourceInner. + */ + public static JobResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobResourceInner deserializedJobResourceInner = new JobResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedJobResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedJobResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedJobResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedJobResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedJobResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedJobResourceInner.properties = Job.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedJobResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationResultInfoBaseResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationResultInfoBaseResourceInner.java index 81894ddccb587..bacc0dcec57a6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationResultInfoBaseResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationResultInfoBaseResourceInner.java @@ -5,10 +5,13 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.HttpStatusCode; import com.azure.resourcemanager.recoveryservicesbackup.models.OperationResultInfoBase; import com.azure.resourcemanager.recoveryservicesbackup.models.OperationWorkerResponse; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -20,7 +23,6 @@ public final class OperationResultInfoBaseResourceInner extends OperationWorkerR /* * OperationResultInfoBaseResource operation */ - @JsonProperty(value = "operation") private OperationResultInfoBase operation; /** @@ -74,9 +76,56 @@ public OperationResultInfoBaseResourceInner withHeaders(Map */ @Override public void validate() { - super.validate(); if (operation() != null) { operation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("statusCode", statusCode() == null ? null : statusCode().toString()); + jsonWriter.writeMapField("headers", headers(), + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeJsonField("operation", this.operation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationResultInfoBaseResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationResultInfoBaseResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationResultInfoBaseResourceInner. + */ + public static OperationResultInfoBaseResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationResultInfoBaseResourceInner deserializedOperationResultInfoBaseResourceInner + = new OperationResultInfoBaseResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("statusCode".equals(fieldName)) { + deserializedOperationResultInfoBaseResourceInner + .withStatusCode(HttpStatusCode.fromString(reader.getString())); + } else if ("headers".equals(fieldName)) { + Map> headers + = reader.readMap(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedOperationResultInfoBaseResourceInner.withHeaders(headers); + } else if ("operation".equals(fieldName)) { + deserializedOperationResultInfoBaseResourceInner.operation + = OperationResultInfoBase.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationResultInfoBaseResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationStatusInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationStatusInner.java index b385c22733eae..a4d748ee05a8a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationStatusInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/OperationStatusInner.java @@ -5,57 +5,56 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusError; import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusExtendedInfo; import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusValues; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Operation status. */ @Fluent -public final class OperationStatusInner { +public final class OperationStatusInner implements JsonSerializable { /* * ID of the operation. */ - @JsonProperty(value = "id") private String id; /* * Name of the operation. */ - @JsonProperty(value = "name") private String name; /* * Operation status. */ - @JsonProperty(value = "status") private OperationStatusValues status; /* * Operation start time. Format: ISO-8601. */ - @JsonProperty(value = "startTime") private OffsetDateTime startTime; /* * Operation end time. Format: ISO-8601. */ - @JsonProperty(value = "endTime") private OffsetDateTime endTime; /* * Error information related to this operation. */ - @JsonProperty(value = "error") private OperationStatusError error; /* * Additional information associated with this operation. */ - @JsonProperty(value = "properties") private OperationStatusExtendedInfo properties; /** @@ -217,4 +216,62 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusInner. + */ + public static OperationStatusInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusInner deserializedOperationStatusInner = new OperationStatusInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOperationStatusInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOperationStatusInner.name = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedOperationStatusInner.status = OperationStatusValues.fromString(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedOperationStatusInner.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedOperationStatusInner.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("error".equals(fieldName)) { + deserializedOperationStatusInner.error = OperationStatusError.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedOperationStatusInner.properties = OperationStatusExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PreValidateEnableBackupResponseInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PreValidateEnableBackupResponseInner.java index 06c4e8747583a..e2054e1bf868f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PreValidateEnableBackupResponseInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PreValidateEnableBackupResponseInner.java @@ -5,49 +5,49 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ValidationStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Response contract for enable backup validation request. */ @Fluent -public final class PreValidateEnableBackupResponseInner { +public final class PreValidateEnableBackupResponseInner + implements JsonSerializable { /* * Validation Status */ - @JsonProperty(value = "status") private ValidationStatus status; /* * Response error code */ - @JsonProperty(value = "errorCode") private String errorCode; /* * Response error message */ - @JsonProperty(value = "errorMessage") private String errorMessage; /* * Recommended action for user */ - @JsonProperty(value = "recommendation") private String recommendation; /* - * Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;rgname;vmname. This is required + * Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;rgname;vmname. This is + * required * for portal */ - @JsonProperty(value = "containerName") private String containerName; /* * Specifies the product specific ds name. E.g. vm;iaasvmcontainer;rgname;vmname. This is required for portal */ - @JsonProperty(value = "protectedItemName") private String protectedItemName; /** @@ -189,4 +189,57 @@ public PreValidateEnableBackupResponseInner withProtectedItemName(String protect */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeStringField("recommendation", this.recommendation); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("protectedItemName", this.protectedItemName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreValidateEnableBackupResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreValidateEnableBackupResponseInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PreValidateEnableBackupResponseInner. + */ + public static PreValidateEnableBackupResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreValidateEnableBackupResponseInner deserializedPreValidateEnableBackupResponseInner + = new PreValidateEnableBackupResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPreValidateEnableBackupResponseInner.status + = ValidationStatus.fromString(reader.getString()); + } else if ("errorCode".equals(fieldName)) { + deserializedPreValidateEnableBackupResponseInner.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedPreValidateEnableBackupResponseInner.errorMessage = reader.getString(); + } else if ("recommendation".equals(fieldName)) { + deserializedPreValidateEnableBackupResponseInner.recommendation = reader.getString(); + } else if ("containerName".equals(fieldName)) { + deserializedPreValidateEnableBackupResponseInner.containerName = reader.getString(); + } else if ("protectedItemName".equals(fieldName)) { + deserializedPreValidateEnableBackupResponseInner.protectedItemName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPreValidateEnableBackupResponseInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PrivateEndpointConnectionResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PrivateEndpointConnectionResourceInner.java index 8ac62a25af21b..7e13904804f03 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PrivateEndpointConnectionResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/PrivateEndpointConnectionResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnection; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class PrivateEndpointConnectionResourceInner extends Resource { /* * PrivateEndpointConnectionResource properties */ - @JsonProperty(value = "properties") private PrivateEndpointConnection properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of PrivateEndpointConnectionResourceInner class. */ @@ -73,6 +89,36 @@ public PrivateEndpointConnectionResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,59 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionResourceInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionResourceInner. + */ + public static PrivateEndpointConnectionResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionResourceInner deserializedPrivateEndpointConnectionResourceInner + = new PrivateEndpointConnectionResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.properties + = PrivateEndpointConnection.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectableContainerResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectableContainerResourceInner.java index b8138f96d9dee..ae6416a440410 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectableContainerResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectableContainerResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainer; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class ProtectableContainerResourceInner extends Resource { /* * ProtectableContainerResource properties */ - @JsonProperty(value = "properties") private ProtectableContainer properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ProtectableContainerResourceInner class. */ @@ -73,6 +89,36 @@ public ProtectableContainerResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,58 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectableContainerResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectableContainerResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProtectableContainerResourceInner. + */ + public static ProtectableContainerResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectableContainerResourceInner deserializedProtectableContainerResourceInner + = new ProtectableContainerResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProtectableContainerResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProtectableContainerResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProtectableContainerResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedProtectableContainerResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedProtectableContainerResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedProtectableContainerResourceInner.properties = ProtectableContainer.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedProtectableContainerResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectableContainerResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectedItemResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectedItemResourceInner.java index d6c2455da75a3..42f943c659c7c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectedItemResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectedItemResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItem; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class ProtectedItemResourceInner extends Resource { /* * ProtectedItemResource properties */ - @JsonProperty(value = "properties") private ProtectedItem properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ProtectedItemResourceInner class. */ @@ -73,6 +89,36 @@ public ProtectedItemResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,57 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectedItemResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectedItemResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProtectedItemResourceInner. + */ + public static ProtectedItemResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectedItemResourceInner deserializedProtectedItemResourceInner = new ProtectedItemResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProtectedItemResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProtectedItemResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProtectedItemResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedProtectedItemResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedProtectedItemResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedProtectedItemResourceInner.properties = ProtectedItem.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedProtectedItemResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectedItemResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionContainerResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionContainerResourceInner.java index b1ce44d6c063d..128477b680158 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionContainerResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionContainerResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainer; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class ProtectionContainerResourceInner extends Resource { /* * ProtectionContainerResource properties */ - @JsonProperty(value = "properties") private ProtectionContainer properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ProtectionContainerResourceInner class. */ @@ -73,6 +89,36 @@ public ProtectionContainerResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,58 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionContainerResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionContainerResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProtectionContainerResourceInner. + */ + public static ProtectionContainerResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionContainerResourceInner deserializedProtectionContainerResourceInner + = new ProtectionContainerResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProtectionContainerResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProtectionContainerResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProtectionContainerResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedProtectionContainerResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedProtectionContainerResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedProtectionContainerResourceInner.properties = ProtectionContainer.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedProtectionContainerResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionContainerResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionIntentResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionIntentResourceInner.java index f96743ae08568..1f3de4c4c077b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionIntentResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionIntentResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntent; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class ProtectionIntentResourceInner extends Resource { /* * ProtectionIntentResource properties */ - @JsonProperty(value = "properties") private ProtectionIntent properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ProtectionIntentResourceInner class. */ @@ -73,6 +89,36 @@ public ProtectionIntentResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,58 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionIntentResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionIntentResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProtectionIntentResourceInner. + */ + public static ProtectionIntentResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionIntentResourceInner deserializedProtectionIntentResourceInner + = new ProtectionIntentResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProtectionIntentResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProtectionIntentResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProtectionIntentResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedProtectionIntentResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedProtectionIntentResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedProtectionIntentResourceInner.properties = ProtectionIntent.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedProtectionIntentResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionIntentResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionPolicyResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionPolicyResourceInner.java index 73bfd2b8a5f2b..374e9b0bb218e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionPolicyResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ProtectionPolicyResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicy; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class ProtectionPolicyResourceInner extends Resource { /* * ProtectionPolicyResource properties */ - @JsonProperty(value = "properties") private ProtectionPolicy properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ProtectionPolicyResourceInner class. */ @@ -73,6 +89,36 @@ public ProtectionPolicyResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,58 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionPolicyResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionPolicyResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProtectionPolicyResourceInner. + */ + public static ProtectionPolicyResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionPolicyResourceInner deserializedProtectionPolicyResourceInner + = new ProtectionPolicyResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProtectionPolicyResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProtectionPolicyResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProtectionPolicyResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedProtectionPolicyResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedProtectionPolicyResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedProtectionPolicyResourceInner.properties = ProtectionPolicy.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedProtectionPolicyResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionPolicyResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/RecoveryPointResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/RecoveryPointResourceInner.java index 16ddbcdec63c7..17bf49c9253ec 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/RecoveryPointResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/RecoveryPointResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPoint; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class RecoveryPointResourceInner extends Resource { /* * RecoveryPointResource properties */ - @JsonProperty(value = "properties") private RecoveryPoint properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of RecoveryPointResourceInner class. */ @@ -73,6 +89,36 @@ public RecoveryPointResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,57 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecoveryPointResourceInner. + */ + public static RecoveryPointResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointResourceInner deserializedRecoveryPointResourceInner = new RecoveryPointResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRecoveryPointResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRecoveryPointResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRecoveryPointResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedRecoveryPointResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedRecoveryPointResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedRecoveryPointResourceInner.properties = RecoveryPoint.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedRecoveryPointResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ResourceGuardProxyBaseResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ResourceGuardProxyBaseResourceInner.java index 5cc1956db1637..c4da158cb823f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ResourceGuardProxyBaseResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ResourceGuardProxyBaseResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBase; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class ResourceGuardProxyBaseResourceInner extends Resource { /* * ResourceGuardProxyBaseResource properties */ - @JsonProperty(value = "properties") private ResourceGuardProxyBase properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ResourceGuardProxyBaseResourceInner class. */ @@ -73,6 +89,36 @@ public ResourceGuardProxyBaseResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,59 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceGuardProxyBaseResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceGuardProxyBaseResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceGuardProxyBaseResourceInner. + */ + public static ResourceGuardProxyBaseResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceGuardProxyBaseResourceInner deserializedResourceGuardProxyBaseResourceInner + = new ResourceGuardProxyBaseResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResourceGuardProxyBaseResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResourceGuardProxyBaseResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedResourceGuardProxyBaseResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedResourceGuardProxyBaseResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedResourceGuardProxyBaseResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedResourceGuardProxyBaseResourceInner.properties + = ResourceGuardProxyBase.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedResourceGuardProxyBaseResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceGuardProxyBaseResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TieringCostInfoInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TieringCostInfoInner.java index 9fb3a2fb94b4c..cade748cd43f9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TieringCostInfoInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TieringCostInfoInner.java @@ -5,40 +5,29 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostRehydrationInfo; import com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostSavingInfo; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Base class for tiering cost response. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = TieringCostInfoInner.class, - visible = true) -@JsonTypeName("TieringCostInfo") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "TieringCostRehydrationInfo", value = TieringCostRehydrationInfo.class), - @JsonSubTypes.Type(name = "TieringCostSavingInfo", value = TieringCostSavingInfo.class) }) @Immutable -public class TieringCostInfoInner { +public class TieringCostInfoInner implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "TieringCostInfo"; /** * Creates an instance of TieringCostInfoInner class. */ public TieringCostInfoInner() { - this.objectType = "TieringCostInfo"; } /** @@ -58,4 +47,67 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TieringCostInfoInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TieringCostInfoInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TieringCostInfoInner. + */ + public static TieringCostInfoInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("TieringCostRehydrationInfo".equals(discriminatorValue)) { + return TieringCostRehydrationInfo.fromJson(readerToUse.reset()); + } else if ("TieringCostSavingInfo".equals(discriminatorValue)) { + return TieringCostSavingInfo.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static TieringCostInfoInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TieringCostInfoInner deserializedTieringCostInfoInner = new TieringCostInfoInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedTieringCostInfoInner.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTieringCostInfoInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TokenInformationInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TokenInformationInner.java index 4bbd2e78d5353..b08ac4b7c0d0a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TokenInformationInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/TokenInformationInner.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The token information details. */ @Fluent -public final class TokenInformationInner { +public final class TokenInformationInner implements JsonSerializable { /* * Token value. */ - @JsonProperty(value = "token") private String token; /* * Expiry time of token. */ - @JsonProperty(value = "expiryTimeInUtcTicks") private Long expiryTimeInUtcTicks; /* * Security PIN */ - @JsonProperty(value = "securityPIN") private String securityPin; /** @@ -103,4 +104,46 @@ public TokenInformationInner withSecurityPin(String securityPin) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("token", this.token); + jsonWriter.writeNumberField("expiryTimeInUtcTicks", this.expiryTimeInUtcTicks); + jsonWriter.writeStringField("securityPIN", this.securityPin); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TokenInformationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TokenInformationInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TokenInformationInner. + */ + public static TokenInformationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TokenInformationInner deserializedTokenInformationInner = new TokenInformationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("token".equals(fieldName)) { + deserializedTokenInformationInner.token = reader.getString(); + } else if ("expiryTimeInUtcTicks".equals(fieldName)) { + deserializedTokenInformationInner.expiryTimeInUtcTicks = reader.getNullable(JsonReader::getLong); + } else if ("securityPIN".equals(fieldName)) { + deserializedTokenInformationInner.securityPin = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTokenInformationInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/UnlockDeleteResponseInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/UnlockDeleteResponseInner.java index d2d9c71a90aa7..dfffa2a946e49 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/UnlockDeleteResponseInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/UnlockDeleteResponseInner.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Response of Unlock Delete API. */ @Fluent -public final class UnlockDeleteResponseInner { +public final class UnlockDeleteResponseInner implements JsonSerializable { /* * This is the time when unlock delete privileges will get expired. */ - @JsonProperty(value = "unlockDeleteExpiryTime") private String unlockDeleteExpiryTime; /** @@ -51,4 +54,40 @@ public UnlockDeleteResponseInner withUnlockDeleteExpiryTime(String unlockDeleteE */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("unlockDeleteExpiryTime", this.unlockDeleteExpiryTime); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnlockDeleteResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnlockDeleteResponseInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UnlockDeleteResponseInner. + */ + public static UnlockDeleteResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnlockDeleteResponseInner deserializedUnlockDeleteResponseInner = new UnlockDeleteResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("unlockDeleteExpiryTime".equals(fieldName)) { + deserializedUnlockDeleteResponseInner.unlockDeleteExpiryTime = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUnlockDeleteResponseInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ValidateOperationsResponseInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ValidateOperationsResponseInner.java index 01cb1a9eac3b6..4a2186e938721 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ValidateOperationsResponseInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/ValidateOperationsResponseInner.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationResponse; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The ValidateOperationsResponse model. */ @Fluent -public final class ValidateOperationsResponseInner { +public final class ValidateOperationsResponseInner implements JsonSerializable { /* * Base class for validate operation response. */ - @JsonProperty(value = "validateOperationResponse") private ValidateOperationResponse validateOperationResponse; /** @@ -56,4 +59,42 @@ public void validate() { validateOperationResponse().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("validateOperationResponse", this.validateOperationResponse); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ValidateOperationsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ValidateOperationsResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ValidateOperationsResponseInner. + */ + public static ValidateOperationsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ValidateOperationsResponseInner deserializedValidateOperationsResponseInner + = new ValidateOperationsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("validateOperationResponse".equals(fieldName)) { + deserializedValidateOperationsResponseInner.validateOperationResponse + = ValidateOperationResponse.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedValidateOperationsResponseInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/VaultStorageConfigOperationResultResponseInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/VaultStorageConfigOperationResultResponseInner.java index 4b43b1485ffde..0dcad8af2a4c7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/VaultStorageConfigOperationResultResponseInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/VaultStorageConfigOperationResultResponseInner.java @@ -5,37 +5,29 @@ package com.azure.resourcemanager.recoveryservicesbackup.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.PrepareDataMoveResponse; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Operation result response for Vault Storage Config. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = VaultStorageConfigOperationResultResponseInner.class, - visible = true) -@JsonTypeName("VaultStorageConfigOperationResultResponse") -@JsonSubTypes({ @JsonSubTypes.Type(name = "PrepareDataMoveResponse", value = PrepareDataMoveResponse.class) }) @Immutable -public class VaultStorageConfigOperationResultResponseInner { +public class VaultStorageConfigOperationResultResponseInner + implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "VaultStorageConfigOperationResultResponse"; /** * Creates an instance of VaultStorageConfigOperationResultResponseInner class. */ public VaultStorageConfigOperationResultResponseInner() { - this.objectType = "VaultStorageConfigOperationResultResponse"; } /** @@ -55,4 +47,67 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultStorageConfigOperationResultResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultStorageConfigOperationResultResponseInner if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VaultStorageConfigOperationResultResponseInner. + */ + public static VaultStorageConfigOperationResultResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("PrepareDataMoveResponse".equals(discriminatorValue)) { + return PrepareDataMoveResponse.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static VaultStorageConfigOperationResultResponseInner fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VaultStorageConfigOperationResultResponseInner deserializedVaultStorageConfigOperationResultResponseInner + = new VaultStorageConfigOperationResultResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedVaultStorageConfigOperationResultResponseInner.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultStorageConfigOperationResultResponseInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadItemResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadItemResourceInner.java index d705166ccc4cf..3c96ee32b8e87 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadItemResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadItemResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItem; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class WorkloadItemResourceInner extends Resource { /* * WorkloadItemResource properties */ - @JsonProperty(value = "properties") private WorkloadItem properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of WorkloadItemResourceInner class. */ @@ -73,6 +89,36 @@ public WorkloadItemResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,57 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadItemResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadItemResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkloadItemResourceInner. + */ + public static WorkloadItemResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadItemResourceInner deserializedWorkloadItemResourceInner = new WorkloadItemResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkloadItemResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkloadItemResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkloadItemResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedWorkloadItemResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWorkloadItemResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedWorkloadItemResourceInner.properties = WorkloadItem.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedWorkloadItemResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadItemResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadProtectableItemResourceInner.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadProtectableItemResourceInner.java index 56471724a4b40..3777991a61639 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadProtectableItemResourceInner.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/fluent/models/WorkloadProtectableItemResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItem; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -18,15 +21,28 @@ public final class WorkloadProtectableItemResourceInner extends Resource { /* * WorkloadProtectableItemResource properties */ - @JsonProperty(value = "properties") private WorkloadProtectableItem properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of WorkloadProtectableItemResourceInner class. */ @@ -73,6 +89,36 @@ public WorkloadProtectableItemResourceInner withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -101,4 +147,59 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadProtectableItemResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadProtectableItemResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkloadProtectableItemResourceInner. + */ + public static WorkloadProtectableItemResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadProtectableItemResourceInner deserializedWorkloadProtectableItemResourceInner + = new WorkloadProtectableItemResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkloadProtectableItemResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkloadProtectableItemResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkloadProtectableItemResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedWorkloadProtectableItemResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWorkloadProtectableItemResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedWorkloadProtectableItemResourceInner.properties + = WorkloadProtectableItem.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedWorkloadProtectableItemResourceInner.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadProtectableItemResourceInner; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupEnginesClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupEnginesClientImpl.java index 6b87250d6e472..5142352b9fbb1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupEnginesClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupEnginesClientImpl.java @@ -413,9 +413,7 @@ public BackupEngineBaseResourceInner get(String vaultName, String resourceGroupN /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -441,9 +439,7 @@ private Mono> listNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupJobsClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupJobsClientImpl.java index dec2583451db4..6dd7795b9c1c3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupJobsClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupJobsClientImpl.java @@ -255,9 +255,7 @@ public PagedIterable list(String vaultName, String resourceGro /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -282,9 +280,7 @@ private Mono> listNextSinglePageAsync(String nex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupPoliciesClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupPoliciesClientImpl.java index bcca9d3281023..9ed54afc70d99 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupPoliciesClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupPoliciesClientImpl.java @@ -258,9 +258,7 @@ public PagedIterable list(String vaultName, Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -286,9 +284,7 @@ private Mono> listNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectableItemsClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectableItemsClientImpl.java index e82d08902beac..bf24bc701a105 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectableItemsClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectableItemsClientImpl.java @@ -265,9 +265,7 @@ public PagedIterable list(String vaultName /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -293,9 +291,7 @@ private Mono> listNextSingle /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectedItemsClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectedItemsClientImpl.java index 6908ea57d1a90..2bcea62aa4131 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectedItemsClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectedItemsClientImpl.java @@ -258,9 +258,7 @@ public PagedIterable list(String vaultName, String r /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -286,9 +284,7 @@ private Mono> listNextSinglePageAsync( /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionContainersClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionContainersClientImpl.java index 0e1f11f97a25c..5d29a5b8c6c9f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionContainersClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionContainersClientImpl.java @@ -251,9 +251,7 @@ public PagedIterable list(String vaultName, St /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -279,9 +277,7 @@ private Mono> listNextSinglePage /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionIntentsClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionIntentsClientImpl.java index 255f4f33526db..1ec03c0b30952 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionIntentsClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupProtectionIntentsClientImpl.java @@ -258,9 +258,7 @@ public PagedIterable list(String vaultName, Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -286,9 +284,7 @@ private Mono> listNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupWorkloadItemsClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupWorkloadItemsClientImpl.java index dea479bee0b6c..310ef5a9b2727 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupWorkloadItemsClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/BackupWorkloadItemsClientImpl.java @@ -305,9 +305,7 @@ public PagedIterable list(String vaultName, String re /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -332,9 +330,7 @@ private Mono> listNextSinglePageAsync(S /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/DeletedProtectionContainersClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/DeletedProtectionContainersClientImpl.java index 0b1b8f36382d8..18ad2be0e4886 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/DeletedProtectionContainersClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/DeletedProtectionContainersClientImpl.java @@ -251,9 +251,7 @@ public PagedIterable list(String resourceGroup /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -279,9 +277,7 @@ private Mono> listNextSinglePage /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/OperationsClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/OperationsClientImpl.java index 9c607b75886c5..abfbcd99ea443 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/OperationsClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/OperationsClientImpl.java @@ -183,9 +183,7 @@ public PagedIterable list(Context context /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -211,9 +209,7 @@ private Mono> listNextSingl /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ProtectableContainersClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ProtectableContainersClientImpl.java index 7db0e84d254a2..7f2753f7d2baa 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ProtectableContainersClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ProtectableContainersClientImpl.java @@ -266,9 +266,7 @@ public PagedIterable list(String vaultName, S /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -294,9 +292,7 @@ private Mono> listNextSinglePag /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsClientImpl.java index 6672a093c3576..48466fc0b40d3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsClientImpl.java @@ -4,12 +4,14 @@ package com.azure.resourcemanager.recoveryservicesbackup.implementation; +import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; @@ -28,6 +30,7 @@ import com.azure.resourcemanager.recoveryservicesbackup.fluent.RecoveryPointsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.RecoveryPointResourceInner; import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointResourceList; +import com.azure.resourcemanager.recoveryservicesbackup.models.UpdateRecoveryPointRequest; import reactor.core.publisher.Mono; /** @@ -85,6 +88,19 @@ Mono> get(@HostParam("$host") String endpoi @PathParam("recoveryPointId") String recoveryPointId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("fabricName") String fabricName, @PathParam("containerName") String containerName, + @PathParam("protectedItemName") String protectedItemName, + @PathParam("recoveryPointId") String recoveryPointId, + @BodyParam("application/json") UpdateRecoveryPointRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -491,11 +507,199 @@ public RecoveryPointResourceInner get(String vaultName, String resourceGroupName } /** - * Get the next page of items. + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. * - * @param nextLink The URL to get the next list of items + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String vaultName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, + UpdateRecoveryPointRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (fabricName == null) { + return Mono.error(new IllegalArgumentException("Parameter fabricName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (protectedItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter protectedItemName is required and cannot be null.")); + } + if (recoveryPointId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recoveryPointId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, fabricName, containerName, + protectedItemName, recoveryPointId, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. * - * The nextLink parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String vaultName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, + UpdateRecoveryPointRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (fabricName == null) { + return Mono.error(new IllegalArgumentException("Parameter fabricName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (protectedItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter protectedItemName is required and cannot be null.")); + } + if (recoveryPointId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recoveryPointId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, fabricName, containerName, protectedItemName, recoveryPointId, parameters, + accept, context); + } + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String vaultName, String fabricName, + String containerName, String protectedItemName, String recoveryPointId, UpdateRecoveryPointRequest parameters) { + return updateWithResponseAsync(resourceGroupName, vaultName, fabricName, containerName, protectedItemName, + recoveryPointId, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String vaultName, + String fabricName, String containerName, String protectedItemName, String recoveryPointId, + UpdateRecoveryPointRequest parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, vaultName, fabricName, containerName, protectedItemName, + recoveryPointId, parameters, context).block(); + } + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoveryPointResourceInner update(String resourceGroupName, String vaultName, String fabricName, + String containerName, String protectedItemName, String recoveryPointId, UpdateRecoveryPointRequest parameters) { + return updateWithResponse(resourceGroupName, vaultName, fabricName, containerName, protectedItemName, + recoveryPointId, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -521,9 +725,7 @@ private Mono> listNextSinglePageAsync( /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsImpl.java index b06e1487ecbaf..c248842702b31 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsImpl.java @@ -13,6 +13,7 @@ import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.RecoveryPointResourceInner; import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointResource; import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPoints; +import com.azure.resourcemanager.recoveryservicesbackup.models.UpdateRecoveryPointRequest; public final class RecoveryPointsImpl implements RecoveryPoints { private static final ClientLogger LOGGER = new ClientLogger(RecoveryPointsImpl.class); @@ -65,6 +66,32 @@ public RecoveryPointResource get(String vaultName, String resourceGroupName, Str } } + public Response updateWithResponse(String resourceGroupName, String vaultName, + String fabricName, String containerName, String protectedItemName, String recoveryPointId, + UpdateRecoveryPointRequest parameters, Context context) { + Response inner = this.serviceClient() + .updateWithResponse(resourceGroupName, vaultName, fabricName, containerName, protectedItemName, + recoveryPointId, parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RecoveryPointResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RecoveryPointResource update(String resourceGroupName, String vaultName, String fabricName, + String containerName, String protectedItemName, String recoveryPointId, UpdateRecoveryPointRequest parameters) { + RecoveryPointResourceInner inner = this.serviceClient() + .update(resourceGroupName, vaultName, fabricName, containerName, protectedItemName, recoveryPointId, + parameters); + if (inner != null) { + return new RecoveryPointResourceImpl(inner, this.manager()); + } else { + return null; + } + } + private RecoveryPointsClient serviceClient() { return this.innerClient; } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsRecommendedForMovesClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsRecommendedForMovesClientImpl.java index 1c5b37108a63c..b4e6600191674 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsRecommendedForMovesClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryPointsRecommendedForMovesClientImpl.java @@ -295,9 +295,7 @@ public PagedIterable list(String vaultName, String r /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -323,9 +321,7 @@ private Mono> listNextSinglePageAsync( /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryServicesBackupClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryServicesBackupClientImpl.java index f10da8170d090..866bfd3260904 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryServicesBackupClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/RecoveryServicesBackupClientImpl.java @@ -13,8 +13,8 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.exception.ManagementError; import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollerFactory; import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -35,10 +35,10 @@ import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupResourceEncryptionConfigsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupResourceStorageConfigsNonCrrsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupResourceVaultConfigsClient; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupStatusClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupUsageSummariesClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupWorkloadItemsClient; +import com.azure.resourcemanager.recoveryservicesbackup.fluent.BackupsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.BmsPrepareDataMoveOperationResultsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.DeletedProtectionContainersClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.ExportJobsOperationResultsClient; @@ -75,8 +75,8 @@ import com.azure.resourcemanager.recoveryservicesbackup.fluent.SecurityPINsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.TieringCostOperationStatusClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.ValidateOperationResultsClient; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.ValidateOperationsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.ValidateOperationStatusesClient; +import com.azure.resourcemanager.recoveryservicesbackup.fluent.ValidateOperationsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -934,7 +934,7 @@ public TieringCostOperationStatusClient getTieringCostOperationStatus() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2024-04-01"; + this.apiVersion = "2024-11-01-preview"; this.backupResourceStorageConfigsNonCrrs = new BackupResourceStorageConfigsNonCrrsClientImpl(this); this.protectionIntents = new ProtectionIntentsClientImpl(this); this.backupStatus = new BackupStatusClientImpl(this); diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ResourceGuardProxiesClientImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ResourceGuardProxiesClientImpl.java index 2709a5532fe9f..ad4b0ad547142 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ResourceGuardProxiesClientImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/ResourceGuardProxiesClientImpl.java @@ -226,9 +226,7 @@ public PagedIterable get(String vaultName, /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -254,9 +252,7 @@ private Mono> getNextSinglePa /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/SecurityPINsImpl.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/SecurityPINsImpl.java index c5a3dd3497251..4d5454cd8a616 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/SecurityPINsImpl.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/implementation/SecurityPINsImpl.java @@ -10,8 +10,8 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.recoveryservicesbackup.fluent.SecurityPINsClient; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.TokenInformationInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.SecurityPinBase; import com.azure.resourcemanager.recoveryservicesbackup.models.SecurityPINs; +import com.azure.resourcemanager.recoveryservicesbackup.models.SecurityPinBase; import com.azure.resourcemanager.recoveryservicesbackup.models.TokenInformation; public final class SecurityPINsImpl implements SecurityPINs { diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AcquireStorageAccountLock.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AcquireStorageAccountLock.java index e10e9f03ee772..5535b1c923a5a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AcquireStorageAccountLock.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AcquireStorageAccountLock.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public AcquireStorageAccountLock() { * @param name a name to look for. * @return the corresponding AcquireStorageAccountLock. */ - @JsonCreator public static AcquireStorageAccountLock fromString(String name) { return fromString(name, AcquireStorageAccountLock.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupGoalFeatureSupportRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupGoalFeatureSupportRequest.java index 392eae08aa045..89277d08d986d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupGoalFeatureSupportRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupGoalFeatureSupportRequest.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure backup goal feature specific request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "featureType", - defaultImpl = AzureBackupGoalFeatureSupportRequest.class, - visible = true) -@JsonTypeName("AzureBackupGoals") @Immutable public final class AzureBackupGoalFeatureSupportRequest extends FeatureSupportRequest { /* * backup support feature type. */ - @JsonTypeId - @JsonProperty(value = "featureType", required = true) private String featureType = "AzureBackupGoals"; /** @@ -51,6 +43,42 @@ public String featureType() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("featureType", this.featureType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureBackupGoalFeatureSupportRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureBackupGoalFeatureSupportRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureBackupGoalFeatureSupportRequest. + */ + public static AzureBackupGoalFeatureSupportRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureBackupGoalFeatureSupportRequest deserializedAzureBackupGoalFeatureSupportRequest + = new AzureBackupGoalFeatureSupportRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("featureType".equals(fieldName)) { + deserializedAzureBackupGoalFeatureSupportRequest.featureType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureBackupGoalFeatureSupportRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerContainer.java index 60801edbdc9f5..847d26f6cb17a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerContainer.java @@ -5,31 +5,24 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * AzureBackupServer (DPMVenus) workload-specific protection container. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureBackupServerContainer.class, - visible = true) -@JsonTypeName("AzureBackupServerContainer") @Fluent public final class AzureBackupServerContainer extends DpmContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.AZURE_BACKUP_SERVER_CONTAINER; /** @@ -176,6 +169,90 @@ public AzureBackupServerContainer withProtectableObjectType(String protectableOb */ @Override public void validate() { - super.validate(); + if (extendedInfo() != null) { + extendedInfo().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeBooleanField("canReRegister", canReRegister()); + jsonWriter.writeStringField("containerId", containerId()); + jsonWriter.writeNumberField("protectedItemCount", protectedItemCount()); + jsonWriter.writeStringField("dpmAgentVersion", dpmAgentVersion()); + jsonWriter.writeArrayField("dpmServers", dpmServers(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("upgradeAvailable", upgradeAvailable()); + jsonWriter.writeStringField("protectionStatus", protectionStatus()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureBackupServerContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureBackupServerContainer if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureBackupServerContainer. + */ + public static AzureBackupServerContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureBackupServerContainer deserializedAzureBackupServerContainer = new AzureBackupServerContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureBackupServerContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureBackupServerContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureBackupServerContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureBackupServerContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureBackupServerContainer.withProtectableObjectType(reader.getString()); + } else if ("canReRegister".equals(fieldName)) { + deserializedAzureBackupServerContainer + .withCanReRegister(reader.getNullable(JsonReader::getBoolean)); + } else if ("containerId".equals(fieldName)) { + deserializedAzureBackupServerContainer.withContainerId(reader.getString()); + } else if ("protectedItemCount".equals(fieldName)) { + deserializedAzureBackupServerContainer + .withProtectedItemCount(reader.getNullable(JsonReader::getLong)); + } else if ("dpmAgentVersion".equals(fieldName)) { + deserializedAzureBackupServerContainer.withDpmAgentVersion(reader.getString()); + } else if ("dpmServers".equals(fieldName)) { + List dpmServers = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureBackupServerContainer.withDpmServers(dpmServers); + } else if ("upgradeAvailable".equals(fieldName)) { + deserializedAzureBackupServerContainer + .withUpgradeAvailable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureBackupServerContainer.withProtectionStatus(reader.getString()); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureBackupServerContainer.withExtendedInfo(DpmContainerExtendedInfo.fromJson(reader)); + } else if ("containerType".equals(fieldName)) { + deserializedAzureBackupServerContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureBackupServerContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerEngine.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerEngine.java index b001b526c0270..a6794b436efe6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerEngine.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureBackupServerEngine.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Backup engine type when Azure Backup Server is used to manage the backups. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupEngineType", - defaultImpl = AzureBackupServerEngine.class, - visible = true) -@JsonTypeName("AzureBackupServerEngine") @Fluent public final class AzureBackupServerEngine extends BackupEngineBase { /* * Type of the backup engine. */ - @JsonTypeId - @JsonProperty(value = "backupEngineType", required = true) private BackupEngineType backupEngineType = BackupEngineType.AZURE_BACKUP_SERVER_ENGINE; /** @@ -159,6 +151,86 @@ public AzureBackupServerEngine withExtendedInfo(BackupEngineExtendedInfo extende */ @Override public void validate() { - super.validate(); + if (extendedInfo() != null) { + extendedInfo().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("backupEngineState", backupEngineState()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeBooleanField("canReRegister", canReRegister()); + jsonWriter.writeStringField("backupEngineId", backupEngineId()); + jsonWriter.writeStringField("dpmVersion", dpmVersion()); + jsonWriter.writeStringField("azureBackupAgentVersion", azureBackupAgentVersion()); + jsonWriter.writeBooleanField("isAzureBackupAgentUpgradeAvailable", isAzureBackupAgentUpgradeAvailable()); + jsonWriter.writeBooleanField("isDpmUpgradeAvailable", isDpmUpgradeAvailable()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeStringField("backupEngineType", + this.backupEngineType == null ? null : this.backupEngineType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureBackupServerEngine from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureBackupServerEngine if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureBackupServerEngine. + */ + public static AzureBackupServerEngine fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureBackupServerEngine deserializedAzureBackupServerEngine = new AzureBackupServerEngine(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureBackupServerEngine.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureBackupServerEngine + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureBackupServerEngine.withRegistrationStatus(reader.getString()); + } else if ("backupEngineState".equals(fieldName)) { + deserializedAzureBackupServerEngine.withBackupEngineState(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureBackupServerEngine.withHealthStatus(reader.getString()); + } else if ("canReRegister".equals(fieldName)) { + deserializedAzureBackupServerEngine.withCanReRegister(reader.getNullable(JsonReader::getBoolean)); + } else if ("backupEngineId".equals(fieldName)) { + deserializedAzureBackupServerEngine.withBackupEngineId(reader.getString()); + } else if ("dpmVersion".equals(fieldName)) { + deserializedAzureBackupServerEngine.withDpmVersion(reader.getString()); + } else if ("azureBackupAgentVersion".equals(fieldName)) { + deserializedAzureBackupServerEngine.withAzureBackupAgentVersion(reader.getString()); + } else if ("isAzureBackupAgentUpgradeAvailable".equals(fieldName)) { + deserializedAzureBackupServerEngine + .withIsAzureBackupAgentUpgradeAvailable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isDpmUpgradeAvailable".equals(fieldName)) { + deserializedAzureBackupServerEngine + .withIsDpmUpgradeAvailable(reader.getNullable(JsonReader::getBoolean)); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureBackupServerEngine.withExtendedInfo(BackupEngineExtendedInfo.fromJson(reader)); + } else if ("backupEngineType".equals(fieldName)) { + deserializedAzureBackupServerEngine.backupEngineType + = BackupEngineType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureBackupServerEngine; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareBackupRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareBackupRequest.java index 5d676bd18d326..9cdbc7799bd06 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareBackupRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareBackupRequest.java @@ -5,34 +5,28 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * AzureFileShare workload-specific backup request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureFileShareBackupRequest.class, - visible = true) -@JsonTypeName("AzureFileShareBackupRequest") @Fluent public final class AzureFileShareBackupRequest extends BackupRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureFileShareBackupRequest"; /* * Backup copy will expire after the time specified (UTC). */ - @JsonProperty(value = "recoveryPointExpiryTimeInUTC") private OffsetDateTime recoveryPointExpiryTimeInUtc; /** @@ -79,6 +73,48 @@ public AzureFileShareBackupRequest withRecoveryPointExpiryTimeInUtc(OffsetDateTi */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointExpiryTimeInUTC", + this.recoveryPointExpiryTimeInUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.recoveryPointExpiryTimeInUtc)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileShareBackupRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileShareBackupRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileShareBackupRequest. + */ + public static AzureFileShareBackupRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileShareBackupRequest deserializedAzureFileShareBackupRequest = new AzureFileShareBackupRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedAzureFileShareBackupRequest.objectType = reader.getString(); + } else if ("recoveryPointExpiryTimeInUTC".equals(fieldName)) { + deserializedAzureFileShareBackupRequest.recoveryPointExpiryTimeInUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileShareBackupRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectableItem.java index 4a03d2beeeb88..888c7559786f4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectableItem.java @@ -5,45 +5,34 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Protectable item for Azure Fileshare workloads. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureFileShareProtectableItem.class, - visible = true) -@JsonTypeName("AzureFileShare") @Fluent public final class AzureFileShareProtectableItem extends WorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "AzureFileShare"; /* * Full Fabric ID of container to which this protectable item belongs. For example, ARM ID. */ - @JsonProperty(value = "parentContainerFabricId") private String parentContainerFabricId; /* * Friendly name of container to which this protectable item belongs. */ - @JsonProperty(value = "parentContainerFriendlyName") private String parentContainerFriendlyName; /* * File Share type XSync or XSMB. */ - @JsonProperty(value = "azureFileShareType") private AzureFileShareType azureFileShareType; /** @@ -167,6 +156,66 @@ public AzureFileShareProtectableItem withProtectionState(ProtectionStatus protec */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + jsonWriter.writeStringField("parentContainerFabricId", this.parentContainerFabricId); + jsonWriter.writeStringField("parentContainerFriendlyName", this.parentContainerFriendlyName); + jsonWriter.writeStringField("azureFileShareType", + this.azureFileShareType == null ? null : this.azureFileShareType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileShareProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileShareProtectableItem if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileShareProtectableItem. + */ + public static AzureFileShareProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileShareProtectableItem deserializedAzureFileShareProtectableItem + = new AzureFileShareProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureFileShareProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureFileShareProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureFileShareProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureFileShareProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureFileShareProtectableItem.protectableItemType = reader.getString(); + } else if ("parentContainerFabricId".equals(fieldName)) { + deserializedAzureFileShareProtectableItem.parentContainerFabricId = reader.getString(); + } else if ("parentContainerFriendlyName".equals(fieldName)) { + deserializedAzureFileShareProtectableItem.parentContainerFriendlyName = reader.getString(); + } else if ("azureFileShareType".equals(fieldName)) { + deserializedAzureFileShareProtectableItem.azureFileShareType + = AzureFileShareType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileShareProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectionPolicy.java index 62af4d6cf61c8..55da8cd04cc51 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProtectionPolicy.java @@ -5,58 +5,46 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * AzureStorage backup policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupManagementType", - defaultImpl = AzureFileShareProtectionPolicy.class, - visible = true) -@JsonTypeName("AzureStorage") @Fluent public final class AzureFileShareProtectionPolicy extends ProtectionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "backupManagementType", required = true) private String backupManagementType = "AzureStorage"; /* * Type of workload for the backup management */ - @JsonProperty(value = "workLoadType") private WorkloadType workLoadType; /* * Backup schedule specified as part of backup policy. */ - @JsonProperty(value = "schedulePolicy") private SchedulePolicy schedulePolicy; /* * Retention policy with the details on backup copy retention ranges. */ - @JsonProperty(value = "retentionPolicy") private RetentionPolicy retentionPolicy; /* * Retention policy with the details on hardened backup copy retention ranges. */ - @JsonProperty(value = "vaultRetentionPolicy") private VaultRetentionPolicy vaultRetentionPolicy; /* * TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". */ - @JsonProperty(value = "timeZone") private String timeZone; /** @@ -204,7 +192,6 @@ public AzureFileShareProtectionPolicy withProtectedItemsCount(Integer protectedI */ @Override public void validate() { - super.validate(); if (schedulePolicy() != null) { schedulePolicy().validate(); } @@ -215,4 +202,68 @@ public void validate() { vaultRetentionPolicy().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("protectedItemsCount", protectedItemsCount()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeStringField("workLoadType", this.workLoadType == null ? null : this.workLoadType.toString()); + jsonWriter.writeJsonField("schedulePolicy", this.schedulePolicy); + jsonWriter.writeJsonField("retentionPolicy", this.retentionPolicy); + jsonWriter.writeJsonField("vaultRetentionPolicy", this.vaultRetentionPolicy); + jsonWriter.writeStringField("timeZone", this.timeZone); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileShareProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileShareProtectionPolicy if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileShareProtectionPolicy. + */ + public static AzureFileShareProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileShareProtectionPolicy deserializedAzureFileShareProtectionPolicy + = new AzureFileShareProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectedItemsCount".equals(fieldName)) { + deserializedAzureFileShareProtectionPolicy + .withProtectedItemsCount(reader.getNullable(JsonReader::getInt)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureFileShareProtectionPolicy + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureFileShareProtectionPolicy.backupManagementType = reader.getString(); + } else if ("workLoadType".equals(fieldName)) { + deserializedAzureFileShareProtectionPolicy.workLoadType + = WorkloadType.fromString(reader.getString()); + } else if ("schedulePolicy".equals(fieldName)) { + deserializedAzureFileShareProtectionPolicy.schedulePolicy = SchedulePolicy.fromJson(reader); + } else if ("retentionPolicy".equals(fieldName)) { + deserializedAzureFileShareProtectionPolicy.retentionPolicy = RetentionPolicy.fromJson(reader); + } else if ("vaultRetentionPolicy".equals(fieldName)) { + deserializedAzureFileShareProtectionPolicy.vaultRetentionPolicy + = VaultRetentionPolicy.fromJson(reader); + } else if ("timeZone".equals(fieldName)) { + deserializedAzureFileShareProtectionPolicy.timeZone = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileShareProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProvisionIlrRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProvisionIlrRequest.java index 3dd5899e7d1fc..f0e12fb44def5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProvisionIlrRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareProvisionIlrRequest.java @@ -5,39 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Update snapshot Uri with the correct friendly Name of the source Azure file share. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureFileShareProvisionIlrRequest.class, - visible = true) -@JsonTypeName("AzureFileShareProvisionILRRequest") @Fluent public final class AzureFileShareProvisionIlrRequest extends IlrRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureFileShareProvisionILRRequest"; /* * Recovery point ID. */ - @JsonProperty(value = "recoveryPointId") private String recoveryPointId; /* * Source Storage account ARM Id */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /** @@ -104,6 +95,48 @@ public AzureFileShareProvisionIlrRequest withSourceResourceId(String sourceResou */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointId", this.recoveryPointId); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileShareProvisionIlrRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileShareProvisionIlrRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileShareProvisionIlrRequest. + */ + public static AzureFileShareProvisionIlrRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileShareProvisionIlrRequest deserializedAzureFileShareProvisionIlrRequest + = new AzureFileShareProvisionIlrRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedAzureFileShareProvisionIlrRequest.objectType = reader.getString(); + } else if ("recoveryPointId".equals(fieldName)) { + deserializedAzureFileShareProvisionIlrRequest.recoveryPointId = reader.getString(); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureFileShareProvisionIlrRequest.sourceResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileShareProvisionIlrRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRecoveryPoint.java index f04bc4ced19ee..a7ea3039f51d9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRecoveryPoint.java @@ -5,58 +5,48 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Azure File Share workload specific backup copy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureFileShareRecoveryPoint.class, - visible = true) -@JsonTypeName("AzureFileShareRecoveryPoint") @Fluent public final class AzureFileShareRecoveryPoint extends RecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureFileShareRecoveryPoint"; /* * Type of the backup copy. Specifies whether it is a crash consistent backup or app consistent. */ - @JsonProperty(value = "recoveryPointType") private String recoveryPointType; /* * Time at which this backup copy was created. */ - @JsonProperty(value = "recoveryPointTime") private OffsetDateTime recoveryPointTime; /* * Contains Url to the snapshot of fileshare, if applicable */ - @JsonProperty(value = "fileShareSnapshotUri") private String fileShareSnapshotUri; /* * Contains recovery point size */ - @JsonProperty(value = "recoveryPointSizeInGB") private Integer recoveryPointSizeInGB; /* * Properties of Recovery Point */ - @JsonProperty(value = "recoveryPointProperties") private RecoveryPointProperties recoveryPointProperties; /** @@ -185,9 +175,65 @@ public AzureFileShareRecoveryPoint withRecoveryPointProperties(RecoveryPointProp */ @Override public void validate() { - super.validate(); if (recoveryPointProperties() != null) { recoveryPointProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointType", this.recoveryPointType); + jsonWriter.writeStringField("recoveryPointTime", + this.recoveryPointTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.recoveryPointTime)); + jsonWriter.writeStringField("fileShareSnapshotUri", this.fileShareSnapshotUri); + jsonWriter.writeNumberField("recoveryPointSizeInGB", this.recoveryPointSizeInGB); + jsonWriter.writeJsonField("recoveryPointProperties", this.recoveryPointProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileShareRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileShareRecoveryPoint if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileShareRecoveryPoint. + */ + public static AzureFileShareRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileShareRecoveryPoint deserializedAzureFileShareRecoveryPoint = new AzureFileShareRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedAzureFileShareRecoveryPoint.objectType = reader.getString(); + } else if ("recoveryPointType".equals(fieldName)) { + deserializedAzureFileShareRecoveryPoint.recoveryPointType = reader.getString(); + } else if ("recoveryPointTime".equals(fieldName)) { + deserializedAzureFileShareRecoveryPoint.recoveryPointTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("fileShareSnapshotUri".equals(fieldName)) { + deserializedAzureFileShareRecoveryPoint.fileShareSnapshotUri = reader.getString(); + } else if ("recoveryPointSizeInGB".equals(fieldName)) { + deserializedAzureFileShareRecoveryPoint.recoveryPointSizeInGB + = reader.getNullable(JsonReader::getInt); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureFileShareRecoveryPoint.recoveryPointProperties + = RecoveryPointProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileShareRecoveryPoint; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRestoreRequest.java index 2939c0cb7cb5e..ddce613894f64 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareRestoreRequest.java @@ -5,64 +5,51 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * AzureFileShare Restore Request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureFileShareRestoreRequest.class, - visible = true) -@JsonTypeName("AzureFileShareRestoreRequest") @Fluent public final class AzureFileShareRestoreRequest extends RestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureFileShareRestoreRequest"; /* * Type of this recovery. */ - @JsonProperty(value = "recoveryType") private RecoveryType recoveryType; /* * Source storage account ARM Id */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /* * Options to resolve copy conflicts. */ - @JsonProperty(value = "copyOptions") private CopyOptions copyOptions; /* * Restore Type (FullShareRestore or ItemLevelRestore) */ - @JsonProperty(value = "restoreRequestType") private RestoreRequestType restoreRequestType; /* * List of Source Files/Folders(which need to recover) and TargetFolderPath details */ - @JsonProperty(value = "restoreFileSpecs") private List restoreFileSpecs; /* * Target File Share Details */ - @JsonProperty(value = "targetDetails") private TargetAfsRestoreInfo targetDetails; /** @@ -221,7 +208,6 @@ public AzureFileShareRestoreRequest withTargetDetails(TargetAfsRestoreInfo targe */ @Override public void validate() { - super.validate(); if (restoreFileSpecs() != null) { restoreFileSpecs().forEach(e -> e.validate()); } @@ -229,4 +215,69 @@ public void validate() { targetDetails().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryType", this.recoveryType == null ? null : this.recoveryType.toString()); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("copyOptions", this.copyOptions == null ? null : this.copyOptions.toString()); + jsonWriter.writeStringField("restoreRequestType", + this.restoreRequestType == null ? null : this.restoreRequestType.toString()); + jsonWriter.writeArrayField("restoreFileSpecs", this.restoreFileSpecs, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("targetDetails", this.targetDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileShareRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileShareRestoreRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileShareRestoreRequest. + */ + public static AzureFileShareRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileShareRestoreRequest deserializedAzureFileShareRestoreRequest = new AzureFileShareRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureFileShareRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("objectType".equals(fieldName)) { + deserializedAzureFileShareRestoreRequest.objectType = reader.getString(); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureFileShareRestoreRequest.recoveryType = RecoveryType.fromString(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureFileShareRestoreRequest.sourceResourceId = reader.getString(); + } else if ("copyOptions".equals(fieldName)) { + deserializedAzureFileShareRestoreRequest.copyOptions = CopyOptions.fromString(reader.getString()); + } else if ("restoreRequestType".equals(fieldName)) { + deserializedAzureFileShareRestoreRequest.restoreRequestType + = RestoreRequestType.fromString(reader.getString()); + } else if ("restoreFileSpecs".equals(fieldName)) { + List restoreFileSpecs + = reader.readArray(reader1 -> RestoreFileSpecs.fromJson(reader1)); + deserializedAzureFileShareRestoreRequest.restoreFileSpecs = restoreFileSpecs; + } else if ("targetDetails".equals(fieldName)) { + deserializedAzureFileShareRestoreRequest.targetDetails = TargetAfsRestoreInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileShareRestoreRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareType.java index 3affa358ba884..86ad2c77b94a5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileShareType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public AzureFileShareType() { * @param name a name to look for. * @return the corresponding AzureFileShareType. */ - @JsonCreator public static AzureFileShareType fromString(String name) { return fromString(name, AzureFileShareType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItem.java index 64d9d382ee74e..aacc79c0dc3f0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItem.java @@ -5,76 +5,76 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Azure File Share workload-specific backup item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureFileshareProtectedItem.class, - visible = true) -@JsonTypeName("AzureFileShareProtectedItem") @Fluent public final class AzureFileshareProtectedItem extends ProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "AzureFileShareProtectedItem"; /* * Friendly name of the fileshare represented by this backup item. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Backup status of this backup item. */ - @JsonProperty(value = "protectionStatus") private String protectionStatus; /* * Backup state of this backup item. */ - @JsonProperty(value = "protectionState") private ProtectionState protectionState; /* * Last backup operation status. Possible values: Healthy, Unhealthy. */ - @JsonProperty(value = "lastBackupStatus") private String lastBackupStatus; /* * Timestamp of the last backup operation on this backup item. */ - @JsonProperty(value = "lastBackupTime") private OffsetDateTime lastBackupTime; /* * Health details of different KPIs */ - @JsonProperty(value = "kpisHealths") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map kpisHealths; /* * Additional information with this backup item. */ - @JsonProperty(value = "extendedInfo") private AzureFileshareProtectedItemExtendedInfo extendedInfo; + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureFileshareProtectedItem class. */ @@ -231,6 +231,36 @@ public AzureFileshareProtectedItem withExtendedInfo(AzureFileshareProtectedItemE return this; } + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -373,7 +403,6 @@ public AzureFileshareProtectedItem withSoftDeleteRetentionPeriod(Integer softDel */ @Override public void validate() { - super.validate(); if (kpisHealths() != null) { kpisHealths().values().forEach(e -> { if (e != null) { @@ -385,4 +414,134 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("protectionStatus", this.protectionStatus); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + jsonWriter.writeStringField("lastBackupStatus", this.lastBackupStatus); + jsonWriter.writeStringField("lastBackupTime", + this.lastBackupTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastBackupTime)); + jsonWriter.writeMapField("kpisHealths", this.kpisHealths, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileshareProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileshareProtectedItem if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileshareProtectedItem. + */ + public static AzureFileshareProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileshareProtectedItem deserializedAzureFileshareProtectedItem = new AzureFileshareProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureFileshareProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureFileshareProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureFileshareProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureFileshareProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureFileshareProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.vaultId = reader.getString(); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.protectedItemType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.friendlyName = reader.getString(); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.protectionState + = ProtectionState.fromString(reader.getString()); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.lastBackupStatus = reader.getString(); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.lastBackupTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureFileshareProtectedItem.kpisHealths = kpisHealths; + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureFileshareProtectedItem.extendedInfo + = AzureFileshareProtectedItemExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileshareProtectedItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItemExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItemExtendedInfo.java index 302cc87f22c98..f5af485f3ddad 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItemExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureFileshareProtectedItemExtendedInfo.java @@ -5,42 +5,45 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Additional information about Azure File Share backup item. */ @Fluent -public final class AzureFileshareProtectedItemExtendedInfo { +public final class AzureFileshareProtectedItemExtendedInfo + implements JsonSerializable { /* * The oldest backup copy available for this item in the service. */ - @JsonProperty(value = "oldestRecoveryPoint") private OffsetDateTime oldestRecoveryPoint; /* * Number of available backup copies associated with this backup item. */ - @JsonProperty(value = "recoveryPointCount") private Integer recoveryPointCount; /* * Indicates consistency of policy object and policy applied to this backup item. */ - @JsonProperty(value = "policyState") private String policyState; /* - * Indicates the state of this resource. Possible values are from enum ResourceState {Invalid, Active, SoftDeleted, Deleted} + * Indicates the state of this resource. Possible values are from enum ResourceState {Invalid, Active, SoftDeleted, + * Deleted} */ - @JsonProperty(value = "resourceState", access = JsonProperty.Access.WRITE_ONLY) private String resourceState; /* * The resource state sync time for this backup item. */ - @JsonProperty(value = "resourceStateSyncTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime resourceStateSyncTime; /** @@ -135,4 +138,57 @@ public OffsetDateTime resourceStateSyncTime() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("oldestRecoveryPoint", + this.oldestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPoint)); + jsonWriter.writeNumberField("recoveryPointCount", this.recoveryPointCount); + jsonWriter.writeStringField("policyState", this.policyState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureFileshareProtectedItemExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureFileshareProtectedItemExtendedInfo if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureFileshareProtectedItemExtendedInfo. + */ + public static AzureFileshareProtectedItemExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureFileshareProtectedItemExtendedInfo deserializedAzureFileshareProtectedItemExtendedInfo + = new AzureFileshareProtectedItemExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("oldestRecoveryPoint".equals(fieldName)) { + deserializedAzureFileshareProtectedItemExtendedInfo.oldestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointCount".equals(fieldName)) { + deserializedAzureFileshareProtectedItemExtendedInfo.recoveryPointCount + = reader.getNullable(JsonReader::getInt); + } else if ("policyState".equals(fieldName)) { + deserializedAzureFileshareProtectedItemExtendedInfo.policyState = reader.getString(); + } else if ("resourceState".equals(fieldName)) { + deserializedAzureFileshareProtectedItemExtendedInfo.resourceState = reader.getString(); + } else if ("resourceStateSyncTime".equals(fieldName)) { + deserializedAzureFileshareProtectedItemExtendedInfo.resourceStateSyncTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureFileshareProtectedItemExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMContainer.java index fe6f1056d95c5..cdcfff9d13658 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMContainer.java @@ -5,30 +5,23 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM workload-specific backup item representing a classic virtual machine. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureIaaSClassicComputeVMContainer.class, - visible = true) -@JsonTypeName("Microsoft.ClassicCompute/virtualMachines") @Fluent public final class AzureIaaSClassicComputeVMContainer extends IaaSvmContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.MICROSOFT_CLASSIC_COMPUTE_VIRTUAL_MACHINES; @@ -131,6 +124,69 @@ public AzureIaaSClassicComputeVMContainer withProtectableObjectType(String prote */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("virtualMachineId", virtualMachineId()); + jsonWriter.writeStringField("virtualMachineVersion", virtualMachineVersion()); + jsonWriter.writeStringField("resourceGroup", resourceGroup()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSClassicComputeVMContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSClassicComputeVMContainer if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSClassicComputeVMContainer. + */ + public static AzureIaaSClassicComputeVMContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSClassicComputeVMContainer deserializedAzureIaaSClassicComputeVMContainer + = new AzureIaaSClassicComputeVMContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.withProtectableObjectType(reader.getString()); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.withVirtualMachineId(reader.getString()); + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.withVirtualMachineVersion(reader.getString()); + } else if ("resourceGroup".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.withResourceGroup(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSClassicComputeVMContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectableItem.java index 0ac9865dcda6c..761ff962e775f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectableItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM workload-specific backup item representing the Classic Compute VM. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureIaaSClassicComputeVMProtectableItem.class, - visible = true) -@JsonTypeName("Microsoft.ClassicCompute/virtualMachines") @Fluent public final class AzureIaaSClassicComputeVMProtectableItem extends IaaSvmProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "Microsoft.ClassicCompute/virtualMachines"; /** @@ -114,6 +106,64 @@ public AzureIaaSClassicComputeVMProtectableItem withProtectionState(ProtectionSt */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("virtualMachineId", virtualMachineId()); + jsonWriter.writeStringField("virtualMachineVersion", virtualMachineVersion()); + jsonWriter.writeStringField("resourceGroup", resourceGroup()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSClassicComputeVMProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSClassicComputeVMProtectableItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSClassicComputeVMProtectableItem. + */ + public static AzureIaaSClassicComputeVMProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSClassicComputeVMProtectableItem deserializedAzureIaaSClassicComputeVMProtectableItem + = new AzureIaaSClassicComputeVMProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem.withVirtualMachineId(reader.getString()); + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem.withVirtualMachineVersion(reader.getString()); + } else if ("resourceGroup".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem.withResourceGroup(reader.getString()); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSClassicComputeVMProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectedItem.java index c6505e5657222..56ebe907da91a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSClassicComputeVMProtectedItem.java @@ -5,32 +5,66 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * IaaS VM workload-specific backup item representing the Classic Compute VM. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureIaaSClassicComputeVMProtectedItem.class, - visible = true) -@JsonTypeName("Microsoft.ClassicCompute/virtualMachines") @Fluent public final class AzureIaaSClassicComputeVMProtectedItem extends AzureIaaSvmProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "Microsoft.ClassicCompute/virtualMachines"; + /* + * Data ID of the protected item. + */ + private String protectedItemDataId; + + /* + * Timestamp of the last backup operation on this backup item. + */ + private OffsetDateTime lastBackupTime; + + /* + * Health status of protected item. + */ + private HealthStatus healthStatus; + + /* + * Fully qualified ARM ID of the virtual machine represented by this item. + */ + private String virtualMachineId; + + /* + * Friendly name of the VM represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureIaaSClassicComputeVMProtectedItem class. */ @@ -47,6 +81,86 @@ public String protectedItemType() { return this.protectedItemType; } + /** + * Get the protectedItemDataId property: Data ID of the protected item. + * + * @return the protectedItemDataId value. + */ + @Override + public String protectedItemDataId() { + return this.protectedItemDataId; + } + + /** + * Get the lastBackupTime property: Timestamp of the last backup operation on this backup item. + * + * @return the lastBackupTime value. + */ + @Override + public OffsetDateTime lastBackupTime() { + return this.lastBackupTime; + } + + /** + * Get the healthStatus property: Health status of protected item. + * + * @return the healthStatus value. + */ + @Override + public HealthStatus healthStatus() { + return this.healthStatus; + } + + /** + * Get the virtualMachineId property: Fully qualified ARM ID of the virtual machine represented by this item. + * + * @return the virtualMachineId value. + */ + @Override + public String virtualMachineId() { + return this.virtualMachineId; + } + + /** + * Get the friendlyName property: Friendly name of the VM represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -255,6 +369,167 @@ public AzureIaaSClassicComputeVMProtectedItem withSoftDeleteRetentionPeriod(Inte */ @Override public void validate() { - super.validate(); + if (healthDetails() != null) { + healthDetails().forEach(e -> e.validate()); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (extendedProperties() != null) { + extendedProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectionStatus", protectionStatus()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeArrayField("healthDetails", healthDetails(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("lastBackupStatus", lastBackupStatus()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeJsonField("extendedProperties", extendedProperties()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSClassicComputeVMProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSClassicComputeVMProtectedItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSClassicComputeVMProtectedItem. + */ + public static AzureIaaSClassicComputeVMProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSClassicComputeVMProtectedItem deserializedAzureIaaSClassicComputeVMProtectedItem + = new AzureIaaSClassicComputeVMProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureIaaSClassicComputeVMProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.friendlyName = reader.getString(); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.virtualMachineId = reader.getString(); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withProtectionStatus(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.healthStatus + = HealthStatus.fromString(reader.getString()); + } else if ("healthDetails".equals(fieldName)) { + List healthDetails + = reader.readArray(reader1 -> AzureIaaSvmHealthDetails.fromJson(reader1)); + deserializedAzureIaaSClassicComputeVMProtectedItem.withHealthDetails(healthDetails); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureIaaSClassicComputeVMProtectedItem.withKpisHealths(kpisHealths); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withLastBackupStatus(reader.getString()); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.lastBackupTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("protectedItemDataId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.protectedItemDataId = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withExtendedInfo(AzureIaaSvmProtectedItemExtendedInfo.fromJson(reader)); + } else if ("extendedProperties".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withExtendedProperties(ExtendedProperties.fromJson(reader)); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSClassicComputeVMProtectedItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMContainer.java index 01482cc1314d8..e02a05eb69325 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMContainer.java @@ -5,30 +5,23 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM workload-specific backup item representing an Azure Resource Manager virtual machine. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureIaaSComputeVMContainer.class, - visible = true) -@JsonTypeName("Microsoft.Compute/virtualMachines") @Fluent public final class AzureIaaSComputeVMContainer extends IaaSvmContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.MICROSOFT_COMPUTE_VIRTUAL_MACHINES; /** @@ -130,6 +123,68 @@ public AzureIaaSComputeVMContainer withProtectableObjectType(String protectableO */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("virtualMachineId", virtualMachineId()); + jsonWriter.writeStringField("virtualMachineVersion", virtualMachineVersion()); + jsonWriter.writeStringField("resourceGroup", resourceGroup()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSComputeVMContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSComputeVMContainer if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSComputeVMContainer. + */ + public static AzureIaaSComputeVMContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSComputeVMContainer deserializedAzureIaaSComputeVMContainer = new AzureIaaSComputeVMContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.withProtectableObjectType(reader.getString()); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.withVirtualMachineId(reader.getString()); + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.withVirtualMachineVersion(reader.getString()); + } else if ("resourceGroup".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.withResourceGroup(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedAzureIaaSComputeVMContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSComputeVMContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectableItem.java index 63a6e167a2eec..02b61f823bc0d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectableItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM workload-specific backup item representing the Azure Resource Manager VM. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureIaaSComputeVMProtectableItem.class, - visible = true) -@JsonTypeName("Microsoft.Compute/virtualMachines") @Fluent public final class AzureIaaSComputeVMProtectableItem extends IaaSvmProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "Microsoft.Compute/virtualMachines"; /** @@ -114,6 +106,64 @@ public AzureIaaSComputeVMProtectableItem withProtectionState(ProtectionStatus pr */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("virtualMachineId", virtualMachineId()); + jsonWriter.writeStringField("virtualMachineVersion", virtualMachineVersion()); + jsonWriter.writeStringField("resourceGroup", resourceGroup()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSComputeVMProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSComputeVMProtectableItem if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSComputeVMProtectableItem. + */ + public static AzureIaaSComputeVMProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSComputeVMProtectableItem deserializedAzureIaaSComputeVMProtectableItem + = new AzureIaaSComputeVMProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem.withVirtualMachineId(reader.getString()); + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem.withVirtualMachineVersion(reader.getString()); + } else if ("resourceGroup".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem.withResourceGroup(reader.getString()); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSComputeVMProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectedItem.java index 81e6dce20cdbb..eaa513e44f6ab 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSComputeVMProtectedItem.java @@ -5,32 +5,66 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * IaaS VM workload-specific backup item representing the Azure Resource Manager VM. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureIaaSComputeVMProtectedItem.class, - visible = true) -@JsonTypeName("Microsoft.Compute/virtualMachines") @Fluent public final class AzureIaaSComputeVMProtectedItem extends AzureIaaSvmProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "Microsoft.Compute/virtualMachines"; + /* + * Data ID of the protected item. + */ + private String protectedItemDataId; + + /* + * Timestamp of the last backup operation on this backup item. + */ + private OffsetDateTime lastBackupTime; + + /* + * Health status of protected item. + */ + private HealthStatus healthStatus; + + /* + * Fully qualified ARM ID of the virtual machine represented by this item. + */ + private String virtualMachineId; + + /* + * Friendly name of the VM represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureIaaSComputeVMProtectedItem class. */ @@ -47,6 +81,86 @@ public String protectedItemType() { return this.protectedItemType; } + /** + * Get the protectedItemDataId property: Data ID of the protected item. + * + * @return the protectedItemDataId value. + */ + @Override + public String protectedItemDataId() { + return this.protectedItemDataId; + } + + /** + * Get the lastBackupTime property: Timestamp of the last backup operation on this backup item. + * + * @return the lastBackupTime value. + */ + @Override + public OffsetDateTime lastBackupTime() { + return this.lastBackupTime; + } + + /** + * Get the healthStatus property: Health status of protected item. + * + * @return the healthStatus value. + */ + @Override + public HealthStatus healthStatus() { + return this.healthStatus; + } + + /** + * Get the virtualMachineId property: Fully qualified ARM ID of the virtual machine represented by this item. + * + * @return the virtualMachineId value. + */ + @Override + public String virtualMachineId() { + return this.virtualMachineId; + } + + /** + * Get the friendlyName property: Friendly name of the VM represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -254,6 +368,166 @@ public AzureIaaSComputeVMProtectedItem withSoftDeleteRetentionPeriod(Integer sof */ @Override public void validate() { - super.validate(); + if (healthDetails() != null) { + healthDetails().forEach(e -> e.validate()); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (extendedProperties() != null) { + extendedProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectionStatus", protectionStatus()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeArrayField("healthDetails", healthDetails(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("lastBackupStatus", lastBackupStatus()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeJsonField("extendedProperties", extendedProperties()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSComputeVMProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSComputeVMProtectedItem if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSComputeVMProtectedItem. + */ + public static AzureIaaSComputeVMProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSComputeVMProtectedItem deserializedAzureIaaSComputeVMProtectedItem + = new AzureIaaSComputeVMProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureIaaSComputeVMProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.friendlyName = reader.getString(); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.virtualMachineId = reader.getString(); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withProtectionStatus(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.healthStatus + = HealthStatus.fromString(reader.getString()); + } else if ("healthDetails".equals(fieldName)) { + List healthDetails + = reader.readArray(reader1 -> AzureIaaSvmHealthDetails.fromJson(reader1)); + deserializedAzureIaaSComputeVMProtectedItem.withHealthDetails(healthDetails); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureIaaSComputeVMProtectedItem.withKpisHealths(kpisHealths); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withLastBackupStatus(reader.getString()); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.lastBackupTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("protectedItemDataId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.protectedItemDataId = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withExtendedInfo(AzureIaaSvmProtectedItemExtendedInfo.fromJson(reader)); + } else if ("extendedProperties".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withExtendedProperties(ExtendedProperties.fromJson(reader)); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSComputeVMProtectedItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmErrorInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmErrorInfo.java index 42473a57874c6..d368627376b96 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmErrorInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmErrorInfo.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure IaaS VM workload-specific error information. */ @Immutable -public final class AzureIaaSvmErrorInfo { +public final class AzureIaaSvmErrorInfo implements JsonSerializable { /* * Error code. */ - @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) private Integer errorCode; /* * Title: Typically, the entity that the error pertains to. */ - @JsonProperty(value = "errorTitle", access = JsonProperty.Access.WRITE_ONLY) private String errorTitle; /* * Localized error string. */ - @JsonProperty(value = "errorString", access = JsonProperty.Access.WRITE_ONLY) private String errorString; /* * List of localized recommendations for above error code. */ - @JsonProperty(value = "recommendations", access = JsonProperty.Access.WRITE_ONLY) private List recommendations; /** @@ -86,4 +86,46 @@ public List recommendations() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmErrorInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmErrorInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmErrorInfo. + */ + public static AzureIaaSvmErrorInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmErrorInfo deserializedAzureIaaSvmErrorInfo = new AzureIaaSvmErrorInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedAzureIaaSvmErrorInfo.errorCode = reader.getNullable(JsonReader::getInt); + } else if ("errorTitle".equals(fieldName)) { + deserializedAzureIaaSvmErrorInfo.errorTitle = reader.getString(); + } else if ("errorString".equals(fieldName)) { + deserializedAzureIaaSvmErrorInfo.errorString = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureIaaSvmErrorInfo.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmErrorInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmHealthDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmHealthDetails.java index cdbe1c9e502b9..fa8099579a4bf 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmHealthDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmHealthDetails.java @@ -5,18 +5,83 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; /** * Azure IaaS VM workload-specific Health Details. */ @Immutable public final class AzureIaaSvmHealthDetails extends ResourceHealthDetails { + /* + * Health Recommended Actions + */ + private List recommendations; + + /* + * Health Message + */ + private String message; + + /* + * Health Title + */ + private String title; + + /* + * Health Code + */ + private Integer code; + /** * Creates an instance of AzureIaaSvmHealthDetails class. */ public AzureIaaSvmHealthDetails() { } + /** + * Get the recommendations property: Health Recommended Actions. + * + * @return the recommendations value. + */ + @Override + public List recommendations() { + return this.recommendations; + } + + /** + * Get the message property: Health Message. + * + * @return the message value. + */ + @Override + public String message() { + return this.message; + } + + /** + * Get the title property: Health Title. + * + * @return the title value. + */ + @Override + public String title() { + return this.title; + } + + /** + * Get the code property: Health Code. + * + * @return the code value. + */ + @Override + public Integer code() { + return this.code; + } + /** * Validates the instance. * @@ -24,6 +89,47 @@ public AzureIaaSvmHealthDetails() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmHealthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmHealthDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmHealthDetails. + */ + public static AzureIaaSvmHealthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmHealthDetails deserializedAzureIaaSvmHealthDetails = new AzureIaaSvmHealthDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedAzureIaaSvmHealthDetails.code = reader.getNullable(JsonReader::getInt); + } else if ("title".equals(fieldName)) { + deserializedAzureIaaSvmHealthDetails.title = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedAzureIaaSvmHealthDetails.message = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureIaaSvmHealthDetails.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmHealthDetails; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJob.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJob.java index 974e36fa0d336..c5c394d36abb6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJob.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJob.java @@ -5,68 +5,60 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Azure IaaS VM workload-specific job object. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = AzureIaaSvmJob.class, visible = true) -@JsonTypeName("AzureIaaSVMJob") @Fluent public final class AzureIaaSvmJob extends Job { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) private String jobType = "AzureIaaSVMJob"; /* * Time elapsed during the execution of this job. */ - @JsonProperty(value = "duration") private Duration duration; /* * Gets or sets the state/actions applicable on this job like cancel/retry. */ - @JsonProperty(value = "actionsInfo") private List actionsInfo; /* * Error details on execution of this job. */ - @JsonProperty(value = "errorDetails") private List errorDetails; /* * Specifies whether the backup item is a Classic or an Azure Resource Manager VM. */ - @JsonProperty(value = "virtualMachineVersion") private String virtualMachineVersion; /* * Additional information for this job. */ - @JsonProperty(value = "extendedInfo") private AzureIaaSvmJobExtendedInfo extendedInfo; /* * Container name of the entity on which the current job is executing. */ - @JsonProperty(value = "containerName") private String containerName; /* * Indicated that whether the job is adhoc(true) or scheduled(false) */ - @JsonProperty(value = "isUserTriggered") private Boolean isUserTriggered; /** @@ -298,7 +290,6 @@ public AzureIaaSvmJob withActivityId(String activityId) { */ @Override public void validate() { - super.validate(); if (errorDetails() != null) { errorDetails().forEach(e -> e.validate()); } @@ -306,4 +297,94 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityFriendlyName", entityFriendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("operation", operation()); + jsonWriter.writeStringField("status", status()); + jsonWriter.writeStringField("startTime", + startTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(startTime())); + jsonWriter.writeStringField("endTime", + endTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(endTime())); + jsonWriter.writeStringField("activityId", activityId()); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeArrayField("actionsInfo", this.actionsInfo, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("errorDetails", this.errorDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("virtualMachineVersion", this.virtualMachineVersion); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeBooleanField("isUserTriggered", this.isUserTriggered); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmJob if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmJob. + */ + public static AzureIaaSvmJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmJob deserializedAzureIaaSvmJob = new AzureIaaSvmJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityFriendlyName".equals(fieldName)) { + deserializedAzureIaaSvmJob.withEntityFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSvmJob + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("operation".equals(fieldName)) { + deserializedAzureIaaSvmJob.withOperation(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedAzureIaaSvmJob.withStatus(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedAzureIaaSvmJob.withStartTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("endTime".equals(fieldName)) { + deserializedAzureIaaSvmJob.withEndTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("activityId".equals(fieldName)) { + deserializedAzureIaaSvmJob.withActivityId(reader.getString()); + } else if ("jobType".equals(fieldName)) { + deserializedAzureIaaSvmJob.jobType = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedAzureIaaSvmJob.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("actionsInfo".equals(fieldName)) { + List actionsInfo + = reader.readArray(reader1 -> JobSupportedAction.fromString(reader1.getString())); + deserializedAzureIaaSvmJob.actionsInfo = actionsInfo; + } else if ("errorDetails".equals(fieldName)) { + List errorDetails + = reader.readArray(reader1 -> AzureIaaSvmErrorInfo.fromJson(reader1)); + deserializedAzureIaaSvmJob.errorDetails = errorDetails; + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedAzureIaaSvmJob.virtualMachineVersion = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureIaaSvmJob.extendedInfo = AzureIaaSvmJobExtendedInfo.fromJson(reader); + } else if ("containerName".equals(fieldName)) { + deserializedAzureIaaSvmJob.containerName = reader.getString(); + } else if ("isUserTriggered".equals(fieldName)) { + deserializedAzureIaaSvmJob.isUserTriggered = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmJob; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobExtendedInfo.java index f5c39ad39a57f..7b0301369003a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobExtendedInfo.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -14,43 +17,35 @@ * Azure IaaS VM workload-specific additional information for job. */ @Fluent -public final class AzureIaaSvmJobExtendedInfo { +public final class AzureIaaSvmJobExtendedInfo implements JsonSerializable { /* * List of tasks associated with this job. */ - @JsonProperty(value = "tasksList") private List tasksList; /* * Job properties. */ - @JsonProperty(value = "propertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map propertyBag; /* * Job internal properties. */ - @JsonProperty(value = "internalPropertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map internalPropertyBag; /* * Indicates progress of the job. Null if it has not started or completed. */ - @JsonProperty(value = "progressPercentage") private Double progressPercentage; /* * Time remaining for execution of this job. */ - @JsonProperty(value = "estimatedRemainingDuration") private String estimatedRemainingDuration; /* * Non localized error message on job execution. */ - @JsonProperty(value = "dynamicErrorMessage") private String dynamicErrorMessage; /** @@ -189,4 +184,61 @@ public void validate() { tasksList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tasksList", this.tasksList, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("propertyBag", this.propertyBag, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("internalPropertyBag", this.internalPropertyBag, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("progressPercentage", this.progressPercentage); + jsonWriter.writeStringField("estimatedRemainingDuration", this.estimatedRemainingDuration); + jsonWriter.writeStringField("dynamicErrorMessage", this.dynamicErrorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmJobExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmJobExtendedInfo if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmJobExtendedInfo. + */ + public static AzureIaaSvmJobExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmJobExtendedInfo deserializedAzureIaaSvmJobExtendedInfo = new AzureIaaSvmJobExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tasksList".equals(fieldName)) { + List tasksList + = reader.readArray(reader1 -> AzureIaaSvmJobTaskDetails.fromJson(reader1)); + deserializedAzureIaaSvmJobExtendedInfo.tasksList = tasksList; + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureIaaSvmJobExtendedInfo.propertyBag = propertyBag; + } else if ("internalPropertyBag".equals(fieldName)) { + Map internalPropertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureIaaSvmJobExtendedInfo.internalPropertyBag = internalPropertyBag; + } else if ("progressPercentage".equals(fieldName)) { + deserializedAzureIaaSvmJobExtendedInfo.progressPercentage + = reader.getNullable(JsonReader::getDouble); + } else if ("estimatedRemainingDuration".equals(fieldName)) { + deserializedAzureIaaSvmJobExtendedInfo.estimatedRemainingDuration = reader.getString(); + } else if ("dynamicErrorMessage".equals(fieldName)) { + deserializedAzureIaaSvmJobExtendedInfo.dynamicErrorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmJobExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobTaskDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobTaskDetails.java index a325499d0ed9f..80c5baccd64d3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobTaskDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobTaskDetails.java @@ -5,62 +5,60 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Azure IaaS VM workload-specific job task details. */ @Fluent -public final class AzureIaaSvmJobTaskDetails { +public final class AzureIaaSvmJobTaskDetails implements JsonSerializable { /* * The task display name. */ - @JsonProperty(value = "taskId") private String taskId; /* * The start time. */ - @JsonProperty(value = "startTime") private OffsetDateTime startTime; /* * The end time. */ - @JsonProperty(value = "endTime") private OffsetDateTime endTime; /* * The instanceId. */ - @JsonProperty(value = "instanceId") private String instanceId; /* * Time elapsed for task. */ - @JsonProperty(value = "duration") private Duration duration; /* * The status. */ - @JsonProperty(value = "status") private String status; /* * Progress of the task. */ - @JsonProperty(value = "progressPercentage") private Double progressPercentage; /* * Details about execution of the task. * eg: number of bytes transferred etc */ - @JsonProperty(value = "taskExecutionDetails") private String taskExecutionDetails; /** @@ -238,4 +236,67 @@ public AzureIaaSvmJobTaskDetails withTaskExecutionDetails(String taskExecutionDe */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("taskId", this.taskId); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("instanceId", this.instanceId); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeNumberField("progressPercentage", this.progressPercentage); + jsonWriter.writeStringField("taskExecutionDetails", this.taskExecutionDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmJobTaskDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmJobTaskDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmJobTaskDetails. + */ + public static AzureIaaSvmJobTaskDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmJobTaskDetails deserializedAzureIaaSvmJobTaskDetails = new AzureIaaSvmJobTaskDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taskId".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.taskId = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("instanceId".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.instanceId = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("status".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.status = reader.getString(); + } else if ("progressPercentage".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.progressPercentage + = reader.getNullable(JsonReader::getDouble); + } else if ("taskExecutionDetails".equals(fieldName)) { + deserializedAzureIaaSvmJobTaskDetails.taskExecutionDetails = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmJobTaskDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobV2.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobV2.java index d7dd9a73a52a0..a659d61a8844c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobV2.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmJobV2.java @@ -5,62 +5,55 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Azure IaaS VM workload-specific job object. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = AzureIaaSvmJobV2.class, visible = true) -@JsonTypeName("AzureIaaSVMJobV2") @Fluent public final class AzureIaaSvmJobV2 extends Job { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) private String jobType = "AzureIaaSVMJobV2"; /* * Gets or sets the state/actions applicable on this job like cancel/retry. */ - @JsonProperty(value = "actionsInfo") private List actionsInfo; /* * Container name of the entity on which the current job is executing. */ - @JsonProperty(value = "containerName") private String containerName; /* * Time elapsed during the execution of this job. */ - @JsonProperty(value = "duration") private Duration duration; /* * Error details on execution of this job. */ - @JsonProperty(value = "errorDetails") private List errorDetails; /* * Specifies whether the backup item is a Classic or an Azure Resource Manager VM. */ - @JsonProperty(value = "virtualMachineVersion") private String virtualMachineVersion; /* * Additional information for this job. */ - @JsonProperty(value = "extendedInfo") private AzureIaaSvmJobExtendedInfo extendedInfo; /** @@ -272,7 +265,6 @@ public AzureIaaSvmJobV2 withActivityId(String activityId) { */ @Override public void validate() { - super.validate(); if (errorDetails() != null) { errorDetails().forEach(e -> e.validate()); } @@ -280,4 +272,91 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityFriendlyName", entityFriendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("operation", operation()); + jsonWriter.writeStringField("status", status()); + jsonWriter.writeStringField("startTime", + startTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(startTime())); + jsonWriter.writeStringField("endTime", + endTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(endTime())); + jsonWriter.writeStringField("activityId", activityId()); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeArrayField("actionsInfo", this.actionsInfo, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeArrayField("errorDetails", this.errorDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("virtualMachineVersion", this.virtualMachineVersion); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmJobV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmJobV2 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmJobV2. + */ + public static AzureIaaSvmJobV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmJobV2 deserializedAzureIaaSvmJobV2 = new AzureIaaSvmJobV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityFriendlyName".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.withEntityFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSvmJobV2 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("operation".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.withOperation(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.withStatus(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.withStartTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("endTime".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.withEndTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("activityId".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.withActivityId(reader.getString()); + } else if ("jobType".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.jobType = reader.getString(); + } else if ("actionsInfo".equals(fieldName)) { + List actionsInfo + = reader.readArray(reader1 -> JobSupportedAction.fromString(reader1.getString())); + deserializedAzureIaaSvmJobV2.actionsInfo = actionsInfo; + } else if ("containerName".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.containerName = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("errorDetails".equals(fieldName)) { + List errorDetails + = reader.readArray(reader1 -> AzureIaaSvmErrorInfo.fromJson(reader1)); + deserializedAzureIaaSvmJobV2.errorDetails = errorDetails; + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.virtualMachineVersion = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureIaaSvmJobV2.extendedInfo = AzureIaaSvmJobExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmJobV2; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItem.java index cec2cb414f76c..9456cb39fe06e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItem.java @@ -5,112 +5,101 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * IaaS VM workload-specific backup item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureIaaSvmProtectedItem.class, - visible = true) -@JsonTypeName("AzureIaaSVMProtectedItem") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "Microsoft.ClassicCompute/virtualMachines", - value = AzureIaaSClassicComputeVMProtectedItem.class), - @JsonSubTypes.Type(name = "Microsoft.Compute/virtualMachines", value = AzureIaaSComputeVMProtectedItem.class) }) @Fluent public class AzureIaaSvmProtectedItem extends ProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "AzureIaaSVMProtectedItem"; /* * Friendly name of the VM represented by this backup item. */ - @JsonProperty(value = "friendlyName", access = JsonProperty.Access.WRITE_ONLY) private String friendlyName; /* * Fully qualified ARM ID of the virtual machine represented by this item. */ - @JsonProperty(value = "virtualMachineId", access = JsonProperty.Access.WRITE_ONLY) private String virtualMachineId; /* * Backup status of this backup item. */ - @JsonProperty(value = "protectionStatus") private String protectionStatus; /* * Backup state of this backup item. */ - @JsonProperty(value = "protectionState") private ProtectionState protectionState; /* * Health status of protected item. */ - @JsonProperty(value = "healthStatus", access = JsonProperty.Access.WRITE_ONLY) private HealthStatus healthStatus; /* * Health details on this backup item. */ - @JsonProperty(value = "healthDetails") private List healthDetails; /* * Health details of different KPIs */ - @JsonProperty(value = "kpisHealths") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map kpisHealths; /* * Last backup operation status. */ - @JsonProperty(value = "lastBackupStatus") private String lastBackupStatus; /* * Timestamp of the last backup operation on this backup item. */ - @JsonProperty(value = "lastBackupTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastBackupTime; /* * Data ID of the protected item. */ - @JsonProperty(value = "protectedItemDataId", access = JsonProperty.Access.WRITE_ONLY) private String protectedItemDataId; /* * Additional information for this backup item. */ - @JsonProperty(value = "extendedInfo") private AzureIaaSvmProtectedItemExtendedInfo extendedInfo; /* * Extended Properties for Azure IaasVM Backup. */ - @JsonProperty(value = "extendedProperties") private ExtendedProperties extendedProperties; + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureIaaSvmProtectedItem class. */ @@ -136,6 +125,17 @@ public String friendlyName() { return this.friendlyName; } + /** + * Set the friendlyName property: Friendly name of the VM represented by this backup item. + * + * @param friendlyName the friendlyName value to set. + * @return the AzureIaaSvmProtectedItem object itself. + */ + AzureIaaSvmProtectedItem withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + /** * Get the virtualMachineId property: Fully qualified ARM ID of the virtual machine represented by this item. * @@ -145,6 +145,17 @@ public String virtualMachineId() { return this.virtualMachineId; } + /** + * Set the virtualMachineId property: Fully qualified ARM ID of the virtual machine represented by this item. + * + * @param virtualMachineId the virtualMachineId value to set. + * @return the AzureIaaSvmProtectedItem object itself. + */ + AzureIaaSvmProtectedItem withVirtualMachineId(String virtualMachineId) { + this.virtualMachineId = virtualMachineId; + return this; + } + /** * Get the protectionStatus property: Backup status of this backup item. * @@ -194,6 +205,17 @@ public HealthStatus healthStatus() { return this.healthStatus; } + /** + * Set the healthStatus property: Health status of protected item. + * + * @param healthStatus the healthStatus value to set. + * @return the AzureIaaSvmProtectedItem object itself. + */ + AzureIaaSvmProtectedItem withHealthStatus(HealthStatus healthStatus) { + this.healthStatus = healthStatus; + return this; + } + /** * Get the healthDetails property: Health details on this backup item. * @@ -263,6 +285,17 @@ public OffsetDateTime lastBackupTime() { return this.lastBackupTime; } + /** + * Set the lastBackupTime property: Timestamp of the last backup operation on this backup item. + * + * @param lastBackupTime the lastBackupTime value to set. + * @return the AzureIaaSvmProtectedItem object itself. + */ + AzureIaaSvmProtectedItem withLastBackupTime(OffsetDateTime lastBackupTime) { + this.lastBackupTime = lastBackupTime; + return this; + } + /** * Get the protectedItemDataId property: Data ID of the protected item. * @@ -272,6 +305,17 @@ public String protectedItemDataId() { return this.protectedItemDataId; } + /** + * Set the protectedItemDataId property: Data ID of the protected item. + * + * @param protectedItemDataId the protectedItemDataId value to set. + * @return the AzureIaaSvmProtectedItem object itself. + */ + AzureIaaSvmProtectedItem withProtectedItemDataId(String protectedItemDataId) { + this.protectedItemDataId = protectedItemDataId; + return this; + } + /** * Get the extendedInfo property: Additional information for this backup item. * @@ -312,6 +356,36 @@ public AzureIaaSvmProtectedItem withExtendedProperties(ExtendedProperties extend return this; } + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -454,7 +528,6 @@ public AzureIaaSvmProtectedItem withSoftDeleteRetentionPeriod(Integer softDelete */ @Override public void validate() { - super.validate(); if (healthDetails() != null) { healthDetails().forEach(e -> e.validate()); } @@ -472,4 +545,172 @@ public void validate() { extendedProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("protectionStatus", this.protectionStatus); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + jsonWriter.writeArrayField("healthDetails", this.healthDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("kpisHealths", this.kpisHealths, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("lastBackupStatus", this.lastBackupStatus); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + jsonWriter.writeJsonField("extendedProperties", this.extendedProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmProtectedItem if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmProtectedItem. + */ + public static AzureIaaSvmProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectedItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Microsoft.ClassicCompute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSClassicComputeVMProtectedItem.fromJson(readerToUse.reset()); + } else if ("Microsoft.Compute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSComputeVMProtectedItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureIaaSvmProtectedItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmProtectedItem deserializedAzureIaaSvmProtectedItem = new AzureIaaSvmProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureIaaSvmProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.vaultId = reader.getString(); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.protectedItemType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.friendlyName = reader.getString(); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.virtualMachineId = reader.getString(); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.protectionState + = ProtectionState.fromString(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.healthStatus = HealthStatus.fromString(reader.getString()); + } else if ("healthDetails".equals(fieldName)) { + List healthDetails + = reader.readArray(reader1 -> AzureIaaSvmHealthDetails.fromJson(reader1)); + deserializedAzureIaaSvmProtectedItem.healthDetails = healthDetails; + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureIaaSvmProtectedItem.kpisHealths = kpisHealths; + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.lastBackupStatus = reader.getString(); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.lastBackupTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("protectedItemDataId".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.protectedItemDataId = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.extendedInfo + = AzureIaaSvmProtectedItemExtendedInfo.fromJson(reader); + } else if ("extendedProperties".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem.extendedProperties = ExtendedProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmProtectedItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItemExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItemExtendedInfo.java index 0ae31dee8c2fa..712a7985af73f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItemExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectedItemExtendedInfo.java @@ -5,48 +5,49 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Additional information on Azure IaaS VM specific backup item. */ @Fluent -public final class AzureIaaSvmProtectedItemExtendedInfo { +public final class AzureIaaSvmProtectedItemExtendedInfo + implements JsonSerializable { /* * The oldest backup copy available for this backup item across all tiers. */ - @JsonProperty(value = "oldestRecoveryPoint") private OffsetDateTime oldestRecoveryPoint; /* * The oldest backup copy available for this backup item in vault tier */ - @JsonProperty(value = "oldestRecoveryPointInVault") private OffsetDateTime oldestRecoveryPointInVault; /* * The oldest backup copy available for this backup item in archive tier */ - @JsonProperty(value = "oldestRecoveryPointInArchive") private OffsetDateTime oldestRecoveryPointInArchive; /* * The latest backup copy available for this backup item in archive tier */ - @JsonProperty(value = "newestRecoveryPointInArchive") private OffsetDateTime newestRecoveryPointInArchive; /* * Number of backup copies available for this backup item. */ - @JsonProperty(value = "recoveryPointCount") private Integer recoveryPointCount; /* * Specifies if backup policy associated with the backup item is inconsistent. */ - @JsonProperty(value = "policyInconsistent") private Boolean policyInconsistent; /** @@ -189,4 +190,74 @@ public AzureIaaSvmProtectedItemExtendedInfo withPolicyInconsistent(Boolean polic */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("oldestRecoveryPoint", + this.oldestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPoint)); + jsonWriter.writeStringField("oldestRecoveryPointInVault", + this.oldestRecoveryPointInVault == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPointInVault)); + jsonWriter.writeStringField("oldestRecoveryPointInArchive", + this.oldestRecoveryPointInArchive == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPointInArchive)); + jsonWriter.writeStringField("newestRecoveryPointInArchive", + this.newestRecoveryPointInArchive == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.newestRecoveryPointInArchive)); + jsonWriter.writeNumberField("recoveryPointCount", this.recoveryPointCount); + jsonWriter.writeBooleanField("policyInconsistent", this.policyInconsistent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmProtectedItemExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmProtectedItemExtendedInfo if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmProtectedItemExtendedInfo. + */ + public static AzureIaaSvmProtectedItemExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmProtectedItemExtendedInfo deserializedAzureIaaSvmProtectedItemExtendedInfo + = new AzureIaaSvmProtectedItemExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("oldestRecoveryPoint".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItemExtendedInfo.oldestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("oldestRecoveryPointInVault".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItemExtendedInfo.oldestRecoveryPointInVault = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("oldestRecoveryPointInArchive".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItemExtendedInfo.oldestRecoveryPointInArchive = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("newestRecoveryPointInArchive".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItemExtendedInfo.newestRecoveryPointInArchive = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointCount".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItemExtendedInfo.recoveryPointCount + = reader.getNullable(JsonReader::getInt); + } else if ("policyInconsistent".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItemExtendedInfo.policyInconsistent + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmProtectedItemExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectionPolicy.java index 76b062227d6d0..50cd11dcebf14 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureIaaSvmProtectionPolicy.java @@ -5,48 +5,37 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; /** * IaaS VM workload-specific backup policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupManagementType", - defaultImpl = AzureIaaSvmProtectionPolicy.class, - visible = true) -@JsonTypeName("AzureIaasVM") @Fluent public final class AzureIaaSvmProtectionPolicy extends ProtectionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "backupManagementType", required = true) private String backupManagementType = "AzureIaasVM"; /* * The instantRPDetails property. */ - @JsonProperty(value = "instantRPDetails") private InstantRPAdditionalDetails instantRPDetails; /* * Backup schedule specified as part of backup policy. */ - @JsonProperty(value = "schedulePolicy") private SchedulePolicy schedulePolicy; /* * Retention policy with the details on backup copy retention ranges. */ - @JsonProperty(value = "retentionPolicy") private RetentionPolicy retentionPolicy; /* @@ -54,32 +43,26 @@ public final class AzureIaaSvmProtectionPolicy extends ProtectionPolicy { * Key is Target Tier, defined in RecoveryPointTierType enum. * Tiering policy specifies the criteria to move RP to the target tier. */ - @JsonProperty(value = "tieringPolicy") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tieringPolicy; /* * Instant RP retention policy range in days */ - @JsonProperty(value = "instantRpRetentionRangeInDays") private Integer instantRpRetentionRangeInDays; /* * TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". */ - @JsonProperty(value = "timeZone") private String timeZone; /* * The policyType property. */ - @JsonProperty(value = "policyType") private IaasvmPolicyType policyType; /* * The snapshotConsistencyType property. */ - @JsonProperty(value = "snapshotConsistencyType") private IaasVMSnapshotConsistencyType snapshotConsistencyType; /** @@ -289,7 +272,6 @@ public AzureIaaSvmProtectionPolicy withResourceGuardOperationRequests(List writer.writeString(element)); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeJsonField("instantRPDetails", this.instantRPDetails); + jsonWriter.writeJsonField("schedulePolicy", this.schedulePolicy); + jsonWriter.writeJsonField("retentionPolicy", this.retentionPolicy); + jsonWriter.writeMapField("tieringPolicy", this.tieringPolicy, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("instantRpRetentionRangeInDays", this.instantRpRetentionRangeInDays); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeStringField("policyType", this.policyType == null ? null : this.policyType.toString()); + jsonWriter.writeStringField("snapshotConsistencyType", + this.snapshotConsistencyType == null ? null : this.snapshotConsistencyType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureIaaSvmProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureIaaSvmProtectionPolicy if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureIaaSvmProtectionPolicy. + */ + public static AzureIaaSvmProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureIaaSvmProtectionPolicy deserializedAzureIaaSvmProtectionPolicy = new AzureIaaSvmProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectedItemsCount".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy + .withProtectedItemsCount(reader.getNullable(JsonReader::getInt)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureIaaSvmProtectionPolicy + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.backupManagementType = reader.getString(); + } else if ("instantRPDetails".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.instantRPDetails + = InstantRPAdditionalDetails.fromJson(reader); + } else if ("schedulePolicy".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.schedulePolicy = SchedulePolicy.fromJson(reader); + } else if ("retentionPolicy".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.retentionPolicy = RetentionPolicy.fromJson(reader); + } else if ("tieringPolicy".equals(fieldName)) { + Map tieringPolicy + = reader.readMap(reader1 -> TieringPolicy.fromJson(reader1)); + deserializedAzureIaaSvmProtectionPolicy.tieringPolicy = tieringPolicy; + } else if ("instantRpRetentionRangeInDays".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.instantRpRetentionRangeInDays + = reader.getNullable(JsonReader::getInt); + } else if ("timeZone".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.timeZone = reader.getString(); + } else if ("policyType".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.policyType + = IaasvmPolicyType.fromString(reader.getString()); + } else if ("snapshotConsistencyType".equals(fieldName)) { + deserializedAzureIaaSvmProtectionPolicy.snapshotConsistencyType + = IaasVMSnapshotConsistencyType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureIaaSvmProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureRecoveryServiceVaultProtectionIntent.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureRecoveryServiceVaultProtectionIntent.java index 64a7882254aa1..c81f15c90c5f0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureRecoveryServiceVaultProtectionIntent.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureRecoveryServiceVaultProtectionIntent.java @@ -5,30 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure Recovery Services Vault specific protection intent item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectionIntentItemType", - defaultImpl = AzureRecoveryServiceVaultProtectionIntent.class, - visible = true) -@JsonTypeName("RecoveryServiceVaultItem") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureWorkloadAutoProtectionIntent", value = AzureWorkloadAutoProtectionIntent.class) }) @Fluent public class AzureRecoveryServiceVaultProtectionIntent extends ProtectionIntent { /* * backup protectionIntent type. */ - @JsonTypeId - @JsonProperty(value = "protectionIntentItemType", required = true) private ProtectionIntentItemType protectionIntentItemType = ProtectionIntentItemType.RECOVERY_SERVICE_VAULT_ITEM; /** @@ -100,6 +89,90 @@ public AzureRecoveryServiceVaultProtectionIntent withProtectionState(ProtectionS */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("itemId", itemId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectionIntentItemType", + this.protectionIntentItemType == null ? null : this.protectionIntentItemType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureRecoveryServiceVaultProtectionIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureRecoveryServiceVaultProtectionIntent if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureRecoveryServiceVaultProtectionIntent. + */ + public static AzureRecoveryServiceVaultProtectionIntent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectionIntentItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadAutoProtectionIntent".equals(discriminatorValue)) { + return AzureWorkloadAutoProtectionIntent.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLAutoProtectionIntent".equals(discriminatorValue)) { + return AzureWorkloadSqlAutoProtectionIntent.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureRecoveryServiceVaultProtectionIntent fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureRecoveryServiceVaultProtectionIntent deserializedAzureRecoveryServiceVaultProtectionIntent + = new AzureRecoveryServiceVaultProtectionIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureRecoveryServiceVaultProtectionIntent + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureRecoveryServiceVaultProtectionIntent.withSourceResourceId(reader.getString()); + } else if ("itemId".equals(fieldName)) { + deserializedAzureRecoveryServiceVaultProtectionIntent.withItemId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureRecoveryServiceVaultProtectionIntent.withPolicyId(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureRecoveryServiceVaultProtectionIntent + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectionIntentItemType".equals(fieldName)) { + deserializedAzureRecoveryServiceVaultProtectionIntent.protectionIntentItemType + = ProtectionIntentItemType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureRecoveryServiceVaultProtectionIntent; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureResourceProtectionIntent.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureResourceProtectionIntent.java index af56f10d8efe5..1a3edffbcb13c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureResourceProtectionIntent.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureResourceProtectionIntent.java @@ -5,33 +5,24 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM specific backup protection intent item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectionIntentItemType", - defaultImpl = AzureResourceProtectionIntent.class, - visible = true) -@JsonTypeName("AzureResourceItem") @Fluent public final class AzureResourceProtectionIntent extends ProtectionIntent { /* * backup protectionIntent type. */ - @JsonTypeId - @JsonProperty(value = "protectionIntentItemType", required = true) private ProtectionIntentItemType protectionIntentItemType = ProtectionIntentItemType.AZURE_RESOURCE_ITEM; /* * Friendly name of the VM represented by this backup item. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /** @@ -122,6 +113,65 @@ public AzureResourceProtectionIntent withProtectionState(ProtectionStatus protec */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("itemId", itemId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectionIntentItemType", + this.protectionIntentItemType == null ? null : this.protectionIntentItemType.toString()); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureResourceProtectionIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureResourceProtectionIntent if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureResourceProtectionIntent. + */ + public static AzureResourceProtectionIntent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureResourceProtectionIntent deserializedAzureResourceProtectionIntent + = new AzureResourceProtectionIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureResourceProtectionIntent + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureResourceProtectionIntent.withSourceResourceId(reader.getString()); + } else if ("itemId".equals(fieldName)) { + deserializedAzureResourceProtectionIntent.withItemId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureResourceProtectionIntent.withPolicyId(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureResourceProtectionIntent + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectionIntentItemType".equals(fieldName)) { + deserializedAzureResourceProtectionIntent.protectionIntentItemType + = ProtectionIntentItemType.fromString(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureResourceProtectionIntent.friendlyName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureResourceProtectionIntent; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlContainer.java index 372031b6c981e..3543457f5d265 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlContainer.java @@ -5,30 +5,23 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure Sql workload-specific container. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureSqlContainer.class, - visible = true) -@JsonTypeName("AzureSqlContainer") @Fluent public final class AzureSqlContainer extends ProtectionContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.AZURE_SQL_CONTAINER; /** @@ -103,6 +96,59 @@ public AzureSqlContainer withProtectableObjectType(String protectableObjectType) */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureSqlContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureSqlContainer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureSqlContainer. + */ + public static AzureSqlContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureSqlContainer deserializedAzureSqlContainer = new AzureSqlContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureSqlContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureSqlContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureSqlContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureSqlContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureSqlContainer.withProtectableObjectType(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedAzureSqlContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureSqlContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItem.java index babb0a4048f53..9b527ad45ed5f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItem.java @@ -5,49 +5,55 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Azure SQL workload-specific backup item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureSqlProtectedItem.class, - visible = true) -@JsonTypeName("Microsoft.Sql/servers/databases") @Fluent public final class AzureSqlProtectedItem extends ProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "Microsoft.Sql/servers/databases"; /* * Internal ID of a backup item. Used by Azure SQL Backup engine to contact Recovery Services. */ - @JsonProperty(value = "protectedItemDataId") private String protectedItemDataId; /* * Backup state of the backed up item. */ - @JsonProperty(value = "protectionState") private ProtectedItemState protectionState; /* * Additional information for this backup item. */ - @JsonProperty(value = "extendedInfo") private AzureSqlProtectedItemExtendedInfo extendedInfo; + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureSqlProtectedItem class. */ @@ -126,6 +132,36 @@ public AzureSqlProtectedItem withExtendedInfo(AzureSqlProtectedItemExtendedInfo return this; } + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -268,9 +304,120 @@ public AzureSqlProtectedItem withSoftDeleteRetentionPeriod(Integer softDeleteRet */ @Override public void validate() { - super.validate(); if (extendedInfo() != null) { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("protectedItemDataId", this.protectedItemDataId); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureSqlProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureSqlProtectedItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureSqlProtectedItem. + */ + public static AzureSqlProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureSqlProtectedItem deserializedAzureSqlProtectedItem = new AzureSqlProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureSqlProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureSqlProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureSqlProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureSqlProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureSqlProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureSqlProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureSqlProtectedItem.vaultId = reader.getString(); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureSqlProtectedItem.protectedItemType = reader.getString(); + } else if ("protectedItemDataId".equals(fieldName)) { + deserializedAzureSqlProtectedItem.protectedItemDataId = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureSqlProtectedItem.protectionState + = ProtectedItemState.fromString(reader.getString()); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureSqlProtectedItem.extendedInfo = AzureSqlProtectedItemExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureSqlProtectedItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItemExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItemExtendedInfo.java index 66aaf3b59bc55..3d33d5eac5754 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItemExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectedItemExtendedInfo.java @@ -5,30 +5,33 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Additional information on Azure Sql specific protected item. */ @Fluent -public final class AzureSqlProtectedItemExtendedInfo { +public final class AzureSqlProtectedItemExtendedInfo implements JsonSerializable { /* * The oldest backup copy available for this item in the service. */ - @JsonProperty(value = "oldestRecoveryPoint") private OffsetDateTime oldestRecoveryPoint; /* * Number of available backup copies associated with this backup item. */ - @JsonProperty(value = "recoveryPointCount") private Integer recoveryPointCount; /* * State of the backup policy associated with this backup item. */ - @JsonProperty(value = "policyState") private String policyState; /** @@ -104,4 +107,52 @@ public AzureSqlProtectedItemExtendedInfo withPolicyState(String policyState) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("oldestRecoveryPoint", + this.oldestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPoint)); + jsonWriter.writeNumberField("recoveryPointCount", this.recoveryPointCount); + jsonWriter.writeStringField("policyState", this.policyState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureSqlProtectedItemExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureSqlProtectedItemExtendedInfo if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureSqlProtectedItemExtendedInfo. + */ + public static AzureSqlProtectedItemExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureSqlProtectedItemExtendedInfo deserializedAzureSqlProtectedItemExtendedInfo + = new AzureSqlProtectedItemExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("oldestRecoveryPoint".equals(fieldName)) { + deserializedAzureSqlProtectedItemExtendedInfo.oldestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointCount".equals(fieldName)) { + deserializedAzureSqlProtectedItemExtendedInfo.recoveryPointCount + = reader.getNullable(JsonReader::getInt); + } else if ("policyState".equals(fieldName)) { + deserializedAzureSqlProtectedItemExtendedInfo.policyState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureSqlProtectedItemExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectionPolicy.java index b6e1142611896..387c16c77a65f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlProtectionPolicy.java @@ -5,34 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure SQL workload-specific backup policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupManagementType", - defaultImpl = AzureSqlProtectionPolicy.class, - visible = true) -@JsonTypeName("AzureSql") @Fluent public final class AzureSqlProtectionPolicy extends ProtectionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "backupManagementType", required = true) private String backupManagementType = "AzureSql"; /* * Retention policy details. */ - @JsonProperty(value = "retentionPolicy") private RetentionPolicy retentionPolicy; /** @@ -97,9 +89,57 @@ public AzureSqlProtectionPolicy withResourceGuardOperationRequests(List */ @Override public void validate() { - super.validate(); if (retentionPolicy() != null) { retentionPolicy().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("protectedItemsCount", protectedItemsCount()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeJsonField("retentionPolicy", this.retentionPolicy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureSqlProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureSqlProtectionPolicy if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureSqlProtectionPolicy. + */ + public static AzureSqlProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureSqlProtectionPolicy deserializedAzureSqlProtectionPolicy = new AzureSqlProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectedItemsCount".equals(fieldName)) { + deserializedAzureSqlProtectionPolicy + .withProtectedItemsCount(reader.getNullable(JsonReader::getInt)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureSqlProtectionPolicy + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureSqlProtectionPolicy.backupManagementType = reader.getString(); + } else if ("retentionPolicy".equals(fieldName)) { + deserializedAzureSqlProtectionPolicy.retentionPolicy = RetentionPolicy.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureSqlProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlagWorkloadContainerProtectionContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlagWorkloadContainerProtectionContainer.java index f1d1521f1d5f0..00f3db3e5311f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlagWorkloadContainerProtectionContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureSqlagWorkloadContainerProtectionContainer.java @@ -5,31 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Container for SQL workloads under SQL Availability Group. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureSqlagWorkloadContainerProtectionContainer.class, - visible = true) -@JsonTypeName("SQLAGWorkLoadContainer") @Fluent public final class AzureSqlagWorkloadContainerProtectionContainer extends AzureWorkloadContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.SQLAGWORK_LOAD_CONTAINER; /** @@ -151,6 +146,85 @@ public AzureSqlagWorkloadContainerProtectionContainer withProtectableObjectType( */ @Override public void validate() { - super.validate(); + if (extendedInfo() != null) { + extendedInfo().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("lastUpdatedTime", + lastUpdatedTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastUpdatedTime())); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeStringField("workloadType", workloadType() == null ? null : workloadType().toString()); + jsonWriter.writeStringField("operationType", operationType() == null ? null : operationType().toString()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureSqlagWorkloadContainerProtectionContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureSqlagWorkloadContainerProtectionContainer if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureSqlagWorkloadContainerProtectionContainer. + */ + public static AzureSqlagWorkloadContainerProtectionContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureSqlagWorkloadContainerProtectionContainer deserializedAzureSqlagWorkloadContainerProtectionContainer + = new AzureSqlagWorkloadContainerProtectionContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer + .withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer + .withProtectableObjectType(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer.withSourceResourceId(reader.getString()); + } else if ("lastUpdatedTime".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer.withLastUpdatedTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer + .withExtendedInfo(AzureWorkloadContainerExtendedInfo.fromJson(reader)); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer + .withWorkloadType(WorkloadType.fromString(reader.getString())); + } else if ("operationType".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer + .withOperationType(OperationType.fromString(reader.getString())); + } else if ("containerType".equals(fieldName)) { + deserializedAzureSqlagWorkloadContainerProtectionContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureSqlagWorkloadContainerProtectionContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageContainer.java index 0254f85bbff01..8b62564c70bc4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageContainer.java @@ -5,60 +5,48 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure Storage Account workload-specific container. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureStorageContainer.class, - visible = true) -@JsonTypeName("StorageContainer") @Fluent public final class AzureStorageContainer extends ProtectionContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.STORAGE_CONTAINER; /* * Fully qualified ARM url. */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /* * Storage account version. */ - @JsonProperty(value = "storageAccountVersion") private String storageAccountVersion; /* * Resource group name of Recovery Services Vault. */ - @JsonProperty(value = "resourceGroup") private String resourceGroup; /* * Number of items backed up in this container. */ - @JsonProperty(value = "protectedItemCount") private Long protectedItemCount; /* * Whether storage account lock is to be acquired for this container or not. */ - @JsonProperty(value = "acquireStorageAccountLock") private AcquireStorageAccountLock acquireStorageAccountLock; /** @@ -235,6 +223,76 @@ public AzureStorageContainer withProtectableObjectType(String protectableObjectT */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("storageAccountVersion", this.storageAccountVersion); + jsonWriter.writeStringField("resourceGroup", this.resourceGroup); + jsonWriter.writeNumberField("protectedItemCount", this.protectedItemCount); + jsonWriter.writeStringField("acquireStorageAccountLock", + this.acquireStorageAccountLock == null ? null : this.acquireStorageAccountLock.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageContainer if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageContainer. + */ + public static AzureStorageContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageContainer deserializedAzureStorageContainer = new AzureStorageContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureStorageContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureStorageContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureStorageContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureStorageContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureStorageContainer.withProtectableObjectType(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedAzureStorageContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureStorageContainer.sourceResourceId = reader.getString(); + } else if ("storageAccountVersion".equals(fieldName)) { + deserializedAzureStorageContainer.storageAccountVersion = reader.getString(); + } else if ("resourceGroup".equals(fieldName)) { + deserializedAzureStorageContainer.resourceGroup = reader.getString(); + } else if ("protectedItemCount".equals(fieldName)) { + deserializedAzureStorageContainer.protectedItemCount = reader.getNullable(JsonReader::getLong); + } else if ("acquireStorageAccountLock".equals(fieldName)) { + deserializedAzureStorageContainer.acquireStorageAccountLock + = AcquireStorageAccountLock.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageErrorInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageErrorInfo.java index 7787fffcf0d4a..bbd3746eef0d5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageErrorInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageErrorInfo.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure storage specific error information. */ @Fluent -public final class AzureStorageErrorInfo { +public final class AzureStorageErrorInfo implements JsonSerializable { /* * Error code. */ - @JsonProperty(value = "errorCode") private Integer errorCode; /* * Localized error string. */ - @JsonProperty(value = "errorString") private String errorString; /* * List of localized recommendations for above error code. */ - @JsonProperty(value = "recommendations") private List recommendations; /** @@ -104,4 +105,48 @@ public AzureStorageErrorInfo withRecommendations(List recommendations) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorString", this.errorString); + jsonWriter.writeArrayField("recommendations", this.recommendations, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageErrorInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageErrorInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageErrorInfo. + */ + public static AzureStorageErrorInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageErrorInfo deserializedAzureStorageErrorInfo = new AzureStorageErrorInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedAzureStorageErrorInfo.errorCode = reader.getNullable(JsonReader::getInt); + } else if ("errorString".equals(fieldName)) { + deserializedAzureStorageErrorInfo.errorString = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureStorageErrorInfo.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageErrorInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJob.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJob.java index 2b74b697ede58..40b4cc632e0e2 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJob.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJob.java @@ -5,68 +5,60 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Azure storage specific job. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = AzureStorageJob.class, visible = true) -@JsonTypeName("AzureStorageJob") @Fluent public final class AzureStorageJob extends Job { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) private String jobType = "AzureStorageJob"; /* * Time elapsed during the execution of this job. */ - @JsonProperty(value = "duration") private Duration duration; /* * Gets or sets the state/actions applicable on this job like cancel/retry. */ - @JsonProperty(value = "actionsInfo") private List actionsInfo; /* * Error details on execution of this job. */ - @JsonProperty(value = "errorDetails") private List errorDetails; /* * Specifies friendly name of the storage account. */ - @JsonProperty(value = "storageAccountName") private String storageAccountName; /* * Specifies whether the Storage account is a Classic or an Azure Resource Manager Storage account. */ - @JsonProperty(value = "storageAccountVersion") private String storageAccountVersion; /* * Additional information about the job. */ - @JsonProperty(value = "extendedInfo") private AzureStorageJobExtendedInfo extendedInfo; /* * Indicated that whether the job is adhoc(true) or scheduled(false) */ - @JsonProperty(value = "isUserTriggered") private Boolean isUserTriggered; /** @@ -298,7 +290,6 @@ public AzureStorageJob withActivityId(String activityId) { */ @Override public void validate() { - super.validate(); if (errorDetails() != null) { errorDetails().forEach(e -> e.validate()); } @@ -306,4 +297,94 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityFriendlyName", entityFriendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("operation", operation()); + jsonWriter.writeStringField("status", status()); + jsonWriter.writeStringField("startTime", + startTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(startTime())); + jsonWriter.writeStringField("endTime", + endTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(endTime())); + jsonWriter.writeStringField("activityId", activityId()); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeArrayField("actionsInfo", this.actionsInfo, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("errorDetails", this.errorDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("storageAccountName", this.storageAccountName); + jsonWriter.writeStringField("storageAccountVersion", this.storageAccountVersion); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + jsonWriter.writeBooleanField("isUserTriggered", this.isUserTriggered); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageJob if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageJob. + */ + public static AzureStorageJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageJob deserializedAzureStorageJob = new AzureStorageJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityFriendlyName".equals(fieldName)) { + deserializedAzureStorageJob.withEntityFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureStorageJob + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("operation".equals(fieldName)) { + deserializedAzureStorageJob.withOperation(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedAzureStorageJob.withStatus(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedAzureStorageJob.withStartTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("endTime".equals(fieldName)) { + deserializedAzureStorageJob.withEndTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("activityId".equals(fieldName)) { + deserializedAzureStorageJob.withActivityId(reader.getString()); + } else if ("jobType".equals(fieldName)) { + deserializedAzureStorageJob.jobType = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedAzureStorageJob.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("actionsInfo".equals(fieldName)) { + List actionsInfo + = reader.readArray(reader1 -> JobSupportedAction.fromString(reader1.getString())); + deserializedAzureStorageJob.actionsInfo = actionsInfo; + } else if ("errorDetails".equals(fieldName)) { + List errorDetails + = reader.readArray(reader1 -> AzureStorageErrorInfo.fromJson(reader1)); + deserializedAzureStorageJob.errorDetails = errorDetails; + } else if ("storageAccountName".equals(fieldName)) { + deserializedAzureStorageJob.storageAccountName = reader.getString(); + } else if ("storageAccountVersion".equals(fieldName)) { + deserializedAzureStorageJob.storageAccountVersion = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureStorageJob.extendedInfo = AzureStorageJobExtendedInfo.fromJson(reader); + } else if ("isUserTriggered".equals(fieldName)) { + deserializedAzureStorageJob.isUserTriggered = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageJob; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobExtendedInfo.java index 5a681a5f85ed1..0b2224c3495fa 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobExtendedInfo.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -14,24 +17,20 @@ * Azure Storage workload-specific additional information for job. */ @Fluent -public final class AzureStorageJobExtendedInfo { +public final class AzureStorageJobExtendedInfo implements JsonSerializable { /* * List of tasks for this job */ - @JsonProperty(value = "tasksList") private List tasksList; /* * Job properties. */ - @JsonProperty(value = "propertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map propertyBag; /* * Non localized error message on job execution. */ - @JsonProperty(value = "dynamicErrorMessage") private String dynamicErrorMessage; /** @@ -110,4 +109,49 @@ public void validate() { tasksList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tasksList", this.tasksList, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("propertyBag", this.propertyBag, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("dynamicErrorMessage", this.dynamicErrorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageJobExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageJobExtendedInfo if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageJobExtendedInfo. + */ + public static AzureStorageJobExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageJobExtendedInfo deserializedAzureStorageJobExtendedInfo = new AzureStorageJobExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tasksList".equals(fieldName)) { + List tasksList + = reader.readArray(reader1 -> AzureStorageJobTaskDetails.fromJson(reader1)); + deserializedAzureStorageJobExtendedInfo.tasksList = tasksList; + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureStorageJobExtendedInfo.propertyBag = propertyBag; + } else if ("dynamicErrorMessage".equals(fieldName)) { + deserializedAzureStorageJobExtendedInfo.dynamicErrorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageJobExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobTaskDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobTaskDetails.java index 69846285b8662..9681a95a2740e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobTaskDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageJobTaskDetails.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure storage workload specific job task details. */ @Fluent -public final class AzureStorageJobTaskDetails { +public final class AzureStorageJobTaskDetails implements JsonSerializable { /* * The task display name. */ - @JsonProperty(value = "taskId") private String taskId; /* * The status. */ - @JsonProperty(value = "status") private String status; /** @@ -77,4 +79,43 @@ public AzureStorageJobTaskDetails withStatus(String status) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("taskId", this.taskId); + jsonWriter.writeStringField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageJobTaskDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageJobTaskDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageJobTaskDetails. + */ + public static AzureStorageJobTaskDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageJobTaskDetails deserializedAzureStorageJobTaskDetails = new AzureStorageJobTaskDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taskId".equals(fieldName)) { + deserializedAzureStorageJobTaskDetails.taskId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedAzureStorageJobTaskDetails.status = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageJobTaskDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageProtectableContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageProtectableContainer.java index beeca2f37bba2..6c1b093899a07 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageProtectableContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureStorageProtectableContainer.java @@ -5,20 +5,14 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure Storage-specific protectable containers. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableContainerType", - defaultImpl = AzureStorageProtectableContainer.class, - visible = true) -@JsonTypeName("StorageContainer") @Fluent public final class AzureStorageProtectableContainer extends ProtectableContainer { /* @@ -26,8 +20,6 @@ public final class AzureStorageProtectableContainer extends ProtectableContainer * 1. Compute Azure VM is Microsoft.Compute/virtualMachines * 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines */ - @JsonTypeId - @JsonProperty(value = "protectableContainerType", required = true) private ProtectableContainerType protectableContainerType = ProtectableContainerType.STORAGE_CONTAINER; /** @@ -91,6 +83,58 @@ public AzureStorageProtectableContainer withContainerId(String containerId) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("containerId", containerId()); + jsonWriter.writeStringField("protectableContainerType", + this.protectableContainerType == null ? null : this.protectableContainerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageProtectableContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageProtectableContainer if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageProtectableContainer. + */ + public static AzureStorageProtectableContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageProtectableContainer deserializedAzureStorageProtectableContainer + = new AzureStorageProtectableContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureStorageProtectableContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureStorageProtectableContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureStorageProtectableContainer.withHealthStatus(reader.getString()); + } else if ("containerId".equals(fieldName)) { + deserializedAzureStorageProtectableContainer.withContainerId(reader.getString()); + } else if ("protectableContainerType".equals(fieldName)) { + deserializedAzureStorageProtectableContainer.protectableContainerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageProtectableContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectableContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectableContainer.java index 586fd38f4e2f3..df70d3ae816a1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectableContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectableContainer.java @@ -5,20 +5,14 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure workload-specific container. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableContainerType", - defaultImpl = AzureVMAppContainerProtectableContainer.class, - visible = true) -@JsonTypeName("VMAppContainer") @Fluent public final class AzureVMAppContainerProtectableContainer extends ProtectableContainer { /* @@ -26,8 +20,6 @@ public final class AzureVMAppContainerProtectableContainer extends ProtectableCo * 1. Compute Azure VM is Microsoft.Compute/virtualMachines * 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines */ - @JsonTypeId - @JsonProperty(value = "protectableContainerType", required = true) private ProtectableContainerType protectableContainerType = ProtectableContainerType.VMAPP_CONTAINER; /** @@ -91,6 +83,58 @@ public AzureVMAppContainerProtectableContainer withContainerId(String containerI */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("containerId", containerId()); + jsonWriter.writeStringField("protectableContainerType", + this.protectableContainerType == null ? null : this.protectableContainerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVMAppContainerProtectableContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVMAppContainerProtectableContainer if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVMAppContainerProtectableContainer. + */ + public static AzureVMAppContainerProtectableContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVMAppContainerProtectableContainer deserializedAzureVMAppContainerProtectableContainer + = new AzureVMAppContainerProtectableContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureVMAppContainerProtectableContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureVMAppContainerProtectableContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureVMAppContainerProtectableContainer.withHealthStatus(reader.getString()); + } else if ("containerId".equals(fieldName)) { + deserializedAzureVMAppContainerProtectableContainer.withContainerId(reader.getString()); + } else if ("protectableContainerType".equals(fieldName)) { + deserializedAzureVMAppContainerProtectableContainer.protectableContainerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVMAppContainerProtectableContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectionContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectionContainer.java index 52d554126fde9..34c942e51a192 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectionContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMAppContainerProtectionContainer.java @@ -5,31 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Container for SQL workloads under Azure Virtual Machines. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureVMAppContainerProtectionContainer.class, - visible = true) -@JsonTypeName("VMAppContainer") @Fluent public final class AzureVMAppContainerProtectionContainer extends AzureWorkloadContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.VMAPP_CONTAINER; /** @@ -149,6 +144,83 @@ public AzureVMAppContainerProtectionContainer withProtectableObjectType(String p */ @Override public void validate() { - super.validate(); + if (extendedInfo() != null) { + extendedInfo().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("lastUpdatedTime", + lastUpdatedTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastUpdatedTime())); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeStringField("workloadType", workloadType() == null ? null : workloadType().toString()); + jsonWriter.writeStringField("operationType", operationType() == null ? null : operationType().toString()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVMAppContainerProtectionContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVMAppContainerProtectionContainer if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVMAppContainerProtectionContainer. + */ + public static AzureVMAppContainerProtectionContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVMAppContainerProtectionContainer deserializedAzureVMAppContainerProtectionContainer + = new AzureVMAppContainerProtectionContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer.withProtectableObjectType(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer.withSourceResourceId(reader.getString()); + } else if ("lastUpdatedTime".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer.withLastUpdatedTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer + .withExtendedInfo(AzureWorkloadContainerExtendedInfo.fromJson(reader)); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer + .withWorkloadType(WorkloadType.fromString(reader.getString())); + } else if ("operationType".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer + .withOperationType(OperationType.fromString(reader.getString())); + } else if ("containerType".equals(fieldName)) { + deserializedAzureVMAppContainerProtectionContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVMAppContainerProtectionContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMResourceFeatureSupportRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMResourceFeatureSupportRequest.java index c4da77609b366..4cdca2443989a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMResourceFeatureSupportRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVMResourceFeatureSupportRequest.java @@ -5,39 +5,29 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * AzureResource(IaaS VM) Specific feature support request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "featureType", - defaultImpl = AzureVMResourceFeatureSupportRequest.class, - visible = true) -@JsonTypeName("AzureVMResourceBackup") @Fluent public final class AzureVMResourceFeatureSupportRequest extends FeatureSupportRequest { /* * backup support feature type. */ - @JsonTypeId - @JsonProperty(value = "featureType", required = true) private String featureType = "AzureVMResourceBackup"; /* * Size of the resource: VM size(A/D series etc) in case of IaasVM */ - @JsonProperty(value = "vmSize") private String vmSize; /* * SKUs (Premium/Managed etc) in case of IaasVM */ - @JsonProperty(value = "vmSku") private String vmSku; /** @@ -103,6 +93,48 @@ public AzureVMResourceFeatureSupportRequest withVmSku(String vmSku) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("featureType", this.featureType); + jsonWriter.writeStringField("vmSize", this.vmSize); + jsonWriter.writeStringField("vmSku", this.vmSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVMResourceFeatureSupportRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVMResourceFeatureSupportRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVMResourceFeatureSupportRequest. + */ + public static AzureVMResourceFeatureSupportRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVMResourceFeatureSupportRequest deserializedAzureVMResourceFeatureSupportRequest + = new AzureVMResourceFeatureSupportRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("featureType".equals(fieldName)) { + deserializedAzureVMResourceFeatureSupportRequest.featureType = reader.getString(); + } else if ("vmSize".equals(fieldName)) { + deserializedAzureVMResourceFeatureSupportRequest.vmSize = reader.getString(); + } else if ("vmSku".equals(fieldName)) { + deserializedAzureVMResourceFeatureSupportRequest.vmSku = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVMResourceFeatureSupportRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseProtectableItem.java new file mode 100644 index 0000000000000..7ecf8dd2a5c7d --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseProtectableItem.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Azure VM workload-specific protectable item representing AnyDatabase DB. + */ +@Fluent +public final class AzureVmWorkloadAnyDatabaseProtectableItem extends AzureVmWorkloadProtectableItem { + /* + * Type of the backup item. + */ + private String protectableItemType = "AnyDatabase"; + + /** + * Creates an instance of AzureVmWorkloadAnyDatabaseProtectableItem class. + */ + public AzureVmWorkloadAnyDatabaseProtectableItem() { + } + + /** + * Get the protectableItemType property: Type of the backup item. + * + * @return the protectableItemType value. + */ + @Override + public String protectableItemType() { + return this.protectableItemType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withParentName(String parentName) { + super.withParentName(parentName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withParentUniqueName(String parentUniqueName) { + super.withParentUniqueName(parentUniqueName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withServerName(String serverName) { + super.withServerName(serverName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withIsAutoProtectable(Boolean isAutoProtectable) { + super.withIsAutoProtectable(isAutoProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withIsAutoProtected(Boolean isAutoProtected) { + super.withIsAutoProtected(isAutoProtected); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withSubinquireditemcount(Integer subinquireditemcount) { + super.withSubinquireditemcount(subinquireditemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withSubprotectableitemcount(Integer subprotectableitemcount) { + super.withSubprotectableitemcount(subprotectableitemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withPrebackupvalidation(PreBackupValidation prebackupvalidation) { + super.withPrebackupvalidation(prebackupvalidation); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withIsProtectable(Boolean isProtectable) { + super.withIsProtectable(isProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withBackupManagementType(String backupManagementType) { + super.withBackupManagementType(backupManagementType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withWorkloadType(String workloadType) { + super.withWorkloadType(workloadType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withFriendlyName(String friendlyName) { + super.withFriendlyName(friendlyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectableItem withProtectionState(ProtectionStatus protectionState) { + super.withProtectionState(protectionState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadAnyDatabaseProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadAnyDatabaseProtectableItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadAnyDatabaseProtectableItem. + */ + public static AzureVmWorkloadAnyDatabaseProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadAnyDatabaseProtectableItem deserializedAzureVmWorkloadAnyDatabaseProtectableItem + = new AzureVmWorkloadAnyDatabaseProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadAnyDatabaseProtectableItem; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseProtectedItem.java new file mode 100644 index 0000000000000..d3f26712f4dd3 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseProtectedItem.java @@ -0,0 +1,551 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Azure VM workload-specific protected item representing Any Database. + */ +@Fluent +public final class AzureVmWorkloadAnyDatabaseProtectedItem extends AzureVmWorkloadProtectedItem { + /* + * backup item type. + */ + private String protectedItemType = "AzureVmWorkloadAnyDatabase"; + + /* + * Backup status of this backup item. + */ + private String protectionStatus; + + /* + * Friendly name of the DB represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + + /** + * Creates an instance of AzureVmWorkloadAnyDatabaseProtectedItem class. + */ + public AzureVmWorkloadAnyDatabaseProtectedItem() { + } + + /** + * Get the protectedItemType property: backup item type. + * + * @return the protectedItemType value. + */ + @Override + public String protectedItemType() { + return this.protectedItemType; + } + + /** + * Get the protectionStatus property: Backup status of this backup item. + * + * @return the protectionStatus value. + */ + @Override + public String protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the friendlyName property: Friendly name of the DB represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withServerName(String serverName) { + super.withServerName(serverName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withParentName(String parentName) { + super.withParentName(parentName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withParentType(String parentType) { + super.withParentType(parentType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withProtectionState(ProtectionState protectionState) { + super.withProtectionState(protectionState); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withLastBackupStatus(LastBackupStatus lastBackupStatus) { + super.withLastBackupStatus(lastBackupStatus); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withLastBackupTime(OffsetDateTime lastBackupTime) { + super.withLastBackupTime(lastBackupTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withLastBackupErrorDetail(ErrorDetail lastBackupErrorDetail) { + super.withLastBackupErrorDetail(lastBackupErrorDetail); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withProtectedItemDataSourceId(String protectedItemDataSourceId) { + super.withProtectedItemDataSourceId(protectedItemDataSourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem + withProtectedItemHealthStatus(ProtectedItemHealthStatus protectedItemHealthStatus) { + super.withProtectedItemHealthStatus(protectedItemHealthStatus); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem + withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo extendedInfo) { + super.withExtendedInfo(extendedInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withKpisHealths(Map kpisHealths) { + super.withKpisHealths(kpisHealths); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withNodesList(List nodesList) { + super.withNodesList(nodesList); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withContainerName(String containerName) { + super.withContainerName(containerName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withPolicyId(String policyId) { + super.withPolicyId(policyId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withLastRecoveryPoint(OffsetDateTime lastRecoveryPoint) { + super.withLastRecoveryPoint(lastRecoveryPoint); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withBackupSetName(String backupSetName) { + super.withBackupSetName(backupSetName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withDeferredDeleteTimeInUtc(OffsetDateTime deferredDeleteTimeInUtc) { + super.withDeferredDeleteTimeInUtc(deferredDeleteTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem + withIsScheduledForDeferredDelete(Boolean isScheduledForDeferredDelete) { + super.withIsScheduledForDeferredDelete(isScheduledForDeferredDelete); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withDeferredDeleteTimeRemaining(String deferredDeleteTimeRemaining) { + super.withDeferredDeleteTimeRemaining(deferredDeleteTimeRemaining); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem + withIsDeferredDeleteScheduleUpcoming(Boolean isDeferredDeleteScheduleUpcoming) { + super.withIsDeferredDeleteScheduleUpcoming(isDeferredDeleteScheduleUpcoming); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withIsRehydrate(Boolean isRehydrate) { + super.withIsRehydrate(isRehydrate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withIsArchiveEnabled(Boolean isArchiveEnabled) { + super.withIsArchiveEnabled(isArchiveEnabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withPolicyName(String policyName) { + super.withPolicyName(policyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseProtectedItem withSoftDeleteRetentionPeriod(Integer softDeleteRetentionPeriod) { + super.withSoftDeleteRetentionPeriod(softDeleteRetentionPeriod); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (lastBackupErrorDetail() != null) { + lastBackupErrorDetail().validate(); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (nodesList() != null) { + nodesList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentType", parentType()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("lastBackupStatus", + lastBackupStatus() == null ? null : lastBackupStatus().toString()); + jsonWriter.writeStringField("lastBackupTime", + lastBackupTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastBackupTime())); + jsonWriter.writeJsonField("lastBackupErrorDetail", lastBackupErrorDetail()); + jsonWriter.writeStringField("protectedItemDataSourceId", protectedItemDataSourceId()); + jsonWriter.writeStringField("protectedItemHealthStatus", + protectedItemHealthStatus() == null ? null : protectedItemHealthStatus().toString()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("nodesList", nodesList(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadAnyDatabaseProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadAnyDatabaseProtectedItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadAnyDatabaseProtectedItem. + */ + public static AzureVmWorkloadAnyDatabaseProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadAnyDatabaseProtectedItem deserializedAzureVmWorkloadAnyDatabaseProtectedItem + = new AzureVmWorkloadAnyDatabaseProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.friendlyName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withServerName(reader.getString()); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withParentName(reader.getString()); + } else if ("parentType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withParentType(reader.getString()); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withLastBackupStatus(LastBackupStatus.fromString(reader.getString())); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("lastBackupErrorDetail".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withLastBackupErrorDetail(ErrorDetail.fromJson(reader)); + } else if ("protectedItemDataSourceId".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withProtectedItemDataSourceId(reader.getString()); + } else if ("protectedItemHealthStatus".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withProtectedItemHealthStatus(ProtectedItemHealthStatus.fromString(reader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem + .withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo.fromJson(reader)); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withKpisHealths(kpisHealths); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.withNodesList(nodesList); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadAnyDatabaseProtectedItem; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseWorkloadItem.java new file mode 100644 index 0000000000000..ba9c3a4936ada --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadAnyDatabaseWorkloadItem.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Azure VM workload-specific workload item representing Any Database. + */ +@Fluent +public final class AzureVmWorkloadAnyDatabaseWorkloadItem extends AzureVmWorkloadItem { + /* + * Type of the backup item. + */ + private String workloadItemType = "AnyDataBase"; + + /** + * Creates an instance of AzureVmWorkloadAnyDatabaseWorkloadItem class. + */ + public AzureVmWorkloadAnyDatabaseWorkloadItem() { + } + + /** + * Get the workloadItemType property: Type of the backup item. + * + * @return the workloadItemType value. + */ + @Override + public String workloadItemType() { + return this.workloadItemType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withParentName(String parentName) { + super.withParentName(parentName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withServerName(String serverName) { + super.withServerName(serverName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withIsAutoProtectable(Boolean isAutoProtectable) { + super.withIsAutoProtectable(isAutoProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withSubinquireditemcount(Integer subinquireditemcount) { + super.withSubinquireditemcount(subinquireditemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withSubWorkloadItemCount(Integer subWorkloadItemCount) { + super.withSubWorkloadItemCount(subWorkloadItemCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withBackupManagementType(String backupManagementType) { + super.withBackupManagementType(backupManagementType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withWorkloadType(String workloadType) { + super.withWorkloadType(workloadType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withFriendlyName(String friendlyName) { + super.withFriendlyName(friendlyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadAnyDatabaseWorkloadItem withProtectionState(ProtectionStatus protectionState) { + super.withProtectionState(protectionState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadAnyDatabaseWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadAnyDatabaseWorkloadItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadAnyDatabaseWorkloadItem. + */ + public static AzureVmWorkloadAnyDatabaseWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadAnyDatabaseWorkloadItem deserializedAzureVmWorkloadAnyDatabaseWorkloadItem + = new AzureVmWorkloadAnyDatabaseWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadAnyDatabaseWorkloadItem.workloadItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadAnyDatabaseWorkloadItem; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadItem.java index 630957362a934..e56c106193c23 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadItem.java @@ -5,65 +5,44 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific workload item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = AzureVmWorkloadItem.class, - visible = true) -@JsonTypeName("AzureVmWorkloadItem") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "SAPAseDatabase", value = AzureVmWorkloadSapAseDatabaseWorkloadItem.class), - @JsonSubTypes.Type(name = "SAPAseSystem", value = AzureVmWorkloadSapAseSystemWorkloadItem.class), - @JsonSubTypes.Type(name = "SAPHanaDatabase", value = AzureVmWorkloadSapHanaDatabaseWorkloadItem.class), - @JsonSubTypes.Type(name = "SAPHanaSystem", value = AzureVmWorkloadSapHanaSystemWorkloadItem.class), - @JsonSubTypes.Type(name = "SQLDataBase", value = AzureVmWorkloadSqlDatabaseWorkloadItem.class), - @JsonSubTypes.Type(name = "SQLInstance", value = AzureVmWorkloadSqlInstanceWorkloadItem.class) }) @Fluent public class AzureVmWorkloadItem extends WorkloadItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) private String workloadItemType = "AzureVmWorkloadItem"; /* * Name for instance or AG */ - @JsonProperty(value = "parentName") private String parentName; /* * Host/Cluster Name for instance or AG */ - @JsonProperty(value = "serverName") private String serverName; /* * Indicates if workload item is auto-protectable */ - @JsonProperty(value = "isAutoProtectable") private Boolean isAutoProtectable; /* * For instance or AG, indicates number of DB's present */ - @JsonProperty(value = "subinquireditemcount") private Integer subinquireditemcount; /* * For instance or AG, indicates number of DB's to be protected */ - @JsonProperty(value = "subWorkloadItemCount") private Integer subWorkloadItemCount; /** @@ -225,6 +204,108 @@ public AzureVmWorkloadItem withProtectionState(ProtectionStatus protectionState) */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + jsonWriter.writeStringField("parentName", this.parentName); + jsonWriter.writeStringField("serverName", this.serverName); + jsonWriter.writeBooleanField("isAutoProtectable", this.isAutoProtectable); + jsonWriter.writeNumberField("subinquireditemcount", this.subinquireditemcount); + jsonWriter.writeNumberField("subWorkloadItemCount", this.subWorkloadItemCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadItem. + */ + public static AzureVmWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("workloadItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SAPAseDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SAPAseSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseSystemWorkloadItem.fromJson(readerToUse.reset()); + } else if ("OracleDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadOracleDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("AnyDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadAnyDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaSystemWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SQLDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadSqlDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SQLInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSqlInstanceWorkloadItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureVmWorkloadItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadItem deserializedAzureVmWorkloadItem = new AzureVmWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadItem.workloadItemType = reader.getString(); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadItem.parentName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadItem.serverName = reader.getString(); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadItem.isAutoProtectable = reader.getNullable(JsonReader::getBoolean); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadItem.subinquireditemcount = reader.getNullable(JsonReader::getInt); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadItem.subWorkloadItemCount = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseProtectableItem.java new file mode 100644 index 0000000000000..1082d44eeafaf --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseProtectableItem.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Azure VM workload-specific protectable item representing Oracle DB. + */ +@Fluent +public final class AzureVmWorkloadOracleDatabaseProtectableItem extends AzureVmWorkloadProtectableItem { + /* + * Type of the backup item. + */ + private String protectableItemType = "OracleDatabase"; + + /** + * Creates an instance of AzureVmWorkloadOracleDatabaseProtectableItem class. + */ + public AzureVmWorkloadOracleDatabaseProtectableItem() { + } + + /** + * Get the protectableItemType property: Type of the backup item. + * + * @return the protectableItemType value. + */ + @Override + public String protectableItemType() { + return this.protectableItemType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withParentName(String parentName) { + super.withParentName(parentName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withParentUniqueName(String parentUniqueName) { + super.withParentUniqueName(parentUniqueName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withServerName(String serverName) { + super.withServerName(serverName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withIsAutoProtectable(Boolean isAutoProtectable) { + super.withIsAutoProtectable(isAutoProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withIsAutoProtected(Boolean isAutoProtected) { + super.withIsAutoProtected(isAutoProtected); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withSubinquireditemcount(Integer subinquireditemcount) { + super.withSubinquireditemcount(subinquireditemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withSubprotectableitemcount(Integer subprotectableitemcount) { + super.withSubprotectableitemcount(subprotectableitemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem + withPrebackupvalidation(PreBackupValidation prebackupvalidation) { + super.withPrebackupvalidation(prebackupvalidation); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withIsProtectable(Boolean isProtectable) { + super.withIsProtectable(isProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withBackupManagementType(String backupManagementType) { + super.withBackupManagementType(backupManagementType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withWorkloadType(String workloadType) { + super.withWorkloadType(workloadType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withFriendlyName(String friendlyName) { + super.withFriendlyName(friendlyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectableItem withProtectionState(ProtectionStatus protectionState) { + super.withProtectionState(protectionState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadOracleDatabaseProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadOracleDatabaseProtectableItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadOracleDatabaseProtectableItem. + */ + public static AzureVmWorkloadOracleDatabaseProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadOracleDatabaseProtectableItem deserializedAzureVmWorkloadOracleDatabaseProtectableItem + = new AzureVmWorkloadOracleDatabaseProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadOracleDatabaseProtectableItem; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseProtectedItem.java new file mode 100644 index 0000000000000..32bfdd7bf0c55 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseProtectedItem.java @@ -0,0 +1,554 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Azure VM workload-specific protected item representing Oracle Database. + */ +@Fluent +public final class AzureVmWorkloadOracleDatabaseProtectedItem extends AzureVmWorkloadProtectedItem { + /* + * backup item type. + */ + private String protectedItemType = "AzureVmWorkloadOracleDatabase"; + + /* + * Backup status of this backup item. + */ + private String protectionStatus; + + /* + * Friendly name of the DB represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + + /** + * Creates an instance of AzureVmWorkloadOracleDatabaseProtectedItem class. + */ + public AzureVmWorkloadOracleDatabaseProtectedItem() { + } + + /** + * Get the protectedItemType property: backup item type. + * + * @return the protectedItemType value. + */ + @Override + public String protectedItemType() { + return this.protectedItemType; + } + + /** + * Get the protectionStatus property: Backup status of this backup item. + * + * @return the protectionStatus value. + */ + @Override + public String protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the friendlyName property: Friendly name of the DB represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withServerName(String serverName) { + super.withServerName(serverName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withParentName(String parentName) { + super.withParentName(parentName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withParentType(String parentType) { + super.withParentType(parentType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withProtectionState(ProtectionState protectionState) { + super.withProtectionState(protectionState); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withLastBackupStatus(LastBackupStatus lastBackupStatus) { + super.withLastBackupStatus(lastBackupStatus); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withLastBackupTime(OffsetDateTime lastBackupTime) { + super.withLastBackupTime(lastBackupTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withLastBackupErrorDetail(ErrorDetail lastBackupErrorDetail) { + super.withLastBackupErrorDetail(lastBackupErrorDetail); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withProtectedItemDataSourceId(String protectedItemDataSourceId) { + super.withProtectedItemDataSourceId(protectedItemDataSourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withProtectedItemHealthStatus(ProtectedItemHealthStatus protectedItemHealthStatus) { + super.withProtectedItemHealthStatus(protectedItemHealthStatus); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo extendedInfo) { + super.withExtendedInfo(extendedInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withKpisHealths(Map kpisHealths) { + super.withKpisHealths(kpisHealths); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withNodesList(List nodesList) { + super.withNodesList(nodesList); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withContainerName(String containerName) { + super.withContainerName(containerName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withPolicyId(String policyId) { + super.withPolicyId(policyId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withLastRecoveryPoint(OffsetDateTime lastRecoveryPoint) { + super.withLastRecoveryPoint(lastRecoveryPoint); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withBackupSetName(String backupSetName) { + super.withBackupSetName(backupSetName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withCreateMode(CreateMode createMode) { + super.withCreateMode(createMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withDeferredDeleteTimeInUtc(OffsetDateTime deferredDeleteTimeInUtc) { + super.withDeferredDeleteTimeInUtc(deferredDeleteTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withIsScheduledForDeferredDelete(Boolean isScheduledForDeferredDelete) { + super.withIsScheduledForDeferredDelete(isScheduledForDeferredDelete); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withDeferredDeleteTimeRemaining(String deferredDeleteTimeRemaining) { + super.withDeferredDeleteTimeRemaining(deferredDeleteTimeRemaining); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withIsDeferredDeleteScheduleUpcoming(Boolean isDeferredDeleteScheduleUpcoming) { + super.withIsDeferredDeleteScheduleUpcoming(isDeferredDeleteScheduleUpcoming); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withIsRehydrate(Boolean isRehydrate) { + super.withIsRehydrate(isRehydrate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withIsArchiveEnabled(Boolean isArchiveEnabled) { + super.withIsArchiveEnabled(isArchiveEnabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withPolicyName(String policyName) { + super.withPolicyName(policyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseProtectedItem withSoftDeleteRetentionPeriod(Integer softDeleteRetentionPeriod) { + super.withSoftDeleteRetentionPeriod(softDeleteRetentionPeriod); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (lastBackupErrorDetail() != null) { + lastBackupErrorDetail().validate(); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (nodesList() != null) { + nodesList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentType", parentType()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("lastBackupStatus", + lastBackupStatus() == null ? null : lastBackupStatus().toString()); + jsonWriter.writeStringField("lastBackupTime", + lastBackupTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastBackupTime())); + jsonWriter.writeJsonField("lastBackupErrorDetail", lastBackupErrorDetail()); + jsonWriter.writeStringField("protectedItemDataSourceId", protectedItemDataSourceId()); + jsonWriter.writeStringField("protectedItemHealthStatus", + protectedItemHealthStatus() == null ? null : protectedItemHealthStatus().toString()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("nodesList", nodesList(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadOracleDatabaseProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadOracleDatabaseProtectedItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadOracleDatabaseProtectedItem. + */ + public static AzureVmWorkloadOracleDatabaseProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadOracleDatabaseProtectedItem deserializedAzureVmWorkloadOracleDatabaseProtectedItem + = new AzureVmWorkloadOracleDatabaseProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.friendlyName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withServerName(reader.getString()); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withParentName(reader.getString()); + } else if ("parentType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withParentType(reader.getString()); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withLastBackupStatus(LastBackupStatus.fromString(reader.getString())); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("lastBackupErrorDetail".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withLastBackupErrorDetail(ErrorDetail.fromJson(reader)); + } else if ("protectedItemDataSourceId".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withProtectedItemDataSourceId(reader.getString()); + } else if ("protectedItemHealthStatus".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withProtectedItemHealthStatus(ProtectedItemHealthStatus.fromString(reader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem + .withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo.fromJson(reader)); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withKpisHealths(kpisHealths); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.withNodesList(nodesList); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadOracleDatabaseProtectedItem; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseWorkloadItem.java new file mode 100644 index 0000000000000..7cdd93825476d --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadOracleDatabaseWorkloadItem.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Azure VM workload-specific workload item representing Oracle Database. + */ +@Fluent +public final class AzureVmWorkloadOracleDatabaseWorkloadItem extends AzureVmWorkloadItem { + /* + * Type of the backup item. + */ + private String workloadItemType = "OracleDataBase"; + + /** + * Creates an instance of AzureVmWorkloadOracleDatabaseWorkloadItem class. + */ + public AzureVmWorkloadOracleDatabaseWorkloadItem() { + } + + /** + * Get the workloadItemType property: Type of the backup item. + * + * @return the workloadItemType value. + */ + @Override + public String workloadItemType() { + return this.workloadItemType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withParentName(String parentName) { + super.withParentName(parentName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withServerName(String serverName) { + super.withServerName(serverName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withIsAutoProtectable(Boolean isAutoProtectable) { + super.withIsAutoProtectable(isAutoProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withSubinquireditemcount(Integer subinquireditemcount) { + super.withSubinquireditemcount(subinquireditemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withSubWorkloadItemCount(Integer subWorkloadItemCount) { + super.withSubWorkloadItemCount(subWorkloadItemCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withBackupManagementType(String backupManagementType) { + super.withBackupManagementType(backupManagementType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withWorkloadType(String workloadType) { + super.withWorkloadType(workloadType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withFriendlyName(String friendlyName) { + super.withFriendlyName(friendlyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadOracleDatabaseWorkloadItem withProtectionState(ProtectionStatus protectionState) { + super.withProtectionState(protectionState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadOracleDatabaseWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadOracleDatabaseWorkloadItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadOracleDatabaseWorkloadItem. + */ + public static AzureVmWorkloadOracleDatabaseWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadOracleDatabaseWorkloadItem deserializedAzureVmWorkloadOracleDatabaseWorkloadItem + = new AzureVmWorkloadOracleDatabaseWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadOracleDatabaseWorkloadItem.workloadItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadOracleDatabaseWorkloadItem; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectableItem.java index 5a17a578d9735..f7c74bd4e0403 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectableItem.java @@ -5,94 +5,65 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadProtectableItem.class, - visible = true) -@JsonTypeName("AzureVmWorkloadProtectableItem") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "SAPAseSystem", value = AzureVmWorkloadSapAseSystemProtectableItem.class), - @JsonSubTypes.Type(name = "SAPHanaDatabase", value = AzureVmWorkloadSapHanaDatabaseProtectableItem.class), - @JsonSubTypes.Type(name = "SAPHanaSystem", value = AzureVmWorkloadSapHanaSystemProtectableItem.class), - @JsonSubTypes.Type(name = "SAPHanaDBInstance", value = AzureVmWorkloadSapHanaDBInstance.class), - @JsonSubTypes.Type(name = "HanaHSRContainer", value = AzureVmWorkloadSapHanaHsr.class), - @JsonSubTypes.Type( - name = "SQLAvailabilityGroupContainer", - value = AzureVmWorkloadSqlAvailabilityGroupProtectableItem.class), - @JsonSubTypes.Type(name = "SQLDataBase", value = AzureVmWorkloadSqlDatabaseProtectableItem.class), - @JsonSubTypes.Type(name = "SQLInstance", value = AzureVmWorkloadSqlInstanceProtectableItem.class) }) @Fluent public class AzureVmWorkloadProtectableItem extends WorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "AzureVmWorkloadProtectableItem"; /* * Name for instance or AG */ - @JsonProperty(value = "parentName") private String parentName; /* * 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. */ - @JsonProperty(value = "parentUniqueName") private String parentUniqueName; /* * Host/Cluster Name for instance or AG */ - @JsonProperty(value = "serverName") private String serverName; /* * Indicates if protectable item is auto-protectable */ - @JsonProperty(value = "isAutoProtectable") private Boolean isAutoProtectable; /* * Indicates if protectable item is auto-protected */ - @JsonProperty(value = "isAutoProtected") private Boolean isAutoProtected; /* * For instance or AG, indicates number of DB's present */ - @JsonProperty(value = "subinquireditemcount") private Integer subinquireditemcount; /* * For instance or AG, indicates number of DB's to be protected */ - @JsonProperty(value = "subprotectableitemcount") private Integer subprotectableitemcount; /* * Pre-backup validation for protectable objects */ - @JsonProperty(value = "prebackupvalidation") private PreBackupValidation prebackupvalidation; /* * Indicates if item is protectable */ - @JsonProperty(value = "isProtectable") private Boolean isProtectable; /** @@ -338,9 +309,136 @@ public AzureVmWorkloadProtectableItem withProtectionState(ProtectionStatus prote */ @Override public void validate() { - super.validate(); if (prebackupvalidation() != null) { prebackupvalidation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + jsonWriter.writeStringField("parentName", this.parentName); + jsonWriter.writeStringField("parentUniqueName", this.parentUniqueName); + jsonWriter.writeStringField("serverName", this.serverName); + jsonWriter.writeBooleanField("isAutoProtectable", this.isAutoProtectable); + jsonWriter.writeBooleanField("isAutoProtected", this.isAutoProtected); + jsonWriter.writeNumberField("subinquireditemcount", this.subinquireditemcount); + jsonWriter.writeNumberField("subprotectableitemcount", this.subprotectableitemcount); + jsonWriter.writeJsonField("prebackupvalidation", this.prebackupvalidation); + jsonWriter.writeBooleanField("isProtectable", this.isProtectable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadProtectableItem if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadProtectableItem. + */ + public static AzureVmWorkloadProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectableItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SAPAseSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseSystemProtectableItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaSystemProtectableItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaDBInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDBInstance.fromJson(readerToUse.reset()); + } else if ("HanaHSRContainer".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaHsr.fromJson(readerToUse.reset()); + } else if ("OracleDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadOracleDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("AnyDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadAnyDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("HanaScaleoutContainer".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaScaleoutProtectableItem.fromJson(readerToUse.reset()); + } else if ("SQLAvailabilityGroupContainer".equals(discriminatorValue)) { + return AzureVmWorkloadSqlAvailabilityGroupProtectableItem.fromJson(readerToUse.reset()); + } else if ("SQLDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadSqlDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("SQLInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSqlInstanceProtectableItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureVmWorkloadProtectableItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadProtectableItem deserializedAzureVmWorkloadProtectableItem + = new AzureVmWorkloadProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.protectableItemType = reader.getString(); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.parentName = reader.getString(); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.parentUniqueName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.serverName = reader.getString(); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.isAutoProtectable + = reader.getNullable(JsonReader::getBoolean); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.isAutoProtected + = reader.getNullable(JsonReader::getBoolean); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.subinquireditemcount + = reader.getNullable(JsonReader::getInt); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.subprotectableitemcount + = reader.getNullable(JsonReader::getInt); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.prebackupvalidation + = PreBackupValidation.fromJson(reader); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadProtectableItem.isProtectable + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadProtectableItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItem.java index d01c3ead991bc..d8748deb4e2ed 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItem.java @@ -5,130 +5,111 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Azure VM workload-specific protected item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureVmWorkloadProtectedItem.class, - visible = true) -@JsonTypeName("AzureVmWorkloadProtectedItem") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureVmWorkloadSAPAseDatabase", - value = AzureVmWorkloadSapAseDatabaseProtectedItem.class), - @JsonSubTypes.Type( - name = "AzureVmWorkloadSAPHanaDatabase", - value = AzureVmWorkloadSapHanaDatabaseProtectedItem.class), - @JsonSubTypes.Type( - name = "AzureVmWorkloadSAPHanaDBInstance", - value = AzureVmWorkloadSapHanaDBInstanceProtectedItem.class), - @JsonSubTypes.Type(name = "AzureVmWorkloadSQLDatabase", value = AzureVmWorkloadSqlDatabaseProtectedItem.class) }) @Fluent public class AzureVmWorkloadProtectedItem extends ProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "AzureVmWorkloadProtectedItem"; /* * Friendly name of the DB represented by this backup item. */ - @JsonProperty(value = "friendlyName", access = JsonProperty.Access.WRITE_ONLY) private String friendlyName; /* * Host/Cluster Name for instance or AG */ - @JsonProperty(value = "serverName") private String serverName; /* * Parent name of the DB such as Instance or Availability Group. */ - @JsonProperty(value = "parentName") private String parentName; /* * Parent type of protected item, example: for a DB, standalone server or distributed */ - @JsonProperty(value = "parentType") private String parentType; /* * Backup status of this backup item. */ - @JsonProperty(value = "protectionStatus", access = JsonProperty.Access.WRITE_ONLY) private String protectionStatus; /* * Backup state of this backup item. */ - @JsonProperty(value = "protectionState") private ProtectionState protectionState; /* * Last backup operation status. Possible values: Healthy, Unhealthy. */ - @JsonProperty(value = "lastBackupStatus") private LastBackupStatus lastBackupStatus; /* * Timestamp of the last backup operation on this backup item. */ - @JsonProperty(value = "lastBackupTime") private OffsetDateTime lastBackupTime; /* * Error details in last backup */ - @JsonProperty(value = "lastBackupErrorDetail") private ErrorDetail lastBackupErrorDetail; /* * Data ID of the protected item. */ - @JsonProperty(value = "protectedItemDataSourceId") private String protectedItemDataSourceId; /* * Health status of the backup item, evaluated based on last heartbeat received */ - @JsonProperty(value = "protectedItemHealthStatus") private ProtectedItemHealthStatus protectedItemHealthStatus; /* * Additional information for this backup item. */ - @JsonProperty(value = "extendedInfo") private AzureVmWorkloadProtectedItemExtendedInfo extendedInfo; /* * Health details of different KPIs */ - @JsonProperty(value = "kpisHealths") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map kpisHealths; /* * List of the nodes in case of distributed container. */ - @JsonProperty(value = "nodesList") private List nodesList; + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureVmWorkloadProtectedItem class. */ @@ -154,6 +135,17 @@ public String friendlyName() { return this.friendlyName; } + /** + * Set the friendlyName property: Friendly name of the DB represented by this backup item. + * + * @param friendlyName the friendlyName value to set. + * @return the AzureVmWorkloadProtectedItem object itself. + */ + AzureVmWorkloadProtectedItem withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + /** * Get the serverName property: Host/Cluster Name for instance or AG. * @@ -223,6 +215,17 @@ public String protectionStatus() { return this.protectionStatus; } + /** + * Set the protectionStatus property: Backup status of this backup item. + * + * @param protectionStatus the protectionStatus value to set. + * @return the AzureVmWorkloadProtectedItem object itself. + */ + AzureVmWorkloadProtectedItem withProtectionStatus(String protectionStatus) { + this.protectionStatus = protectionStatus; + return this; + } + /** * Get the protectionState property: Backup state of this backup item. * @@ -406,6 +409,36 @@ public AzureVmWorkloadProtectedItem withNodesList(List nod return this; } + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -549,7 +582,6 @@ public AzureVmWorkloadProtectedItem withSoftDeleteRetentionPeriod(Integer softDe */ @Override public void validate() { - super.validate(); if (lastBackupErrorDetail() != null) { lastBackupErrorDetail().validate(); } @@ -567,4 +599,195 @@ public void validate() { nodesList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("serverName", this.serverName); + jsonWriter.writeStringField("parentName", this.parentName); + jsonWriter.writeStringField("parentType", this.parentType); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + jsonWriter.writeStringField("lastBackupStatus", + this.lastBackupStatus == null ? null : this.lastBackupStatus.toString()); + jsonWriter.writeStringField("lastBackupTime", + this.lastBackupTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastBackupTime)); + jsonWriter.writeJsonField("lastBackupErrorDetail", this.lastBackupErrorDetail); + jsonWriter.writeStringField("protectedItemDataSourceId", this.protectedItemDataSourceId); + jsonWriter.writeStringField("protectedItemHealthStatus", + this.protectedItemHealthStatus == null ? null : this.protectedItemHealthStatus.toString()); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + jsonWriter.writeMapField("kpisHealths", this.kpisHealths, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("nodesList", this.nodesList, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadProtectedItem if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadProtectedItem. + */ + public static AzureVmWorkloadProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectedItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureVmWorkloadSAPAseDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadOracleDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadOracleDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadAnyDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadAnyDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadSAPHanaDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadSAPHanaDBInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDBInstanceProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadSQLDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSqlDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureVmWorkloadProtectedItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadProtectedItem deserializedAzureVmWorkloadProtectedItem = new AzureVmWorkloadProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.vaultId = reader.getString(); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.protectedItemType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.friendlyName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.serverName = reader.getString(); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.parentName = reader.getString(); + } else if ("parentType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.parentType = reader.getString(); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.protectionState + = ProtectionState.fromString(reader.getString()); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.lastBackupStatus + = LastBackupStatus.fromString(reader.getString()); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.lastBackupTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastBackupErrorDetail".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.lastBackupErrorDetail = ErrorDetail.fromJson(reader); + } else if ("protectedItemDataSourceId".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.protectedItemDataSourceId = reader.getString(); + } else if ("protectedItemHealthStatus".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.protectedItemHealthStatus + = ProtectedItemHealthStatus.fromString(reader.getString()); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem.extendedInfo + = AzureVmWorkloadProtectedItemExtendedInfo.fromJson(reader); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureVmWorkloadProtectedItem.kpisHealths = kpisHealths; + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadProtectedItem.nodesList = nodesList; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadProtectedItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItemExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItemExtendedInfo.java index ea8bdb12bf971..7185f0bcbb4c7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItemExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectedItemExtendedInfo.java @@ -5,54 +5,54 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Additional information on Azure Workload for SQL specific backup item. */ @Fluent -public final class AzureVmWorkloadProtectedItemExtendedInfo { +public final class AzureVmWorkloadProtectedItemExtendedInfo + implements JsonSerializable { /* * The oldest backup copy available for this backup item across all tiers. */ - @JsonProperty(value = "oldestRecoveryPoint") private OffsetDateTime oldestRecoveryPoint; /* * The oldest backup copy available for this backup item in vault tier */ - @JsonProperty(value = "oldestRecoveryPointInVault") private OffsetDateTime oldestRecoveryPointInVault; /* * The oldest backup copy available for this backup item in archive tier */ - @JsonProperty(value = "oldestRecoveryPointInArchive") private OffsetDateTime oldestRecoveryPointInArchive; /* * The latest backup copy available for this backup item in archive tier */ - @JsonProperty(value = "newestRecoveryPointInArchive") private OffsetDateTime newestRecoveryPointInArchive; /* * Number of backup copies available for this backup item. */ - @JsonProperty(value = "recoveryPointCount") private Integer recoveryPointCount; /* * Indicates consistency of policy object and policy applied to this backup item. */ - @JsonProperty(value = "policyState") private String policyState; /* * Indicates consistency of policy object and policy applied to this backup item. */ - @JsonProperty(value = "recoveryModel") private String recoveryModel; /** @@ -215,4 +215,76 @@ public AzureVmWorkloadProtectedItemExtendedInfo withRecoveryModel(String recover */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("oldestRecoveryPoint", + this.oldestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPoint)); + jsonWriter.writeStringField("oldestRecoveryPointInVault", + this.oldestRecoveryPointInVault == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPointInVault)); + jsonWriter.writeStringField("oldestRecoveryPointInArchive", + this.oldestRecoveryPointInArchive == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPointInArchive)); + jsonWriter.writeStringField("newestRecoveryPointInArchive", + this.newestRecoveryPointInArchive == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.newestRecoveryPointInArchive)); + jsonWriter.writeNumberField("recoveryPointCount", this.recoveryPointCount); + jsonWriter.writeStringField("policyState", this.policyState); + jsonWriter.writeStringField("recoveryModel", this.recoveryModel); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadProtectedItemExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadProtectedItemExtendedInfo if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadProtectedItemExtendedInfo. + */ + public static AzureVmWorkloadProtectedItemExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadProtectedItemExtendedInfo deserializedAzureVmWorkloadProtectedItemExtendedInfo + = new AzureVmWorkloadProtectedItemExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("oldestRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItemExtendedInfo.oldestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("oldestRecoveryPointInVault".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItemExtendedInfo.oldestRecoveryPointInVault = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("oldestRecoveryPointInArchive".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItemExtendedInfo.oldestRecoveryPointInArchive = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("newestRecoveryPointInArchive".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItemExtendedInfo.newestRecoveryPointInArchive = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointCount".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItemExtendedInfo.recoveryPointCount + = reader.getNullable(JsonReader::getInt); + } else if ("policyState".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItemExtendedInfo.policyState = reader.getString(); + } else if ("recoveryModel".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItemExtendedInfo.recoveryModel = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadProtectedItemExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectionPolicy.java index 128bce807f883..f672a484db67e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectionPolicy.java @@ -5,52 +5,46 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure VM (Mercury) workload-specific backup policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupManagementType", - defaultImpl = AzureVmWorkloadProtectionPolicy.class, - visible = true) -@JsonTypeName("AzureWorkload") @Fluent public final class AzureVmWorkloadProtectionPolicy extends ProtectionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "backupManagementType", required = true) private String backupManagementType = "AzureWorkload"; /* * Type of workload for the backup management */ - @JsonProperty(value = "workLoadType") private WorkloadType workLoadType; + /* + * Type of workload for the backup management + */ + private VMWorkloadPolicyType vmWorkloadPolicyType; + /* * Common settings for the backup management */ - @JsonProperty(value = "settings") private Settings settings; /* * List of sub-protection policies which includes schedule and retention */ - @JsonProperty(value = "subProtectionPolicy") private List subProtectionPolicy; /* * Fix the policy inconsistency */ - @JsonProperty(value = "makePolicyConsistent") private Boolean makePolicyConsistent; /** @@ -90,6 +84,26 @@ public AzureVmWorkloadProtectionPolicy withWorkLoadType(WorkloadType workLoadTyp return this; } + /** + * Get the vmWorkloadPolicyType property: Type of workload for the backup management. + * + * @return the vmWorkloadPolicyType value. + */ + public VMWorkloadPolicyType vmWorkloadPolicyType() { + return this.vmWorkloadPolicyType; + } + + /** + * Set the vmWorkloadPolicyType property: Type of workload for the backup management. + * + * @param vmWorkloadPolicyType the vmWorkloadPolicyType value to set. + * @return the AzureVmWorkloadProtectionPolicy object itself. + */ + public AzureVmWorkloadProtectionPolicy withVmWorkloadPolicyType(VMWorkloadPolicyType vmWorkloadPolicyType) { + this.vmWorkloadPolicyType = vmWorkloadPolicyType; + return this; + } + /** * Get the settings property: Common settings for the backup management. * @@ -176,7 +190,6 @@ public AzureVmWorkloadProtectionPolicy withProtectedItemsCount(Integer protected */ @Override public void validate() { - super.validate(); if (settings() != null) { settings().validate(); } @@ -184,4 +197,73 @@ public void validate() { subProtectionPolicy().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("protectedItemsCount", protectedItemsCount()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeStringField("workLoadType", this.workLoadType == null ? null : this.workLoadType.toString()); + jsonWriter.writeStringField("vmWorkloadPolicyType", + this.vmWorkloadPolicyType == null ? null : this.vmWorkloadPolicyType.toString()); + jsonWriter.writeJsonField("settings", this.settings); + jsonWriter.writeArrayField("subProtectionPolicy", this.subProtectionPolicy, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("makePolicyConsistent", this.makePolicyConsistent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadProtectionPolicy if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadProtectionPolicy. + */ + public static AzureVmWorkloadProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadProtectionPolicy deserializedAzureVmWorkloadProtectionPolicy + = new AzureVmWorkloadProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectedItemsCount".equals(fieldName)) { + deserializedAzureVmWorkloadProtectionPolicy + .withProtectedItemsCount(reader.getNullable(JsonReader::getInt)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadProtectionPolicy + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectionPolicy.backupManagementType = reader.getString(); + } else if ("workLoadType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectionPolicy.workLoadType + = WorkloadType.fromString(reader.getString()); + } else if ("vmWorkloadPolicyType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectionPolicy.vmWorkloadPolicyType + = VMWorkloadPolicyType.fromString(reader.getString()); + } else if ("settings".equals(fieldName)) { + deserializedAzureVmWorkloadProtectionPolicy.settings = Settings.fromJson(reader); + } else if ("subProtectionPolicy".equals(fieldName)) { + List subProtectionPolicy + = reader.readArray(reader1 -> SubProtectionPolicy.fromJson(reader1)); + deserializedAzureVmWorkloadProtectionPolicy.subProtectionPolicy = subProtectionPolicy; + } else if ("makePolicyConsistent".equals(fieldName)) { + deserializedAzureVmWorkloadProtectionPolicy.makePolicyConsistent + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseProtectedItem.java index 0ef13f80bd6fa..bbf4d0aeba24b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseProtectedItem.java @@ -5,32 +5,51 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Azure VM workload-specific protected item representing SAP ASE Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureVmWorkloadSapAseDatabaseProtectedItem.class, - visible = true) -@JsonTypeName("AzureVmWorkloadSAPAseDatabase") @Fluent public final class AzureVmWorkloadSapAseDatabaseProtectedItem extends AzureVmWorkloadProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "AzureVmWorkloadSAPAseDatabase"; + /* + * Backup status of this backup item. + */ + private String protectionStatus; + + /* + * Friendly name of the DB represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureVmWorkloadSapAseDatabaseProtectedItem class. */ @@ -47,6 +66,56 @@ public String protectedItemType() { return this.protectedItemType; } + /** + * Get the protectionStatus property: Backup status of this backup item. + * + * @return the protectionStatus value. + */ + @Override + public String protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the friendlyName property: Friendly name of the DB represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -305,6 +374,181 @@ public AzureVmWorkloadSapAseDatabaseProtectedItem withSoftDeleteRetentionPeriod( */ @Override public void validate() { - super.validate(); + if (lastBackupErrorDetail() != null) { + lastBackupErrorDetail().validate(); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (nodesList() != null) { + nodesList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentType", parentType()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("lastBackupStatus", + lastBackupStatus() == null ? null : lastBackupStatus().toString()); + jsonWriter.writeStringField("lastBackupTime", + lastBackupTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastBackupTime())); + jsonWriter.writeJsonField("lastBackupErrorDetail", lastBackupErrorDetail()); + jsonWriter.writeStringField("protectedItemDataSourceId", protectedItemDataSourceId()); + jsonWriter.writeStringField("protectedItemHealthStatus", + protectedItemHealthStatus() == null ? null : protectedItemHealthStatus().toString()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("nodesList", nodesList(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapAseDatabaseProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapAseDatabaseProtectedItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapAseDatabaseProtectedItem. + */ + public static AzureVmWorkloadSapAseDatabaseProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapAseDatabaseProtectedItem deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + = new AzureVmWorkloadSapAseDatabaseProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.friendlyName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withServerName(reader.getString()); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withParentName(reader.getString()); + } else if ("parentType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withParentType(reader.getString()); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withLastBackupStatus(LastBackupStatus.fromString(reader.getString())); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("lastBackupErrorDetail".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withLastBackupErrorDetail(ErrorDetail.fromJson(reader)); + } else if ("protectedItemDataSourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withProtectedItemDataSourceId(reader.getString()); + } else if ("protectedItemHealthStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withProtectedItemHealthStatus(ProtectedItemHealthStatus.fromString(reader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo.fromJson(reader)); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withKpisHealths(kpisHealths); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withNodesList(nodesList); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapAseDatabaseProtectedItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseWorkloadItem.java index cc88e9d607585..9a470e56c0b4a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseWorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseDatabaseWorkloadItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific workload item representing SAP ASE Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = AzureVmWorkloadSapAseDatabaseWorkloadItem.class, - visible = true) -@JsonTypeName("SAPAseDatabase") @Fluent public final class AzureVmWorkloadSapAseDatabaseWorkloadItem extends AzureVmWorkloadItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) private String workloadItemType = "SAPAseDatabase"; /** @@ -132,6 +124,73 @@ public AzureVmWorkloadSapAseDatabaseWorkloadItem withProtectionState(ProtectionS */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapAseDatabaseWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapAseDatabaseWorkloadItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapAseDatabaseWorkloadItem. + */ + public static AzureVmWorkloadSapAseDatabaseWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapAseDatabaseWorkloadItem deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem + = new AzureVmWorkloadSapAseDatabaseWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem.workloadItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapAseDatabaseWorkloadItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemProtectableItem.java index 680d4558499ac..ed583dd40f4a1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemProtectableItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item representing SAP ASE System. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSapAseSystemProtectableItem.class, - visible = true) -@JsonTypeName("SAPAseSystem") @Fluent public final class AzureVmWorkloadSapAseSystemProtectableItem extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "SAPAseSystem"; /** @@ -168,6 +160,91 @@ public AzureVmWorkloadSapAseSystemProtectableItem withProtectionState(Protection */ @Override public void validate() { - super.validate(); + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapAseSystemProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapAseSystemProtectableItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapAseSystemProtectableItem. + */ + public static AzureVmWorkloadSapAseSystemProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapAseSystemProtectableItem deserializedAzureVmWorkloadSapAseSystemProtectableItem + = new AzureVmWorkloadSapAseSystemProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapAseSystemProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemWorkloadItem.java index 8edd09d13e66d..4d40d011022d4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemWorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapAseSystemWorkloadItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific workload item representing SAP ASE System. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = AzureVmWorkloadSapAseSystemWorkloadItem.class, - visible = true) -@JsonTypeName("SAPAseSystem") @Fluent public final class AzureVmWorkloadSapAseSystemWorkloadItem extends AzureVmWorkloadItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) private String workloadItemType = "SAPAseSystem"; /** @@ -132,6 +124,73 @@ public AzureVmWorkloadSapAseSystemWorkloadItem withProtectionState(ProtectionSta */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapAseSystemWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapAseSystemWorkloadItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapAseSystemWorkloadItem. + */ + public static AzureVmWorkloadSapAseSystemWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapAseSystemWorkloadItem deserializedAzureVmWorkloadSapAseSystemWorkloadItem + = new AzureVmWorkloadSapAseSystemWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseSystemWorkloadItem.workloadItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapAseSystemWorkloadItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstance.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstance.java index 31da94aead3a6..08f754d868846 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstance.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstance.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item representing SAP HANA Dbinstance. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSapHanaDBInstance.class, - visible = true) -@JsonTypeName("SAPHanaDBInstance") @Fluent public final class AzureVmWorkloadSapHanaDBInstance extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "SAPHanaDBInstance"; /** @@ -168,6 +160,91 @@ public AzureVmWorkloadSapHanaDBInstance withProtectionState(ProtectionStatus pro */ @Override public void validate() { - super.validate(); + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaDBInstance from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaDBInstance if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaDBInstance. + */ + public static AzureVmWorkloadSapHanaDBInstance fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaDBInstance deserializedAzureVmWorkloadSapHanaDBInstance + = new AzureVmWorkloadSapHanaDBInstance(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstance.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaDBInstance; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstanceProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstanceProtectedItem.java index fda080c1a45c5..3d60b861aa4bb 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstanceProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDBInstanceProtectedItem.java @@ -5,32 +5,51 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Azure VM workload-specific protected item representing SAP HANA DBInstance. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureVmWorkloadSapHanaDBInstanceProtectedItem.class, - visible = true) -@JsonTypeName("AzureVmWorkloadSAPHanaDBInstance") @Fluent public final class AzureVmWorkloadSapHanaDBInstanceProtectedItem extends AzureVmWorkloadProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "AzureVmWorkloadSAPHanaDBInstance"; + /* + * Backup status of this backup item. + */ + private String protectionStatus; + + /* + * Friendly name of the DB represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureVmWorkloadSapHanaDBInstanceProtectedItem class. */ @@ -47,6 +66,56 @@ public String protectedItemType() { return this.protectedItemType; } + /** + * Get the protectionStatus property: Backup status of this backup item. + * + * @return the protectionStatus value. + */ + @Override + public String protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the friendlyName property: Friendly name of the DB represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -307,6 +376,181 @@ public AzureVmWorkloadSapHanaDBInstanceProtectedItem withPolicyName(String polic */ @Override public void validate() { - super.validate(); + if (lastBackupErrorDetail() != null) { + lastBackupErrorDetail().validate(); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (nodesList() != null) { + nodesList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentType", parentType()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("lastBackupStatus", + lastBackupStatus() == null ? null : lastBackupStatus().toString()); + jsonWriter.writeStringField("lastBackupTime", + lastBackupTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastBackupTime())); + jsonWriter.writeJsonField("lastBackupErrorDetail", lastBackupErrorDetail()); + jsonWriter.writeStringField("protectedItemDataSourceId", protectedItemDataSourceId()); + jsonWriter.writeStringField("protectedItemHealthStatus", + protectedItemHealthStatus() == null ? null : protectedItemHealthStatus().toString()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("nodesList", nodesList(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaDBInstanceProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaDBInstanceProtectedItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaDBInstanceProtectedItem. + */ + public static AzureVmWorkloadSapHanaDBInstanceProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaDBInstanceProtectedItem deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + = new AzureVmWorkloadSapHanaDBInstanceProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.friendlyName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withServerName(reader.getString()); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withParentName(reader.getString()); + } else if ("parentType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withParentType(reader.getString()); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withLastBackupStatus(LastBackupStatus.fromString(reader.getString())); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("lastBackupErrorDetail".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withLastBackupErrorDetail(ErrorDetail.fromJson(reader)); + } else if ("protectedItemDataSourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withProtectedItemDataSourceId(reader.getString()); + } else if ("protectedItemHealthStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withProtectedItemHealthStatus(ProtectedItemHealthStatus.fromString(reader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo.fromJson(reader)); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withKpisHealths(kpisHealths); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withNodesList(nodesList); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectableItem.java index 70fbe6e612fee..5721ed70b9015 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectableItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item representing SAP HANA Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSapHanaDatabaseProtectableItem.class, - visible = true) -@JsonTypeName("SAPHanaDatabase") @Fluent public final class AzureVmWorkloadSapHanaDatabaseProtectableItem extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "SAPHanaDatabase"; /** @@ -169,6 +161,92 @@ public AzureVmWorkloadSapHanaDatabaseProtectableItem withProtectionState(Protect */ @Override public void validate() { - super.validate(); + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaDatabaseProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaDatabaseProtectableItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaDatabaseProtectableItem. + */ + public static AzureVmWorkloadSapHanaDatabaseProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaDatabaseProtectableItem deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + = new AzureVmWorkloadSapHanaDatabaseProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaDatabaseProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectedItem.java index 8690e4a1ea114..97e6a1ea4f8e0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseProtectedItem.java @@ -5,32 +5,51 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Azure VM workload-specific protected item representing SAP HANA Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureVmWorkloadSapHanaDatabaseProtectedItem.class, - visible = true) -@JsonTypeName("AzureVmWorkloadSAPHanaDatabase") @Fluent public final class AzureVmWorkloadSapHanaDatabaseProtectedItem extends AzureVmWorkloadProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "AzureVmWorkloadSAPHanaDatabase"; + /* + * Backup status of this backup item. + */ + private String protectionStatus; + + /* + * Friendly name of the DB represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureVmWorkloadSapHanaDatabaseProtectedItem class. */ @@ -47,6 +66,56 @@ public String protectedItemType() { return this.protectedItemType; } + /** + * Get the protectionStatus property: Backup status of this backup item. + * + * @return the protectionStatus value. + */ + @Override + public String protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the friendlyName property: Friendly name of the DB represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -306,6 +375,181 @@ public AzureVmWorkloadSapHanaDatabaseProtectedItem withPolicyName(String policyN */ @Override public void validate() { - super.validate(); + if (lastBackupErrorDetail() != null) { + lastBackupErrorDetail().validate(); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (nodesList() != null) { + nodesList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentType", parentType()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("lastBackupStatus", + lastBackupStatus() == null ? null : lastBackupStatus().toString()); + jsonWriter.writeStringField("lastBackupTime", + lastBackupTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastBackupTime())); + jsonWriter.writeJsonField("lastBackupErrorDetail", lastBackupErrorDetail()); + jsonWriter.writeStringField("protectedItemDataSourceId", protectedItemDataSourceId()); + jsonWriter.writeStringField("protectedItemHealthStatus", + protectedItemHealthStatus() == null ? null : protectedItemHealthStatus().toString()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("nodesList", nodesList(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaDatabaseProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaDatabaseProtectedItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaDatabaseProtectedItem. + */ + public static AzureVmWorkloadSapHanaDatabaseProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaDatabaseProtectedItem deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + = new AzureVmWorkloadSapHanaDatabaseProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.friendlyName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withServerName(reader.getString()); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withParentName(reader.getString()); + } else if ("parentType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withParentType(reader.getString()); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withLastBackupStatus(LastBackupStatus.fromString(reader.getString())); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("lastBackupErrorDetail".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withLastBackupErrorDetail(ErrorDetail.fromJson(reader)); + } else if ("protectedItemDataSourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withProtectedItemDataSourceId(reader.getString()); + } else if ("protectedItemHealthStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withProtectedItemHealthStatus(ProtectedItemHealthStatus.fromString(reader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo.fromJson(reader)); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withKpisHealths(kpisHealths); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withNodesList(nodesList); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseWorkloadItem.java index 81c9a8116889b..f100eab1ce0ce 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseWorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaDatabaseWorkloadItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific workload item representing SAP HANA Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = AzureVmWorkloadSapHanaDatabaseWorkloadItem.class, - visible = true) -@JsonTypeName("SAPHanaDatabase") @Fluent public final class AzureVmWorkloadSapHanaDatabaseWorkloadItem extends AzureVmWorkloadItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) private String workloadItemType = "SAPHanaDatabase"; /** @@ -132,6 +124,73 @@ public AzureVmWorkloadSapHanaDatabaseWorkloadItem withProtectionState(Protection */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaDatabaseWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaDatabaseWorkloadItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaDatabaseWorkloadItem. + */ + public static AzureVmWorkloadSapHanaDatabaseWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaDatabaseWorkloadItem deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem + = new AzureVmWorkloadSapHanaDatabaseWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem.workloadItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaDatabaseWorkloadItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaHsr.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaHsr.java index 29e1e13ac6d1f..a0f3b27654fd0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaHsr.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaHsr.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item representing HANA HSR. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSapHanaHsr.class, - visible = true) -@JsonTypeName("HanaHSRContainer") @Fluent public final class AzureVmWorkloadSapHanaHsr extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "HanaHSRContainer"; /** @@ -168,6 +160,88 @@ public AzureVmWorkloadSapHanaHsr withProtectionState(ProtectionStatus protection */ @Override public void validate() { - super.validate(); + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaHsr from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaHsr if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaHsr. + */ + public static AzureVmWorkloadSapHanaHsr fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaHsr deserializedAzureVmWorkloadSapHanaHsr = new AzureVmWorkloadSapHanaHsr(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaHsr.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaHsr; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaScaleoutProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaScaleoutProtectableItem.java new file mode 100644 index 0000000000000..fec67a8f19a21 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaScaleoutProtectableItem.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Azure VM workload-specific protectable item representing HANA scale out. + */ +@Fluent +public final class AzureVmWorkloadSapHanaScaleoutProtectableItem extends AzureVmWorkloadProtectableItem { + /* + * Type of the backup item. + */ + private String protectableItemType = "HanaScaleoutContainer"; + + /** + * Creates an instance of AzureVmWorkloadSapHanaScaleoutProtectableItem class. + */ + public AzureVmWorkloadSapHanaScaleoutProtectableItem() { + } + + /** + * Get the protectableItemType property: Type of the backup item. + * + * @return the protectableItemType value. + */ + @Override + public String protectableItemType() { + return this.protectableItemType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withParentName(String parentName) { + super.withParentName(parentName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withParentUniqueName(String parentUniqueName) { + super.withParentUniqueName(parentUniqueName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withServerName(String serverName) { + super.withServerName(serverName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withIsAutoProtectable(Boolean isAutoProtectable) { + super.withIsAutoProtectable(isAutoProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withIsAutoProtected(Boolean isAutoProtected) { + super.withIsAutoProtected(isAutoProtected); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withSubinquireditemcount(Integer subinquireditemcount) { + super.withSubinquireditemcount(subinquireditemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withSubprotectableitemcount(Integer subprotectableitemcount) { + super.withSubprotectableitemcount(subprotectableitemcount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem + withPrebackupvalidation(PreBackupValidation prebackupvalidation) { + super.withPrebackupvalidation(prebackupvalidation); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withIsProtectable(Boolean isProtectable) { + super.withIsProtectable(isProtectable); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withBackupManagementType(String backupManagementType) { + super.withBackupManagementType(backupManagementType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withWorkloadType(String workloadType) { + super.withWorkloadType(workloadType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withFriendlyName(String friendlyName) { + super.withFriendlyName(friendlyName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureVmWorkloadSapHanaScaleoutProtectableItem withProtectionState(ProtectionStatus protectionState) { + super.withProtectionState(protectionState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaScaleoutProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaScaleoutProtectableItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaScaleoutProtectableItem. + */ + public static AzureVmWorkloadSapHanaScaleoutProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaScaleoutProtectableItem deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + = new AzureVmWorkloadSapHanaScaleoutProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaScaleoutProtectableItem; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemProtectableItem.java index b4fac5616995f..f854590061a72 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemProtectableItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item representing SAP HANA System. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSapHanaSystemProtectableItem.class, - visible = true) -@JsonTypeName("SAPHanaSystem") @Fluent public final class AzureVmWorkloadSapHanaSystemProtectableItem extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "SAPHanaSystem"; /** @@ -169,6 +161,92 @@ public AzureVmWorkloadSapHanaSystemProtectableItem withProtectionState(Protectio */ @Override public void validate() { - super.validate(); + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaSystemProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaSystemProtectableItem if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaSystemProtectableItem. + */ + public static AzureVmWorkloadSapHanaSystemProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaSystemProtectableItem deserializedAzureVmWorkloadSapHanaSystemProtectableItem + = new AzureVmWorkloadSapHanaSystemProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaSystemProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemWorkloadItem.java index ed6da77095139..3a865af5f3c48 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemWorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSapHanaSystemWorkloadItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific workload item representing SAP HANA System. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = AzureVmWorkloadSapHanaSystemWorkloadItem.class, - visible = true) -@JsonTypeName("SAPHanaSystem") @Fluent public final class AzureVmWorkloadSapHanaSystemWorkloadItem extends AzureVmWorkloadItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) private String workloadItemType = "SAPHanaSystem"; /** @@ -132,6 +124,73 @@ public AzureVmWorkloadSapHanaSystemWorkloadItem withProtectionState(ProtectionSt */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSapHanaSystemWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSapHanaSystemWorkloadItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSapHanaSystemWorkloadItem. + */ + public static AzureVmWorkloadSapHanaSystemWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSapHanaSystemWorkloadItem deserializedAzureVmWorkloadSapHanaSystemWorkloadItem + = new AzureVmWorkloadSapHanaSystemWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaSystemWorkloadItem.workloadItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSapHanaSystemWorkloadItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlAvailabilityGroupProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlAvailabilityGroupProtectableItem.java index 420c04b1509e9..ef16689362e04 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlAvailabilityGroupProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlAvailabilityGroupProtectableItem.java @@ -5,34 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure VM workload-specific protectable item representing SQL Availability Group. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSqlAvailabilityGroupProtectableItem.class, - visible = true) -@JsonTypeName("SQLAvailabilityGroupContainer") @Fluent public final class AzureVmWorkloadSqlAvailabilityGroupProtectableItem extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "SQLAvailabilityGroupContainer"; /* * List of the nodes in case of distributed container. */ - @JsonProperty(value = "nodesList") private List nodesList; /** @@ -197,9 +188,103 @@ public AzureVmWorkloadSqlAvailabilityGroupProtectableItem withProtectionState(Pr */ @Override public void validate() { - super.validate(); if (nodesList() != null) { nodesList().forEach(e -> e.validate()); } + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + jsonWriter.writeArrayField("nodesList", this.nodesList, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSqlAvailabilityGroupProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSqlAvailabilityGroupProtectableItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSqlAvailabilityGroupProtectableItem. + */ + public static AzureVmWorkloadSqlAvailabilityGroupProtectableItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSqlAvailabilityGroupProtectableItem deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + = new AzureVmWorkloadSqlAvailabilityGroupProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem.protectableItemType + = reader.getString(); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem.nodesList = nodesList; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSqlAvailabilityGroupProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectableItem.java index 31ea2dbc498fa..f4237ab807059 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectableItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item representing SQL Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSqlDatabaseProtectableItem.class, - visible = true) -@JsonTypeName("SQLDataBase") @Fluent public final class AzureVmWorkloadSqlDatabaseProtectableItem extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "SQLDataBase"; /** @@ -168,6 +160,91 @@ public AzureVmWorkloadSqlDatabaseProtectableItem withProtectionState(ProtectionS */ @Override public void validate() { - super.validate(); + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSqlDatabaseProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSqlDatabaseProtectableItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSqlDatabaseProtectableItem. + */ + public static AzureVmWorkloadSqlDatabaseProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSqlDatabaseProtectableItem deserializedAzureVmWorkloadSqlDatabaseProtectableItem + = new AzureVmWorkloadSqlDatabaseProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSqlDatabaseProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectedItem.java index 843f811a81644..42583bf9d05b1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseProtectedItem.java @@ -5,32 +5,51 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Azure VM workload-specific protected item representing SQL Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = AzureVmWorkloadSqlDatabaseProtectedItem.class, - visible = true) -@JsonTypeName("AzureVmWorkloadSQLDatabase") @Fluent public final class AzureVmWorkloadSqlDatabaseProtectedItem extends AzureVmWorkloadProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "AzureVmWorkloadSQLDatabase"; + /* + * Backup status of this backup item. + */ + private String protectionStatus; + + /* + * Friendly name of the DB represented by this backup item. + */ + private String friendlyName; + + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of AzureVmWorkloadSqlDatabaseProtectedItem class. */ @@ -47,6 +66,56 @@ public String protectedItemType() { return this.protectedItemType; } + /** + * Get the protectionStatus property: Backup status of this backup item. + * + * @return the protectionStatus value. + */ + @Override + public String protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the friendlyName property: Friendly name of the DB represented by this backup item. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -302,6 +371,181 @@ public AzureVmWorkloadSqlDatabaseProtectedItem withSoftDeleteRetentionPeriod(Int */ @Override public void validate() { - super.validate(); + if (lastBackupErrorDetail() != null) { + lastBackupErrorDetail().validate(); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + if (kpisHealths() != null) { + kpisHealths().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (nodesList() != null) { + nodesList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentType", parentType()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("lastBackupStatus", + lastBackupStatus() == null ? null : lastBackupStatus().toString()); + jsonWriter.writeStringField("lastBackupTime", + lastBackupTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastBackupTime())); + jsonWriter.writeJsonField("lastBackupErrorDetail", lastBackupErrorDetail()); + jsonWriter.writeStringField("protectedItemDataSourceId", protectedItemDataSourceId()); + jsonWriter.writeStringField("protectedItemHealthStatus", + protectedItemHealthStatus() == null ? null : protectedItemHealthStatus().toString()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeMapField("kpisHealths", kpisHealths(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("nodesList", nodesList(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSqlDatabaseProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSqlDatabaseProtectedItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSqlDatabaseProtectedItem. + */ + public static AzureVmWorkloadSqlDatabaseProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSqlDatabaseProtectedItem deserializedAzureVmWorkloadSqlDatabaseProtectedItem + = new AzureVmWorkloadSqlDatabaseProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.vaultId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.friendlyName = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withServerName(reader.getString()); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withParentName(reader.getString()); + } else if ("parentType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withParentType(reader.getString()); + } else if ("protectionStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.protectionStatus = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withProtectionState(ProtectionState.fromString(reader.getString())); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withLastBackupStatus(LastBackupStatus.fromString(reader.getString())); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("lastBackupErrorDetail".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withLastBackupErrorDetail(ErrorDetail.fromJson(reader)); + } else if ("protectedItemDataSourceId".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withProtectedItemDataSourceId(reader.getString()); + } else if ("protectedItemHealthStatus".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withProtectedItemHealthStatus(ProtectedItemHealthStatus.fromString(reader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withExtendedInfo(AzureVmWorkloadProtectedItemExtendedInfo.fromJson(reader)); + } else if ("kpisHealths".equals(fieldName)) { + Map kpisHealths + = reader.readMap(reader1 -> KpiResourceHealthDetails.fromJson(reader1)); + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withKpisHealths(kpisHealths); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withNodesList(nodesList); + } else if ("protectedItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.protectedItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSqlDatabaseProtectedItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseWorkloadItem.java index 8d72c303f90c4..617341dd404db 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseWorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlDatabaseWorkloadItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific workload item representing SQL Database. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = AzureVmWorkloadSqlDatabaseWorkloadItem.class, - visible = true) -@JsonTypeName("SQLDataBase") @Fluent public final class AzureVmWorkloadSqlDatabaseWorkloadItem extends AzureVmWorkloadItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) private String workloadItemType = "SQLDataBase"; /** @@ -132,6 +124,73 @@ public AzureVmWorkloadSqlDatabaseWorkloadItem withProtectionState(ProtectionStat */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSqlDatabaseWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSqlDatabaseWorkloadItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSqlDatabaseWorkloadItem. + */ + public static AzureVmWorkloadSqlDatabaseWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSqlDatabaseWorkloadItem deserializedAzureVmWorkloadSqlDatabaseWorkloadItem + = new AzureVmWorkloadSqlDatabaseWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseWorkloadItem.workloadItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSqlDatabaseWorkloadItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceProtectableItem.java index 70056b395acce..1399bd2954695 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceProtectableItem.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload-specific protectable item representing SQL Instance. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = AzureVmWorkloadSqlInstanceProtectableItem.class, - visible = true) -@JsonTypeName("SQLInstance") @Fluent public final class AzureVmWorkloadSqlInstanceProtectableItem extends AzureVmWorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "SQLInstance"; /** @@ -168,6 +160,91 @@ public AzureVmWorkloadSqlInstanceProtectableItem withProtectionState(ProtectionS */ @Override public void validate() { - super.validate(); + if (prebackupvalidation() != null) { + prebackupvalidation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("parentUniqueName", parentUniqueName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeBooleanField("isAutoProtected", isAutoProtected()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subprotectableitemcount", subprotectableitemcount()); + jsonWriter.writeJsonField("prebackupvalidation", prebackupvalidation()); + jsonWriter.writeBooleanField("isProtectable", isProtectable()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSqlInstanceProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSqlInstanceProtectableItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSqlInstanceProtectableItem. + */ + public static AzureVmWorkloadSqlInstanceProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSqlInstanceProtectableItem deserializedAzureVmWorkloadSqlInstanceProtectableItem + = new AzureVmWorkloadSqlInstanceProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem.withParentName(reader.getString()); + } else if ("parentUniqueName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem.withParentUniqueName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isAutoProtected".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem + .withIsAutoProtected(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subprotectableitemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem + .withSubprotectableitemcount(reader.getNullable(JsonReader::getInt)); + } else if ("prebackupvalidation".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem + .withPrebackupvalidation(PreBackupValidation.fromJson(reader)); + } else if ("isProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem + .withIsProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("protectableItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceProtectableItem.protectableItemType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSqlInstanceProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceWorkloadItem.java index a0b397a11d026..088b78e69f0c1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceWorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadSqlInstanceWorkloadItem.java @@ -5,34 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure VM workload-specific workload item representing SQL Instance. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = AzureVmWorkloadSqlInstanceWorkloadItem.class, - visible = true) -@JsonTypeName("SQLInstance") @Fluent public final class AzureVmWorkloadSqlInstanceWorkloadItem extends AzureVmWorkloadItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) private String workloadItemType = "SQLInstance"; /* * Data Directory Paths for default directories */ - @JsonProperty(value = "dataDirectoryPaths") private List dataDirectoryPaths; /** @@ -159,9 +150,82 @@ public AzureVmWorkloadSqlInstanceWorkloadItem withProtectionState(ProtectionStat */ @Override public void validate() { - super.validate(); if (dataDirectoryPaths() != null) { dataDirectoryPaths().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("parentName", parentName()); + jsonWriter.writeStringField("serverName", serverName()); + jsonWriter.writeBooleanField("isAutoProtectable", isAutoProtectable()); + jsonWriter.writeNumberField("subinquireditemcount", subinquireditemcount()); + jsonWriter.writeNumberField("subWorkloadItemCount", subWorkloadItemCount()); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + jsonWriter.writeArrayField("dataDirectoryPaths", this.dataDirectoryPaths, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureVmWorkloadSqlInstanceWorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureVmWorkloadSqlInstanceWorkloadItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureVmWorkloadSqlInstanceWorkloadItem. + */ + public static AzureVmWorkloadSqlInstanceWorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureVmWorkloadSqlInstanceWorkloadItem deserializedAzureVmWorkloadSqlInstanceWorkloadItem + = new AzureVmWorkloadSqlInstanceWorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("parentName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem.withParentName(reader.getString()); + } else if ("serverName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem.withServerName(reader.getString()); + } else if ("isAutoProtectable".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem + .withIsAutoProtectable(reader.getNullable(JsonReader::getBoolean)); + } else if ("subinquireditemcount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem + .withSubinquireditemcount(reader.getNullable(JsonReader::getInt)); + } else if ("subWorkloadItemCount".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem + .withSubWorkloadItemCount(reader.getNullable(JsonReader::getInt)); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlInstanceWorkloadItem.workloadItemType = reader.getString(); + } else if ("dataDirectoryPaths".equals(fieldName)) { + List dataDirectoryPaths + = reader.readArray(reader1 -> SqlDataDirectory.fromJson(reader1)); + deserializedAzureVmWorkloadSqlInstanceWorkloadItem.dataDirectoryPaths = dataDirectoryPaths; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureVmWorkloadSqlInstanceWorkloadItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRecoveryPoint.java new file mode 100644 index 0000000000000..7840866dd3751 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRecoveryPoint.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Recovery point specific to PointInTime for generic any database. + */ +@Fluent +public final class AzureWorkloadAnyDatabasePointInTimeRecoveryPoint extends AzureWorkloadPointInTimeRecoveryPoint { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadAnyDatabasePointInTimeRecoveryPoint"; + + /** + * Creates an instance of AzureWorkloadAnyDatabasePointInTimeRecoveryPoint class. + */ + public AzureWorkloadAnyDatabasePointInTimeRecoveryPoint() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRecoveryPoint withTimeRanges(List timeRanges) { + super.withTimeRanges(timeRanges); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRecoveryPoint + withRecoveryPointTimeInUtc(OffsetDateTime recoveryPointTimeInUtc) { + super.withRecoveryPointTimeInUtc(recoveryPointTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRecoveryPoint withType(RestorePointType type) { + super.withType(type); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRecoveryPoint + withRecoveryPointTierDetails(List recoveryPointTierDetails) { + super.withRecoveryPointTierDetails(recoveryPointTierDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRecoveryPoint + withRecoveryPointMoveReadinessInfo(Map recoveryPointMoveReadinessInfo) { + super.withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRecoveryPoint + withRecoveryPointProperties(RecoveryPointProperties recoveryPointProperties) { + super.withRecoveryPointProperties(recoveryPointProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + if (timeRanges() != null) { + timeRanges().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeArrayField("timeRanges", timeRanges(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadAnyDatabasePointInTimeRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadAnyDatabasePointInTimeRecoveryPoint if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadAnyDatabasePointInTimeRecoveryPoint. + */ + public static AzureWorkloadAnyDatabasePointInTimeRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadAnyDatabasePointInTimeRecoveryPoint deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint + = new AzureWorkloadAnyDatabasePointInTimeRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("timeRanges".equals(fieldName)) { + List timeRanges = reader.readArray(reader1 -> PointInTimeRange.fromJson(reader1)); + deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint.withTimeRanges(timeRanges); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadAnyDatabasePointInTimeRecoveryPoint; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRestoreRequest.java new file mode 100644 index 0000000000000..efbea0343b308 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRestoreRequest.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload AnyDatabase -specific restore. Specifically for PointInTime/Log restore. + */ +@Fluent +public class AzureWorkloadAnyDatabasePointInTimeRestoreRequest extends AzureWorkloadAnyDatabaseRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadAnyDatabasePointInTimeRestoreRequest"; + + /* + * PointInTime value + */ + private OffsetDateTime pointInTime; + + /** + * Creates an instance of AzureWorkloadAnyDatabasePointInTimeRestoreRequest class. + */ + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the pointInTime property: PointInTime value. + * + * @return the pointInTime value. + */ + public OffsetDateTime pointInTime() { + return this.pointInTime; + } + + /** + * Set the pointInTime property: PointInTime value. + * + * @param pointInTime the pointInTime value to set. + * @return the AzureWorkloadAnyDatabasePointInTimeRestoreRequest object itself. + */ + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest withPointInTime(OffsetDateTime pointInTime) { + this.pointInTime = pointInTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest + withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("pointInTime", + this.pointInTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.pointInTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadAnyDatabasePointInTimeRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadAnyDatabasePointInTimeRestoreRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadAnyDatabasePointInTimeRestoreRequest. + */ + public static AzureWorkloadAnyDatabasePointInTimeRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadAnyDatabasePointInTimeRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadAnyDatabasePointInTimeRestoreRequest deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + = new AzureWorkloadAnyDatabasePointInTimeRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest.objectType = reader.getString(); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest.pointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadAnyDatabasePointInTimeRestoreRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.java new file mode 100644 index 0000000000000..f61534f6f2250 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload AnyDatabase-specific restore with integrated rehydration of recovery point. + */ +@Fluent +public final class AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + extends AzureWorkloadAnyDatabasePointInTimeRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest"; + + /* + * RP Rehydration Info + */ + private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; + + /** + * Creates an instance of AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest class. + */ + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @return the recoveryPointRehydrationInfo value. + */ + public RecoveryPointRehydrationInfo recoveryPointRehydrationInfo() { + return this.recoveryPointRehydrationInfo; + } + + /** + * Set the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @param recoveryPointRehydrationInfo the recoveryPointRehydrationInfo value to set. + * @return the AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest object itself. + */ + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withRecoveryPointRehydrationInfo(RecoveryPointRehydrationInfo recoveryPointRehydrationInfo) { + this.recoveryPointRehydrationInfo = recoveryPointRehydrationInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest withPointInTime(OffsetDateTime pointInTime) { + super.withPointInTime(pointInTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointRehydrationInfo() != null) { + recoveryPointRehydrationInfo().validate(); + } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("pointInTime", + pointInTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(pointInTime())); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest. + */ + public static AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + = new AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.withPointInTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.objectType + = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRecoveryPoint.java new file mode 100644 index 0000000000000..91810d69d669c --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRecoveryPoint.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Generic any database specific recoverypoint, specifically encapsulates full/diff recoverypoints. + */ +@Fluent +public final class AzureWorkloadAnyDatabaseRecoveryPoint extends AzureWorkloadRecoveryPoint { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadAnyDatabaseRecoveryPoint"; + + /** + * Creates an instance of AzureWorkloadAnyDatabaseRecoveryPoint class. + */ + public AzureWorkloadAnyDatabaseRecoveryPoint() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRecoveryPoint withRecoveryPointTimeInUtc(OffsetDateTime recoveryPointTimeInUtc) { + super.withRecoveryPointTimeInUtc(recoveryPointTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRecoveryPoint withType(RestorePointType type) { + super.withType(type); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRecoveryPoint + withRecoveryPointTierDetails(List recoveryPointTierDetails) { + super.withRecoveryPointTierDetails(recoveryPointTierDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRecoveryPoint + withRecoveryPointMoveReadinessInfo(Map recoveryPointMoveReadinessInfo) { + super.withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRecoveryPoint + withRecoveryPointProperties(RecoveryPointProperties recoveryPointProperties) { + super.withRecoveryPointProperties(recoveryPointProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadAnyDatabaseRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadAnyDatabaseRecoveryPoint if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadAnyDatabaseRecoveryPoint. + */ + public static AzureWorkloadAnyDatabaseRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadAnyDatabaseRecoveryPoint deserializedAzureWorkloadAnyDatabaseRecoveryPoint + = new AzureWorkloadAnyDatabaseRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadAnyDatabaseRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadAnyDatabaseRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadAnyDatabaseRecoveryPoint; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRestoreRequest.java new file mode 100644 index 0000000000000..57acd21038056 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRestoreRequest.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload AnyDatabase-specific restore. + */ +@Fluent +public class AzureWorkloadAnyDatabaseRestoreRequest extends AzureWorkloadRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadAnyDatabaseRestoreRequest"; + + /** + * Creates an instance of AzureWorkloadAnyDatabaseRestoreRequest class. + */ + public AzureWorkloadAnyDatabaseRestoreRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadAnyDatabaseRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadAnyDatabaseRestoreRequest if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadAnyDatabaseRestoreRequest. + */ + public static AzureWorkloadAnyDatabaseRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadAnyDatabasePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRestoreRequest + .fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest" + .equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadAnyDatabaseRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadAnyDatabaseRestoreRequest deserializedAzureWorkloadAnyDatabaseRestoreRequest + = new AzureWorkloadAnyDatabaseRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabaseRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabaseRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest.withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest.withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadAnyDatabaseRestoreRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.java new file mode 100644 index 0000000000000..94f2a8c14c4b0 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload AnyDatabase-specific restore with integrated rehydration of recovery point. + */ +@Fluent +public final class AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest extends AzureWorkloadAnyDatabaseRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest"; + + /* + * RP Rehydration Info + */ + private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; + + /** + * Creates an instance of AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest class. + */ + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @return the recoveryPointRehydrationInfo value. + */ + public RecoveryPointRehydrationInfo recoveryPointRehydrationInfo() { + return this.recoveryPointRehydrationInfo; + } + + /** + * Set the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @param recoveryPointRehydrationInfo the recoveryPointRehydrationInfo value to set. + * @return the AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest object itself. + */ + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + withRecoveryPointRehydrationInfo(RecoveryPointRehydrationInfo recoveryPointRehydrationInfo) { + this.recoveryPointRehydrationInfo = recoveryPointRehydrationInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointRehydrationInfo() != null) { + recoveryPointRehydrationInfo().validate(); + } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest. + */ + public static AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + = new AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.objectType = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadAnyDatabaseRestoreWithRehydrateRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAutoProtectionIntent.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAutoProtectionIntent.java index 9ac7c5f0bbcd6..53496d694e226 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAutoProtectionIntent.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadAutoProtectionIntent.java @@ -5,32 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure Recovery Services Vault specific protection intent item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectionIntentItemType", - defaultImpl = AzureWorkloadAutoProtectionIntent.class, - visible = true) -@JsonTypeName("AzureWorkloadAutoProtectionIntent") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadSQLAutoProtectionIntent", - value = AzureWorkloadSqlAutoProtectionIntent.class) }) @Fluent public class AzureWorkloadAutoProtectionIntent extends AzureRecoveryServiceVaultProtectionIntent { /* * backup protectionIntent type. */ - @JsonTypeId - @JsonProperty(value = "protectionIntentItemType", required = true) private ProtectionIntentItemType protectionIntentItemType = ProtectionIntentItemType.AZURE_WORKLOAD_AUTO_PROTECTION_INTENT; @@ -102,6 +89,87 @@ public AzureWorkloadAutoProtectionIntent withProtectionState(ProtectionStatus pr */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("itemId", itemId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectionIntentItemType", + this.protectionIntentItemType == null ? null : this.protectionIntentItemType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadAutoProtectionIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadAutoProtectionIntent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadAutoProtectionIntent. + */ + public static AzureWorkloadAutoProtectionIntent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectionIntentItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSQLAutoProtectionIntent".equals(discriminatorValue)) { + return AzureWorkloadSqlAutoProtectionIntent.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadAutoProtectionIntent fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadAutoProtectionIntent deserializedAzureWorkloadAutoProtectionIntent + = new AzureWorkloadAutoProtectionIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureWorkloadAutoProtectionIntent + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadAutoProtectionIntent.withSourceResourceId(reader.getString()); + } else if ("itemId".equals(fieldName)) { + deserializedAzureWorkloadAutoProtectionIntent.withItemId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureWorkloadAutoProtectionIntent.withPolicyId(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureWorkloadAutoProtectionIntent + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectionIntentItemType".equals(fieldName)) { + deserializedAzureWorkloadAutoProtectionIntent.protectionIntentItemType + = ProtectionIntentItemType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadAutoProtectionIntent; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadBackupRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadBackupRequest.java index 5568692e7c748..d253c2d52453f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadBackupRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadBackupRequest.java @@ -5,46 +5,38 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * AzureWorkload workload-specific backup request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadBackupRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadBackupRequest") @Fluent public final class AzureWorkloadBackupRequest extends BackupRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadBackupRequest"; /* * Type of backup, viz. Full, Differential, Log or CopyOnlyFull */ - @JsonProperty(value = "backupType") private BackupType backupType; /* * Bool for Compression setting */ - @JsonProperty(value = "enableCompression") private Boolean enableCompression; /* * Backup copy will expire after the time specified (UTC). */ - @JsonProperty(value = "recoveryPointExpiryTimeInUTC") private OffsetDateTime recoveryPointExpiryTimeInUtc; /** @@ -131,6 +123,55 @@ public AzureWorkloadBackupRequest withRecoveryPointExpiryTimeInUtc(OffsetDateTim */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("backupType", this.backupType == null ? null : this.backupType.toString()); + jsonWriter.writeBooleanField("enableCompression", this.enableCompression); + jsonWriter.writeStringField("recoveryPointExpiryTimeInUTC", + this.recoveryPointExpiryTimeInUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.recoveryPointExpiryTimeInUtc)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadBackupRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadBackupRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadBackupRequest. + */ + public static AzureWorkloadBackupRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadBackupRequest deserializedAzureWorkloadBackupRequest = new AzureWorkloadBackupRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadBackupRequest.objectType = reader.getString(); + } else if ("backupType".equals(fieldName)) { + deserializedAzureWorkloadBackupRequest.backupType = BackupType.fromString(reader.getString()); + } else if ("enableCompression".equals(fieldName)) { + deserializedAzureWorkloadBackupRequest.enableCompression + = reader.getNullable(JsonReader::getBoolean); + } else if ("recoveryPointExpiryTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadBackupRequest.recoveryPointExpiryTimeInUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadBackupRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainer.java index 7ef0272083cd1..1f9cd31628da6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainer.java @@ -5,65 +5,51 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Container for the workloads running inside Azure Compute or Classic Compute. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = AzureWorkloadContainer.class, - visible = true) -@JsonTypeName("AzureWorkloadContainer") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "SQLAGWorkLoadContainer", value = AzureSqlagWorkloadContainerProtectionContainer.class), - @JsonSubTypes.Type(name = "VMAppContainer", value = AzureVMAppContainerProtectionContainer.class) }) @Fluent public class AzureWorkloadContainer extends ProtectionContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.AZURE_WORKLOAD_CONTAINER; /* * ARM ID of the virtual machine represented by this Azure Workload Container */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /* * Time stamp when this container was updated. */ - @JsonProperty(value = "lastUpdatedTime") private OffsetDateTime lastUpdatedTime; /* * Additional details of a workload container. */ - @JsonProperty(value = "extendedInfo") private AzureWorkloadContainerExtendedInfo extendedInfo; /* * Workload type for which registration was sent. */ - @JsonProperty(value = "workloadType") private WorkloadType workloadType; /* * Re-Do Operation */ - @JsonProperty(value = "operationType") private OperationType operationType; /** @@ -238,9 +224,107 @@ public AzureWorkloadContainer withProtectableObjectType(String protectableObject */ @Override public void validate() { - super.validate(); if (extendedInfo() != null) { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("lastUpdatedTime", + this.lastUpdatedTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedTime)); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + jsonWriter.writeStringField("workloadType", this.workloadType == null ? null : this.workloadType.toString()); + jsonWriter.writeStringField("operationType", this.operationType == null ? null : this.operationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadContainer if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadContainer. + */ + public static AzureWorkloadContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("containerType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SQLAGWorkLoadContainer".equals(discriminatorValue)) { + return AzureSqlagWorkloadContainerProtectionContainer.fromJson(readerToUse.reset()); + } else if ("VMAppContainer".equals(discriminatorValue)) { + return AzureVMAppContainerProtectionContainer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadContainer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadContainer deserializedAzureWorkloadContainer = new AzureWorkloadContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedAzureWorkloadContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureWorkloadContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedAzureWorkloadContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedAzureWorkloadContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedAzureWorkloadContainer.withProtectableObjectType(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedAzureWorkloadContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadContainer.sourceResourceId = reader.getString(); + } else if ("lastUpdatedTime".equals(fieldName)) { + deserializedAzureWorkloadContainer.lastUpdatedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureWorkloadContainer.extendedInfo + = AzureWorkloadContainerExtendedInfo.fromJson(reader); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureWorkloadContainer.workloadType = WorkloadType.fromString(reader.getString()); + } else if ("operationType".equals(fieldName)) { + deserializedAzureWorkloadContainer.operationType = OperationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadContainer; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerAutoProtectionIntent.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerAutoProtectionIntent.java index 882f3a0c3e914..8be60e4f008db 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerAutoProtectionIntent.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerAutoProtectionIntent.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure workload specific protection intent item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectionIntentItemType", - defaultImpl = AzureWorkloadContainerAutoProtectionIntent.class, - visible = true) -@JsonTypeName("AzureWorkloadContainerAutoProtectionIntent") @Fluent public final class AzureWorkloadContainerAutoProtectionIntent extends ProtectionIntent { /* * backup protectionIntent type. */ - @JsonTypeId - @JsonProperty(value = "protectionIntentItemType", required = true) private ProtectionIntentItemType protectionIntentItemType = ProtectionIntentItemType.AZURE_WORKLOAD_CONTAINER_AUTO_PROTECTION_INTENT; @@ -98,6 +90,62 @@ public AzureWorkloadContainerAutoProtectionIntent withProtectionState(Protection */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("itemId", itemId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectionIntentItemType", + this.protectionIntentItemType == null ? null : this.protectionIntentItemType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadContainerAutoProtectionIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadContainerAutoProtectionIntent if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadContainerAutoProtectionIntent. + */ + public static AzureWorkloadContainerAutoProtectionIntent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadContainerAutoProtectionIntent deserializedAzureWorkloadContainerAutoProtectionIntent + = new AzureWorkloadContainerAutoProtectionIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureWorkloadContainerAutoProtectionIntent + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadContainerAutoProtectionIntent.withSourceResourceId(reader.getString()); + } else if ("itemId".equals(fieldName)) { + deserializedAzureWorkloadContainerAutoProtectionIntent.withItemId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureWorkloadContainerAutoProtectionIntent.withPolicyId(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureWorkloadContainerAutoProtectionIntent + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectionIntentItemType".equals(fieldName)) { + deserializedAzureWorkloadContainerAutoProtectionIntent.protectionIntentItemType + = ProtectionIntentItemType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadContainerAutoProtectionIntent; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerExtendedInfo.java index d9658dade3a62..d46e065719fe2 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadContainerExtendedInfo.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Extended information of the container. */ @Fluent -public final class AzureWorkloadContainerExtendedInfo { +public final class AzureWorkloadContainerExtendedInfo implements JsonSerializable { /* * Host Os Name in case of Stand Alone and Cluster Name in case of distributed container. */ - @JsonProperty(value = "hostServerName") private String hostServerName; /* * Inquiry Status for the container. */ - @JsonProperty(value = "inquiryInfo") private InquiryInfo inquiryInfo; /* * List of the nodes in case of distributed container. */ - @JsonProperty(value = "nodesList") private List nodesList; /** @@ -112,4 +113,49 @@ public void validate() { nodesList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("hostServerName", this.hostServerName); + jsonWriter.writeJsonField("inquiryInfo", this.inquiryInfo); + jsonWriter.writeArrayField("nodesList", this.nodesList, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadContainerExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadContainerExtendedInfo if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadContainerExtendedInfo. + */ + public static AzureWorkloadContainerExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadContainerExtendedInfo deserializedAzureWorkloadContainerExtendedInfo + = new AzureWorkloadContainerExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hostServerName".equals(fieldName)) { + deserializedAzureWorkloadContainerExtendedInfo.hostServerName = reader.getString(); + } else if ("inquiryInfo".equals(fieldName)) { + deserializedAzureWorkloadContainerExtendedInfo.inquiryInfo = InquiryInfo.fromJson(reader); + } else if ("nodesList".equals(fieldName)) { + List nodesList + = reader.readArray(reader1 -> DistributedNodesInfo.fromJson(reader1)); + deserializedAzureWorkloadContainerExtendedInfo.nodesList = nodesList; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadContainerExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadErrorInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadErrorInfo.java index c7f461741fc2b..16ca4c8154693 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadErrorInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadErrorInfo.java @@ -5,42 +5,41 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure storage specific error information. */ @Fluent -public final class AzureWorkloadErrorInfo { +public final class AzureWorkloadErrorInfo implements JsonSerializable { /* * Error code. */ - @JsonProperty(value = "errorCode") private Integer errorCode; /* * Localized error string. */ - @JsonProperty(value = "errorString") private String errorString; /* * Title: Typically, the entity that the error pertains to. */ - @JsonProperty(value = "errorTitle") private String errorTitle; /* * List of localized recommendations for above error code. */ - @JsonProperty(value = "recommendations") private List recommendations; /* * Additional details for above error code. */ - @JsonProperty(value = "additionalDetails") private String additionalDetails; /** @@ -156,4 +155,54 @@ public AzureWorkloadErrorInfo withAdditionalDetails(String additionalDetails) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorString", this.errorString); + jsonWriter.writeStringField("errorTitle", this.errorTitle); + jsonWriter.writeArrayField("recommendations", this.recommendations, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("additionalDetails", this.additionalDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadErrorInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadErrorInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadErrorInfo. + */ + public static AzureWorkloadErrorInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadErrorInfo deserializedAzureWorkloadErrorInfo = new AzureWorkloadErrorInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedAzureWorkloadErrorInfo.errorCode = reader.getNullable(JsonReader::getInt); + } else if ("errorString".equals(fieldName)) { + deserializedAzureWorkloadErrorInfo.errorString = reader.getString(); + } else if ("errorTitle".equals(fieldName)) { + deserializedAzureWorkloadErrorInfo.errorTitle = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadErrorInfo.recommendations = recommendations; + } else if ("additionalDetails".equals(fieldName)) { + deserializedAzureWorkloadErrorInfo.additionalDetails = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadErrorInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJob.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJob.java index 72688886a058f..21140457b39e0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJob.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJob.java @@ -5,56 +5,50 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Azure storage specific job. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = AzureWorkloadJob.class, visible = true) -@JsonTypeName("AzureWorkloadJob") @Fluent public final class AzureWorkloadJob extends Job { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) private String jobType = "AzureWorkloadJob"; /* * Workload type of the job */ - @JsonProperty(value = "workloadType") private String workloadType; /* * Time elapsed during the execution of this job. */ - @JsonProperty(value = "duration") private Duration duration; /* * Gets or sets the state/actions applicable on this job like cancel/retry. */ - @JsonProperty(value = "actionsInfo") private List actionsInfo; /* * Error details on execution of this job. */ - @JsonProperty(value = "errorDetails") private List errorDetails; /* * Additional information about the job. */ - @JsonProperty(value = "extendedInfo") private AzureWorkloadJobExtendedInfo extendedInfo; /** @@ -244,7 +238,6 @@ public AzureWorkloadJob withActivityId(String activityId) { */ @Override public void validate() { - super.validate(); if (errorDetails() != null) { errorDetails().forEach(e -> e.validate()); } @@ -252,4 +245,88 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityFriendlyName", entityFriendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("operation", operation()); + jsonWriter.writeStringField("status", status()); + jsonWriter.writeStringField("startTime", + startTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(startTime())); + jsonWriter.writeStringField("endTime", + endTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(endTime())); + jsonWriter.writeStringField("activityId", activityId()); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeStringField("workloadType", this.workloadType); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeArrayField("actionsInfo", this.actionsInfo, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("errorDetails", this.errorDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadJob if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadJob. + */ + public static AzureWorkloadJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadJob deserializedAzureWorkloadJob = new AzureWorkloadJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityFriendlyName".equals(fieldName)) { + deserializedAzureWorkloadJob.withEntityFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedAzureWorkloadJob + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("operation".equals(fieldName)) { + deserializedAzureWorkloadJob.withOperation(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedAzureWorkloadJob.withStatus(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedAzureWorkloadJob.withStartTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("endTime".equals(fieldName)) { + deserializedAzureWorkloadJob.withEndTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("activityId".equals(fieldName)) { + deserializedAzureWorkloadJob.withActivityId(reader.getString()); + } else if ("jobType".equals(fieldName)) { + deserializedAzureWorkloadJob.jobType = reader.getString(); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureWorkloadJob.workloadType = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedAzureWorkloadJob.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("actionsInfo".equals(fieldName)) { + List actionsInfo + = reader.readArray(reader1 -> JobSupportedAction.fromString(reader1.getString())); + deserializedAzureWorkloadJob.actionsInfo = actionsInfo; + } else if ("errorDetails".equals(fieldName)) { + List errorDetails + = reader.readArray(reader1 -> AzureWorkloadErrorInfo.fromJson(reader1)); + deserializedAzureWorkloadJob.errorDetails = errorDetails; + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureWorkloadJob.extendedInfo = AzureWorkloadJobExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadJob; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobExtendedInfo.java index f5c4fdd8caeab..0a4fec23f04b3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobExtendedInfo.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -14,24 +17,20 @@ * Azure VM workload-specific additional information for job. */ @Fluent -public final class AzureWorkloadJobExtendedInfo { +public final class AzureWorkloadJobExtendedInfo implements JsonSerializable { /* * List of tasks for this job */ - @JsonProperty(value = "tasksList") private List tasksList; /* * Job properties. */ - @JsonProperty(value = "propertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map propertyBag; /* * Non localized error message on job execution. */ - @JsonProperty(value = "dynamicErrorMessage") private String dynamicErrorMessage; /** @@ -110,4 +109,49 @@ public void validate() { tasksList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tasksList", this.tasksList, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("propertyBag", this.propertyBag, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("dynamicErrorMessage", this.dynamicErrorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadJobExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadJobExtendedInfo if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadJobExtendedInfo. + */ + public static AzureWorkloadJobExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadJobExtendedInfo deserializedAzureWorkloadJobExtendedInfo = new AzureWorkloadJobExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tasksList".equals(fieldName)) { + List tasksList + = reader.readArray(reader1 -> AzureWorkloadJobTaskDetails.fromJson(reader1)); + deserializedAzureWorkloadJobExtendedInfo.tasksList = tasksList; + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadJobExtendedInfo.propertyBag = propertyBag; + } else if ("dynamicErrorMessage".equals(fieldName)) { + deserializedAzureWorkloadJobExtendedInfo.dynamicErrorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadJobExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobTaskDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobTaskDetails.java index e1ebfe875e933..e83ba3c514d50 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobTaskDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadJobTaskDetails.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure VM workload specific job task details. */ @Fluent -public final class AzureWorkloadJobTaskDetails { +public final class AzureWorkloadJobTaskDetails implements JsonSerializable { /* * The task display name. */ - @JsonProperty(value = "taskId") private String taskId; /* * The status. */ - @JsonProperty(value = "status") private String status; /** @@ -77,4 +79,43 @@ public AzureWorkloadJobTaskDetails withStatus(String status) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("taskId", this.taskId); + jsonWriter.writeStringField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadJobTaskDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadJobTaskDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadJobTaskDetails. + */ + public static AzureWorkloadJobTaskDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadJobTaskDetails deserializedAzureWorkloadJobTaskDetails = new AzureWorkloadJobTaskDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taskId".equals(fieldName)) { + deserializedAzureWorkloadJobTaskDetails.taskId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedAzureWorkloadJobTaskDetails.status = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadJobTaskDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRecoveryPoint.java new file mode 100644 index 0000000000000..e71887f071b37 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRecoveryPoint.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Recovery point specific to PointInTime for Oracle. + */ +@Fluent +public final class AzureWorkloadOraclePointInTimeRecoveryPoint extends AzureWorkloadPointInTimeRecoveryPoint { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadOraclePointInTimeRecoveryPoint"; + + /** + * Creates an instance of AzureWorkloadOraclePointInTimeRecoveryPoint class. + */ + public AzureWorkloadOraclePointInTimeRecoveryPoint() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRecoveryPoint withTimeRanges(List timeRanges) { + super.withTimeRanges(timeRanges); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRecoveryPoint + withRecoveryPointTimeInUtc(OffsetDateTime recoveryPointTimeInUtc) { + super.withRecoveryPointTimeInUtc(recoveryPointTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRecoveryPoint withType(RestorePointType type) { + super.withType(type); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRecoveryPoint + withRecoveryPointTierDetails(List recoveryPointTierDetails) { + super.withRecoveryPointTierDetails(recoveryPointTierDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRecoveryPoint + withRecoveryPointMoveReadinessInfo(Map recoveryPointMoveReadinessInfo) { + super.withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRecoveryPoint + withRecoveryPointProperties(RecoveryPointProperties recoveryPointProperties) { + super.withRecoveryPointProperties(recoveryPointProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + if (timeRanges() != null) { + timeRanges().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeArrayField("timeRanges", timeRanges(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadOraclePointInTimeRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadOraclePointInTimeRecoveryPoint if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadOraclePointInTimeRecoveryPoint. + */ + public static AzureWorkloadOraclePointInTimeRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadOraclePointInTimeRecoveryPoint deserializedAzureWorkloadOraclePointInTimeRecoveryPoint + = new AzureWorkloadOraclePointInTimeRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadOraclePointInTimeRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadOraclePointInTimeRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("timeRanges".equals(fieldName)) { + List timeRanges = reader.readArray(reader1 -> PointInTimeRange.fromJson(reader1)); + deserializedAzureWorkloadOraclePointInTimeRecoveryPoint.withTimeRanges(timeRanges); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadOraclePointInTimeRecoveryPoint; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRestoreRequest.java new file mode 100644 index 0000000000000..fd78216e0d4df --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRestoreRequest.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload Oracle -specific restore. Specifically for PointInTime/Log restore. + */ +@Fluent +public class AzureWorkloadOraclePointInTimeRestoreRequest extends AzureWorkloadOracleRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadOraclePointInTimeRestoreRequest"; + + /* + * PointInTime value + */ + private OffsetDateTime pointInTime; + + /** + * Creates an instance of AzureWorkloadOraclePointInTimeRestoreRequest class. + */ + public AzureWorkloadOraclePointInTimeRestoreRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the pointInTime property: PointInTime value. + * + * @return the pointInTime value. + */ + public OffsetDateTime pointInTime() { + return this.pointInTime; + } + + /** + * Set the pointInTime property: PointInTime value. + * + * @param pointInTime the pointInTime value to set. + * @return the AzureWorkloadOraclePointInTimeRestoreRequest object itself. + */ + public AzureWorkloadOraclePointInTimeRestoreRequest withPointInTime(OffsetDateTime pointInTime) { + this.pointInTime = pointInTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("pointInTime", + this.pointInTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.pointInTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadOraclePointInTimeRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadOraclePointInTimeRestoreRequest if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadOraclePointInTimeRestoreRequest. + */ + public static AzureWorkloadOraclePointInTimeRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadOraclePointInTimeRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadOraclePointInTimeRestoreRequest deserializedAzureWorkloadOraclePointInTimeRestoreRequest + = new AzureWorkloadOraclePointInTimeRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadOraclePointInTimeRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest.objectType = reader.getString(); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreRequest.pointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadOraclePointInTimeRestoreRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.java new file mode 100644 index 0000000000000..294cdef9e6e8a --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload Oracle-specific restore with integrated rehydration of recovery point. + */ +@Fluent +public final class AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + extends AzureWorkloadOraclePointInTimeRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest"; + + /* + * RP Rehydration Info + */ + private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; + + /** + * Creates an instance of AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest class. + */ + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @return the recoveryPointRehydrationInfo value. + */ + public RecoveryPointRehydrationInfo recoveryPointRehydrationInfo() { + return this.recoveryPointRehydrationInfo; + } + + /** + * Set the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @param recoveryPointRehydrationInfo the recoveryPointRehydrationInfo value to set. + * @return the AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest object itself. + */ + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + withRecoveryPointRehydrationInfo(RecoveryPointRehydrationInfo recoveryPointRehydrationInfo) { + this.recoveryPointRehydrationInfo = recoveryPointRehydrationInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest withPointInTime(OffsetDateTime pointInTime) { + super.withPointInTime(pointInTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointRehydrationInfo() != null) { + recoveryPointRehydrationInfo().validate(); + } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("pointInTime", + pointInTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(pointInTime())); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest. + */ + public static AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + = new AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.withPointInTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.objectType + = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRecoveryPoint.java new file mode 100644 index 0000000000000..7e04289d4224f --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRecoveryPoint.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Oracle specific recoverypoint, specifically encapsulates full/diff recoverypoints. + */ +@Fluent +public final class AzureWorkloadOracleRecoveryPoint extends AzureWorkloadRecoveryPoint { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadOracleRecoveryPoint"; + + /** + * Creates an instance of AzureWorkloadOracleRecoveryPoint class. + */ + public AzureWorkloadOracleRecoveryPoint() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRecoveryPoint withRecoveryPointTimeInUtc(OffsetDateTime recoveryPointTimeInUtc) { + super.withRecoveryPointTimeInUtc(recoveryPointTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRecoveryPoint withType(RestorePointType type) { + super.withType(type); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRecoveryPoint + withRecoveryPointTierDetails(List recoveryPointTierDetails) { + super.withRecoveryPointTierDetails(recoveryPointTierDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRecoveryPoint + withRecoveryPointMoveReadinessInfo(Map recoveryPointMoveReadinessInfo) { + super.withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRecoveryPoint + withRecoveryPointProperties(RecoveryPointProperties recoveryPointProperties) { + super.withRecoveryPointProperties(recoveryPointProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadOracleRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadOracleRecoveryPoint if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadOracleRecoveryPoint. + */ + public static AzureWorkloadOracleRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadOracleRecoveryPoint deserializedAzureWorkloadOracleRecoveryPoint + = new AzureWorkloadOracleRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadOracleRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadOracleRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadOracleRecoveryPoint.withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadOracleRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadOracleRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadOracleRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadOracleRecoveryPoint; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRestoreRequest.java new file mode 100644 index 0000000000000..83abdb94f1265 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRestoreRequest.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload Oracle-specific restore. + */ +@Fluent +public class AzureWorkloadOracleRestoreRequest extends AzureWorkloadRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadOracleRestoreRequest"; + + /** + * Creates an instance of AzureWorkloadOracleRestoreRequest class. + */ + public AzureWorkloadOracleRestoreRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadOracleRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadOracleRestoreRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadOracleRestoreRequest. + */ + public static AzureWorkloadOracleRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadOraclePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOracleRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadOracleRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadOracleRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadOracleRestoreRequest deserializedAzureWorkloadOracleRestoreRequest + = new AzureWorkloadOracleRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadOracleRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadOracleRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest.withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest.withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest.withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadOracleRestoreRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRestoreWithRehydrateRequest.java new file mode 100644 index 0000000000000..8ceecfaa0a5a7 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadOracleRestoreWithRehydrateRequest.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload Oracle-specific restore with integrated rehydration of recovery point. + */ +@Fluent +public final class AzureWorkloadOracleRestoreWithRehydrateRequest extends AzureWorkloadOracleRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadOracleRestoreWithRehydrateRequest"; + + /* + * RP Rehydration Info + */ + private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; + + /** + * Creates an instance of AzureWorkloadOracleRestoreWithRehydrateRequest class. + */ + public AzureWorkloadOracleRestoreWithRehydrateRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @return the recoveryPointRehydrationInfo value. + */ + public RecoveryPointRehydrationInfo recoveryPointRehydrationInfo() { + return this.recoveryPointRehydrationInfo; + } + + /** + * Set the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @param recoveryPointRehydrationInfo the recoveryPointRehydrationInfo value to set. + * @return the AzureWorkloadOracleRestoreWithRehydrateRequest object itself. + */ + public AzureWorkloadOracleRestoreWithRehydrateRequest + withRecoveryPointRehydrationInfo(RecoveryPointRehydrationInfo recoveryPointRehydrationInfo) { + this.recoveryPointRehydrationInfo = recoveryPointRehydrationInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadOracleRestoreWithRehydrateRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointRehydrationInfo() != null) { + recoveryPointRehydrationInfo().validate(); + } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadOracleRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadOracleRestoreWithRehydrateRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadOracleRestoreWithRehydrateRequest. + */ + public static AzureWorkloadOracleRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadOracleRestoreWithRehydrateRequest deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + = new AzureWorkloadOracleRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest.objectType = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadOracleRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadOracleRestoreWithRehydrateRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRecoveryPoint.java index 084613c6fe4a5..734b229988668 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRecoveryPoint.java @@ -5,41 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Recovery point specific to PointInTime. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadPointInTimeRecoveryPoint.class, - visible = true) -@JsonTypeName("AzureWorkloadPointInTimeRecoveryPoint") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint", - value = AzureWorkloadSapHanaPointInTimeRecoveryPoint.class) }) @Fluent public class AzureWorkloadPointInTimeRecoveryPoint extends AzureWorkloadRecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadPointInTimeRecoveryPoint"; /* * List of log ranges */ - @JsonProperty(value = "timeRanges") private List timeRanges; /** @@ -134,9 +123,122 @@ public AzureWorkloadPointInTimeRecoveryPoint withType(RestorePointType type) { */ @Override public void validate() { - super.validate(); if (timeRanges() != null) { timeRanges().forEach(e -> e.validate()); } + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeArrayField("timeRanges", this.timeRanges, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadPointInTimeRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadPointInTimeRecoveryPoint if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadPointInTimeRecoveryPoint. + */ + public static AzureWorkloadPointInTimeRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSAPHanaPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadPointInTimeRecoveryPoint fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadPointInTimeRecoveryPoint deserializedAzureWorkloadPointInTimeRecoveryPoint + = new AzureWorkloadPointInTimeRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadPointInTimeRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadPointInTimeRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRecoveryPoint.objectType = reader.getString(); + } else if ("timeRanges".equals(fieldName)) { + List timeRanges = reader.readArray(reader1 -> PointInTimeRange.fromJson(reader1)); + deserializedAzureWorkloadPointInTimeRecoveryPoint.timeRanges = timeRanges; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadPointInTimeRecoveryPoint; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRestoreRequest.java index 457513aa7115c..16d452b8ca5b9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRestoreRequest.java @@ -5,36 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadPointInTimeRestoreRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadPointInTimeRestoreRequest") @Fluent public final class AzureWorkloadPointInTimeRestoreRequest extends AzureWorkloadRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadPointInTimeRestoreRequest"; /* * PointInTime value */ - @JsonProperty(value = "pointInTime") private OffsetDateTime pointInTime; /** @@ -174,6 +168,95 @@ public AzureWorkloadPointInTimeRestoreRequest withTargetVirtualMachineId(String */ @Override public void validate() { - super.validate(); + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("pointInTime", + this.pointInTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.pointInTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadPointInTimeRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadPointInTimeRestoreRequest if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadPointInTimeRestoreRequest. + */ + public static AzureWorkloadPointInTimeRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadPointInTimeRestoreRequest deserializedAzureWorkloadPointInTimeRestoreRequest + = new AzureWorkloadPointInTimeRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadPointInTimeRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadPointInTimeRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest.withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest.withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest.objectType = reader.getString(); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadPointInTimeRestoreRequest.pointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadPointInTimeRestoreRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRecoveryPoint.java index 9b98316fd70d3..62b93003d4d1a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRecoveryPoint.java @@ -5,69 +5,50 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Workload specific recovery point, specifically encapsulates full/diff recovery point. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadRecoveryPoint.class, - visible = true) -@JsonTypeName("AzureWorkloadRecoveryPoint") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadPointInTimeRecoveryPoint", - value = AzureWorkloadPointInTimeRecoveryPoint.class), - @JsonSubTypes.Type(name = "AzureWorkloadSAPHanaRecoveryPoint", value = AzureWorkloadSapHanaRecoveryPoint.class), - @JsonSubTypes.Type(name = "AzureWorkloadSQLRecoveryPoint", value = AzureWorkloadSqlRecoveryPoint.class) }) @Fluent public class AzureWorkloadRecoveryPoint extends RecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadRecoveryPoint"; /* * UTC time at which recovery point was created */ - @JsonProperty(value = "recoveryPointTimeInUTC") private OffsetDateTime recoveryPointTimeInUtc; /* * Type of restore point */ - @JsonProperty(value = "type") private RestorePointType type; /* * Recovery point tier information. */ - @JsonProperty(value = "recoveryPointTierDetails") private List recoveryPointTierDetails; /* * Eligibility of RP to be moved to another tier */ - @JsonProperty(value = "recoveryPointMoveReadinessInfo") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map recoveryPointMoveReadinessInfo; /* * Properties of Recovery Point */ - @JsonProperty(value = "recoveryPointProperties") private RecoveryPointProperties recoveryPointProperties; /** @@ -196,7 +177,6 @@ public AzureWorkloadRecoveryPoint withRecoveryPointProperties(RecoveryPointPrope */ @Override public void validate() { - super.validate(); if (recoveryPointTierDetails() != null) { recoveryPointTierDetails().forEach(e -> e.validate()); } @@ -211,4 +191,112 @@ public void validate() { recoveryPointProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + this.recoveryPointTimeInUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.recoveryPointTimeInUtc)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", this.recoveryPointTierDetails, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", this.recoveryPointMoveReadinessInfo, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", this.recoveryPointProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadRecoveryPoint if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadRecoveryPoint. + */ + public static AzureWorkloadRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadPointInTimeRecoveryPoint.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAseRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapAseRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOracleRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadOracleRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabaseRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabaseRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapHanaRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSQLRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSqlRecoveryPoint.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadRecoveryPoint fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadRecoveryPoint deserializedAzureWorkloadRecoveryPoint = new AzureWorkloadRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadRecoveryPoint.objectType = reader.getString(); + } else if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadRecoveryPoint.recoveryPointTimeInUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadRecoveryPoint.type = RestorePointType.fromString(reader.getString()); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadRecoveryPoint.recoveryPointTierDetails = recoveryPointTierDetails; + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadRecoveryPoint.recoveryPointMoveReadinessInfo + = recoveryPointMoveReadinessInfo; + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadRecoveryPoint.recoveryPointProperties + = RecoveryPointProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadRecoveryPoint; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRestoreRequest.java index c81dbbc3ffa2c..26b9bfb27ba3b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadRestoreRequest.java @@ -5,95 +5,70 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; /** * AzureWorkload-specific restore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadRestoreRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadRestoreRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadPointInTimeRestoreRequest", - value = AzureWorkloadPointInTimeRestoreRequest.class), - @JsonSubTypes.Type(name = "AzureWorkloadSAPHanaRestoreRequest", value = AzureWorkloadSapHanaRestoreRequest.class), - @JsonSubTypes.Type(name = "AzureWorkloadSQLRestoreRequest", value = AzureWorkloadSqlRestoreRequest.class) }) @Fluent public class AzureWorkloadRestoreRequest extends RestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadRestoreRequest"; /* * Type of this recovery. */ - @JsonProperty(value = "recoveryType") private RecoveryType recoveryType; /* * Fully qualified ARM ID of the VM on which workload that was running is being recovered. */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /* * Workload specific property bag. */ - @JsonProperty(value = "propertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map propertyBag; /* * Details of target database */ - @JsonProperty(value = "targetInfo") private TargetRestoreInfo targetInfo; /* * Defines whether the current recovery mode is file restore or database restore */ - @JsonProperty(value = "recoveryMode") private RecoveryMode recoveryMode; /* * Defines the Resource group of the Target VM */ - @JsonProperty(value = "targetResourceGroupName") private String targetResourceGroupName; /* * User Assigned managed identity details * Currently used for snapshot. */ - @JsonProperty(value = "userAssignedManagedIdentityDetails") private UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails; /* * Additional details for snapshot recovery * Currently used for snapshot for SAP Hana. */ - @JsonProperty(value = "snapshotRestoreParameters") private SnapshotRestoreParameters snapshotRestoreParameters; /* * This is the complete ARM Id of the target VM * For e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} */ - @JsonProperty(value = "targetVirtualMachineId") private String targetVirtualMachineId; /** @@ -319,7 +294,6 @@ public AzureWorkloadRestoreRequest withResourceGuardOperationRequests(List writer.writeString(element)); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryType", this.recoveryType == null ? null : this.recoveryType.toString()); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeMapField("propertyBag", this.propertyBag, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", this.targetInfo); + jsonWriter.writeStringField("recoveryMode", this.recoveryMode == null ? null : this.recoveryMode.toString()); + jsonWriter.writeStringField("targetResourceGroupName", this.targetResourceGroupName); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", this.userAssignedManagedIdentityDetails); + jsonWriter.writeJsonField("snapshotRestoreParameters", this.snapshotRestoreParameters); + jsonWriter.writeStringField("targetVirtualMachineId", this.targetVirtualMachineId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadRestoreRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadRestoreRequest. + */ + public static AzureWorkloadRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadPointInTimeRestoreRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRestoreRequest + .fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAseRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAseRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAseRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAseRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOracleRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadOracleRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOracleRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadOracleRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabaseRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabaseRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRestoreRequest + .fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest" + .equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSQLRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSQLRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadRestoreRequest deserializedAzureWorkloadRestoreRequest = new AzureWorkloadRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.objectType = reader.getString(); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.recoveryType = RecoveryType.fromString(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.sourceResourceId = reader.getString(); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadRestoreRequest.propertyBag = propertyBag; + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.targetInfo = TargetRestoreInfo.fromJson(reader); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.recoveryMode = RecoveryMode.fromString(reader.getString()); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.targetResourceGroupName = reader.getString(); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.userAssignedManagedIdentityDetails + = UserAssignedManagedIdentityDetails.fromJson(reader); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.snapshotRestoreParameters + = SnapshotRestoreParameters.fromJson(reader); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadRestoreRequest.targetVirtualMachineId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadRestoreRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRecoveryPoint.java new file mode 100644 index 0000000000000..5465a87d0cbb5 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRecoveryPoint.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Recovery point specific to PointInTime in SAPAse. + */ +@Fluent +public final class AzureWorkloadSapAsePointInTimeRecoveryPoint extends AzureWorkloadPointInTimeRecoveryPoint { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadSAPAsePointInTimeRecoveryPoint"; + + /** + * Creates an instance of AzureWorkloadSapAsePointInTimeRecoveryPoint class. + */ + public AzureWorkloadSapAsePointInTimeRecoveryPoint() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRecoveryPoint withTimeRanges(List timeRanges) { + super.withTimeRanges(timeRanges); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRecoveryPoint + withRecoveryPointTimeInUtc(OffsetDateTime recoveryPointTimeInUtc) { + super.withRecoveryPointTimeInUtc(recoveryPointTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRecoveryPoint withType(RestorePointType type) { + super.withType(type); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRecoveryPoint + withRecoveryPointTierDetails(List recoveryPointTierDetails) { + super.withRecoveryPointTierDetails(recoveryPointTierDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRecoveryPoint + withRecoveryPointMoveReadinessInfo(Map recoveryPointMoveReadinessInfo) { + super.withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRecoveryPoint + withRecoveryPointProperties(RecoveryPointProperties recoveryPointProperties) { + super.withRecoveryPointProperties(recoveryPointProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + if (timeRanges() != null) { + timeRanges().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeArrayField("timeRanges", timeRanges(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapAsePointInTimeRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapAsePointInTimeRecoveryPoint if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapAsePointInTimeRecoveryPoint. + */ + public static AzureWorkloadSapAsePointInTimeRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapAsePointInTimeRecoveryPoint deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint + = new AzureWorkloadSapAsePointInTimeRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("timeRanges".equals(fieldName)) { + List timeRanges = reader.readArray(reader1 -> PointInTimeRange.fromJson(reader1)); + deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint.withTimeRanges(timeRanges); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapAsePointInTimeRecoveryPoint; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRestoreRequest.java new file mode 100644 index 0000000000000..a7c093ad62e7e --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRestoreRequest.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload SAP Ase -specific restore. Specifically for PointInTime/Log restore. + */ +@Fluent +public class AzureWorkloadSapAsePointInTimeRestoreRequest extends AzureWorkloadSapAseRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadSAPAsePointInTimeRestoreRequest"; + + /* + * PointInTime value + */ + private OffsetDateTime pointInTime; + + /** + * Creates an instance of AzureWorkloadSapAsePointInTimeRestoreRequest class. + */ + public AzureWorkloadSapAsePointInTimeRestoreRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the pointInTime property: PointInTime value. + * + * @return the pointInTime value. + */ + public OffsetDateTime pointInTime() { + return this.pointInTime; + } + + /** + * Set the pointInTime property: PointInTime value. + * + * @param pointInTime the pointInTime value to set. + * @return the AzureWorkloadSapAsePointInTimeRestoreRequest object itself. + */ + public AzureWorkloadSapAsePointInTimeRestoreRequest withPointInTime(OffsetDateTime pointInTime) { + this.pointInTime = pointInTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("pointInTime", + this.pointInTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.pointInTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapAsePointInTimeRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapAsePointInTimeRestoreRequest if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapAsePointInTimeRestoreRequest. + */ + public static AzureWorkloadSapAsePointInTimeRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSAPAsePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadSapAsePointInTimeRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapAsePointInTimeRestoreRequest deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + = new AzureWorkloadSapAsePointInTimeRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest.objectType = reader.getString(); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreRequest.pointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapAsePointInTimeRestoreRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.java new file mode 100644 index 0000000000000..90c37efee65d3 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload SAP Ase-specific restore with integrated rehydration of recovery point. + */ +@Fluent +public final class AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + extends AzureWorkloadSapAsePointInTimeRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadSAPAsePointInTimeRestoreWithRehydrateRequest"; + + /* + * RP Rehydration Info + */ + private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; + + /** + * Creates an instance of AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest class. + */ + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @return the recoveryPointRehydrationInfo value. + */ + public RecoveryPointRehydrationInfo recoveryPointRehydrationInfo() { + return this.recoveryPointRehydrationInfo; + } + + /** + * Set the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @param recoveryPointRehydrationInfo the recoveryPointRehydrationInfo value to set. + * @return the AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest object itself. + */ + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + withRecoveryPointRehydrationInfo(RecoveryPointRehydrationInfo recoveryPointRehydrationInfo) { + this.recoveryPointRehydrationInfo = recoveryPointRehydrationInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest withPointInTime(OffsetDateTime pointInTime) { + super.withPointInTime(pointInTime); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointRehydrationInfo() != null) { + recoveryPointRehydrationInfo().validate(); + } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("pointInTime", + pointInTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(pointInTime())); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest. + */ + public static AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + = new AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.withPointInTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.objectType + = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRecoveryPoint.java new file mode 100644 index 0000000000000..169622864d260 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRecoveryPoint.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * SAPAse specific recoverypoint, specifically encapsulates full/diff recoverypoints. + */ +@Fluent +public final class AzureWorkloadSapAseRecoveryPoint extends AzureWorkloadRecoveryPoint { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadSAPAseRecoveryPoint"; + + /** + * Creates an instance of AzureWorkloadSapAseRecoveryPoint class. + */ + public AzureWorkloadSapAseRecoveryPoint() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRecoveryPoint withRecoveryPointTimeInUtc(OffsetDateTime recoveryPointTimeInUtc) { + super.withRecoveryPointTimeInUtc(recoveryPointTimeInUtc); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRecoveryPoint withType(RestorePointType type) { + super.withType(type); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRecoveryPoint + withRecoveryPointTierDetails(List recoveryPointTierDetails) { + super.withRecoveryPointTierDetails(recoveryPointTierDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRecoveryPoint + withRecoveryPointMoveReadinessInfo(Map recoveryPointMoveReadinessInfo) { + super.withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRecoveryPoint + withRecoveryPointProperties(RecoveryPointProperties recoveryPointProperties) { + super.withRecoveryPointProperties(recoveryPointProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapAseRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapAseRecoveryPoint if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapAseRecoveryPoint. + */ + public static AzureWorkloadSapAseRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapAseRecoveryPoint deserializedAzureWorkloadSapAseRecoveryPoint + = new AzureWorkloadSapAseRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadSapAseRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadSapAseRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadSapAseRecoveryPoint.withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadSapAseRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadSapAseRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapAseRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapAseRecoveryPoint; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRestoreRequest.java new file mode 100644 index 0000000000000..0d69a25f4886c --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRestoreRequest.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload SAP Ase-specific restore. + */ +@Fluent +public class AzureWorkloadSapAseRestoreRequest extends AzureWorkloadRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadSAPAseRestoreRequest"; + + /** + * Creates an instance of AzureWorkloadSapAseRestoreRequest class. + */ + public AzureWorkloadSapAseRestoreRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapAseRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapAseRestoreRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapAseRestoreRequest. + */ + public static AzureWorkloadSapAseRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSAPAsePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAseRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAseRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadSapAseRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapAseRestoreRequest deserializedAzureWorkloadSapAseRestoreRequest + = new AzureWorkloadSapAseRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAseRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAseRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest.withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest.withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest.withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapAseRestoreRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRestoreWithRehydrateRequest.java new file mode 100644 index 0000000000000..ad9e7c2661777 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapAseRestoreWithRehydrateRequest.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * AzureWorkload SAP Ase-specific restore with integrated rehydration of recovery point. + */ +@Fluent +public final class AzureWorkloadSapAseRestoreWithRehydrateRequest extends AzureWorkloadSapAseRestoreRequest { + /* + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. + */ + private String objectType = "AzureWorkloadSAPAseRestoreWithRehydrateRequest"; + + /* + * RP Rehydration Info + */ + private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; + + /** + * Creates an instance of AzureWorkloadSapAseRestoreWithRehydrateRequest class. + */ + public AzureWorkloadSapAseRestoreWithRehydrateRequest() { + } + + /** + * Get the objectType property: This property will be used as the discriminator for deciding the specific types in + * the polymorphic chain of types. + * + * @return the objectType value. + */ + @Override + public String objectType() { + return this.objectType; + } + + /** + * Get the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @return the recoveryPointRehydrationInfo value. + */ + public RecoveryPointRehydrationInfo recoveryPointRehydrationInfo() { + return this.recoveryPointRehydrationInfo; + } + + /** + * Set the recoveryPointRehydrationInfo property: RP Rehydration Info. + * + * @param recoveryPointRehydrationInfo the recoveryPointRehydrationInfo value to set. + * @return the AzureWorkloadSapAseRestoreWithRehydrateRequest object itself. + */ + public AzureWorkloadSapAseRestoreWithRehydrateRequest + withRecoveryPointRehydrationInfo(RecoveryPointRehydrationInfo recoveryPointRehydrationInfo) { + this.recoveryPointRehydrationInfo = recoveryPointRehydrationInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest withRecoveryType(RecoveryType recoveryType) { + super.withRecoveryType(recoveryType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest withSourceResourceId(String sourceResourceId) { + super.withSourceResourceId(sourceResourceId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest withPropertyBag(Map propertyBag) { + super.withPropertyBag(propertyBag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest withTargetInfo(TargetRestoreInfo targetInfo) { + super.withTargetInfo(targetInfo); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest withRecoveryMode(RecoveryMode recoveryMode) { + super.withRecoveryMode(recoveryMode); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest withTargetResourceGroupName(String targetResourceGroupName) { + super.withTargetResourceGroupName(targetResourceGroupName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest + withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails) { + super.withUserAssignedManagedIdentityDetails(userAssignedManagedIdentityDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest + withSnapshotRestoreParameters(SnapshotRestoreParameters snapshotRestoreParameters) { + super.withSnapshotRestoreParameters(snapshotRestoreParameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest withTargetVirtualMachineId(String targetVirtualMachineId) { + super.withTargetVirtualMachineId(targetVirtualMachineId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureWorkloadSapAseRestoreWithRehydrateRequest + withResourceGuardOperationRequests(List resourceGuardOperationRequests) { + super.withResourceGuardOperationRequests(resourceGuardOperationRequests); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (recoveryPointRehydrationInfo() != null) { + recoveryPointRehydrationInfo().validate(); + } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapAseRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapAseRestoreWithRehydrateRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapAseRestoreWithRehydrateRequest. + */ + public static AzureWorkloadSapAseRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapAseRestoreWithRehydrateRequest deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + = new AzureWorkloadSapAseRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest.objectType = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapAseRestoreWithRehydrateRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRecoveryPoint.java index e639b3fa4c9e7..cc973b1344cda 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRecoveryPoint.java @@ -5,30 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Recovery point specific to PointInTime in SAPHana. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSapHanaPointInTimeRecoveryPoint.class, - visible = true) -@JsonTypeName("AzureWorkloadSAPHanaPointInTimeRecoveryPoint") @Fluent public final class AzureWorkloadSapHanaPointInTimeRecoveryPoint extends AzureWorkloadPointInTimeRecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint"; /** @@ -113,6 +108,91 @@ public AzureWorkloadSapHanaPointInTimeRecoveryPoint withType(RestorePointType ty */ @Override public void validate() { - super.validate(); + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + if (timeRanges() != null) { + timeRanges().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeArrayField("timeRanges", timeRanges(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapHanaPointInTimeRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapHanaPointInTimeRecoveryPoint if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapHanaPointInTimeRecoveryPoint. + */ + public static AzureWorkloadSapHanaPointInTimeRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapHanaPointInTimeRecoveryPoint deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint + = new AzureWorkloadSapHanaPointInTimeRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("timeRanges".equals(fieldName)) { + List timeRanges = reader.readArray(reader1 -> PointInTimeRange.fromJson(reader1)); + deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint.withTimeRanges(timeRanges); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapHanaPointInTimeRecoveryPoint; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreRequest.java index ec778d4acea0e..bbb834d396857 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreRequest.java @@ -5,41 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSapHanaPointInTimeRestoreRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSAPHanaPointInTimeRestoreRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest", - value = AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.class) }) @Fluent public class AzureWorkloadSapHanaPointInTimeRestoreRequest extends AzureWorkloadSapHanaRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSAPHanaPointInTimeRestoreRequest"; /* * PointInTime value */ - @JsonProperty(value = "pointInTime") private OffsetDateTime pointInTime; /** @@ -179,6 +168,123 @@ public AzureWorkloadSapHanaPointInTimeRestoreRequest withTargetVirtualMachineId( */ @Override public void validate() { - super.validate(); + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("pointInTime", + this.pointInTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.pointInTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapHanaPointInTimeRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapHanaPointInTimeRestoreRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapHanaPointInTimeRestoreRequest. + */ + public static AzureWorkloadSapHanaPointInTimeRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadSapHanaPointInTimeRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapHanaPointInTimeRestoreRequest deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + = new AzureWorkloadSapHanaPointInTimeRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest.objectType = reader.getString(); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest.pointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapHanaPointInTimeRestoreRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.java index aa448aadf69df..f54e57523e123 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.java @@ -5,37 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * AzureWorkload SAP Hana-specific restore with integrated rehydration of recovery point. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest") @Fluent public final class AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest extends AzureWorkloadSapHanaPointInTimeRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest"; /* * RP Rehydration Info */ - @JsonProperty(value = "recoveryPointRehydrationInfo") private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; /** @@ -187,9 +181,108 @@ public AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest withRecoveryMo */ @Override public void validate() { - super.validate(); if (recoveryPointRehydrationInfo() != null) { recoveryPointRehydrationInfo().validate(); } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("pointInTime", + pointInTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(pointInTime())); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest. + */ + public static AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + = new AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.withPointInTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.objectType + = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRecoveryPoint.java index 63dc027b3b8e7..7fb99de5749d5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRecoveryPoint.java @@ -5,30 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * SAPHana specific recoverypoint, specifically encapsulates full/diff recoverypoints. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSapHanaRecoveryPoint.class, - visible = true) -@JsonTypeName("AzureWorkloadSAPHanaRecoveryPoint") @Fluent public final class AzureWorkloadSapHanaRecoveryPoint extends AzureWorkloadRecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSAPHanaRecoveryPoint"; /** @@ -103,6 +98,84 @@ public AzureWorkloadSapHanaRecoveryPoint withType(RestorePointType type) { */ @Override public void validate() { - super.validate(); + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapHanaRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapHanaRecoveryPoint if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapHanaRecoveryPoint. + */ + public static AzureWorkloadSapHanaRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapHanaRecoveryPoint deserializedAzureWorkloadSapHanaRecoveryPoint + = new AzureWorkloadSapHanaRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadSapHanaRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadSapHanaRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapHanaRecoveryPoint; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreRequest.java index da43d47513c94..b661ae1acda21 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreRequest.java @@ -5,37 +5,22 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; /** * AzureWorkload SAP Hana-specific restore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSapHanaRestoreRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSAPHanaRestoreRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadSAPHanaPointInTimeRestoreRequest", - value = AzureWorkloadSapHanaPointInTimeRestoreRequest.class), - @JsonSubTypes.Type( - name = "AzureWorkloadSAPHanaRestoreWithRehydrateRequest", - value = AzureWorkloadSapHanaRestoreWithRehydrateRequest.class) }) @Fluent public class AzureWorkloadSapHanaRestoreRequest extends AzureWorkloadRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSAPHanaRestoreRequest"; /** @@ -155,6 +140,119 @@ public AzureWorkloadSapHanaRestoreRequest withTargetVirtualMachineId(String targ */ @Override public void validate() { - super.validate(); + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapHanaRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapHanaRestoreRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapHanaRestoreRequest. + */ + public static AzureWorkloadSapHanaRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSAPHanaPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRestoreRequest + .fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadSapHanaRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapHanaRestoreRequest deserializedAzureWorkloadSapHanaRestoreRequest + = new AzureWorkloadSapHanaRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest.withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest.withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest.withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapHanaRestoreRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreWithRehydrateRequest.java index 652f823e4dd03..aeef41d521988 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreWithRehydrateRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSapHanaRestoreWithRehydrateRequest.java @@ -5,35 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; /** * AzureWorkload SAP Hana-specific restore with integrated rehydration of recovery point. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSapHanaRestoreWithRehydrateRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSAPHanaRestoreWithRehydrateRequest") @Fluent public final class AzureWorkloadSapHanaRestoreWithRehydrateRequest extends AzureWorkloadSapHanaRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSAPHanaRestoreWithRehydrateRequest"; /* * RP Rehydration Info */ - @JsonProperty(value = "recoveryPointRehydrationInfo") private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; /** @@ -174,9 +166,100 @@ public AzureWorkloadSapHanaRestoreWithRehydrateRequest withTargetVirtualMachineI */ @Override public void validate() { - super.validate(); if (recoveryPointRehydrationInfo() != null) { recoveryPointRehydrationInfo().validate(); } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSapHanaRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSapHanaRestoreWithRehydrateRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSapHanaRestoreWithRehydrateRequest. + */ + public static AzureWorkloadSapHanaRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSapHanaRestoreWithRehydrateRequest deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + = new AzureWorkloadSapHanaRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest.objectType = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSapHanaRestoreWithRehydrateRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlAutoProtectionIntent.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlAutoProtectionIntent.java index 5b1aadbd0618f..c5824d966dbf7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlAutoProtectionIntent.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlAutoProtectionIntent.java @@ -5,34 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure Workload SQL Auto Protection intent item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectionIntentItemType", - defaultImpl = AzureWorkloadSqlAutoProtectionIntent.class, - visible = true) -@JsonTypeName("AzureWorkloadSQLAutoProtectionIntent") @Fluent public final class AzureWorkloadSqlAutoProtectionIntent extends AzureWorkloadAutoProtectionIntent { /* * backup protectionIntent type. */ - @JsonTypeId - @JsonProperty(value = "protectionIntentItemType", required = true) private ProtectionIntentItemType protectionIntentItemType = ProtectionIntentItemType.AZURE_WORKLOAD_SQLAUTO_PROTECTION_INTENT; /* * Workload item type of the item for which intent is to be set */ - @JsonProperty(value = "workloadItemType") private WorkloadItemType workloadItemType; /** @@ -123,6 +114,67 @@ public AzureWorkloadSqlAutoProtectionIntent withProtectionState(ProtectionStatus */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("itemId", itemId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectionIntentItemType", + this.protectionIntentItemType == null ? null : this.protectionIntentItemType.toString()); + jsonWriter.writeStringField("workloadItemType", + this.workloadItemType == null ? null : this.workloadItemType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlAutoProtectionIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlAutoProtectionIntent if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlAutoProtectionIntent. + */ + public static AzureWorkloadSqlAutoProtectionIntent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlAutoProtectionIntent deserializedAzureWorkloadSqlAutoProtectionIntent + = new AzureWorkloadSqlAutoProtectionIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedAzureWorkloadSqlAutoProtectionIntent + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSqlAutoProtectionIntent.withSourceResourceId(reader.getString()); + } else if ("itemId".equals(fieldName)) { + deserializedAzureWorkloadSqlAutoProtectionIntent.withItemId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedAzureWorkloadSqlAutoProtectionIntent.withPolicyId(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedAzureWorkloadSqlAutoProtectionIntent + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectionIntentItemType".equals(fieldName)) { + deserializedAzureWorkloadSqlAutoProtectionIntent.protectionIntentItemType + = ProtectionIntentItemType.fromString(reader.getString()); + } else if ("workloadItemType".equals(fieldName)) { + deserializedAzureWorkloadSqlAutoProtectionIntent.workloadItemType + = WorkloadItemType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlAutoProtectionIntent; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRecoveryPoint.java index 4fe9a465c153a..101e6ebbd379d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRecoveryPoint.java @@ -5,36 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Recovery point specific to PointInTime. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSqlPointInTimeRecoveryPoint.class, - visible = true) -@JsonTypeName("AzureWorkloadSQLPointInTimeRecoveryPoint") @Fluent public final class AzureWorkloadSqlPointInTimeRecoveryPoint extends AzureWorkloadSqlRecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSQLPointInTimeRecoveryPoint"; /* * List of log ranges */ - @JsonProperty(value = "timeRanges") private List timeRanges; /** @@ -139,9 +133,98 @@ public AzureWorkloadSqlPointInTimeRecoveryPoint withType(RestorePointType type) */ @Override public void validate() { - super.validate(); if (timeRanges() != null) { timeRanges().forEach(e -> e.validate()); } + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + if (extendedInfo() != null) { + extendedInfo().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeArrayField("timeRanges", this.timeRanges, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlPointInTimeRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlPointInTimeRecoveryPoint if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlPointInTimeRecoveryPoint. + */ + public static AzureWorkloadSqlPointInTimeRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlPointInTimeRecoveryPoint deserializedAzureWorkloadSqlPointInTimeRecoveryPoint + = new AzureWorkloadSqlPointInTimeRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint + .withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint + .withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint + .withExtendedInfo(AzureWorkloadSqlRecoveryPointExtendedInfo.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint.objectType = reader.getString(); + } else if ("timeRanges".equals(fieldName)) { + List timeRanges = reader.readArray(reader1 -> PointInTimeRange.fromJson(reader1)); + deserializedAzureWorkloadSqlPointInTimeRecoveryPoint.timeRanges = timeRanges; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlPointInTimeRecoveryPoint; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreRequest.java index 0ad38cc7ff73a..7c5a6745fa60c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreRequest.java @@ -5,41 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSqlPointInTimeRestoreRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSQLPointInTimeRestoreRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest", - value = AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.class) }) @Fluent public class AzureWorkloadSqlPointInTimeRestoreRequest extends AzureWorkloadSqlRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSQLPointInTimeRestoreRequest"; /* * PointInTime value */ - @JsonProperty(value = "pointInTime") private OffsetDateTime pointInTime; /** @@ -208,6 +197,141 @@ public AzureWorkloadSqlPointInTimeRestoreRequest withTargetVirtualMachineId(Stri */ @Override public void validate() { - super.validate(); + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + if (alternateDirectoryPaths() != null) { + alternateDirectoryPaths().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeBooleanField("shouldUseAlternateTargetLocation", shouldUseAlternateTargetLocation()); + jsonWriter.writeBooleanField("isNonRecoverable", isNonRecoverable()); + jsonWriter.writeArrayField("alternateDirectoryPaths", alternateDirectoryPaths(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("pointInTime", + this.pointInTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.pointInTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlPointInTimeRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlPointInTimeRestoreRequest if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlPointInTimeRestoreRequest. + */ + public static AzureWorkloadSqlPointInTimeRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadSqlPointInTimeRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlPointInTimeRestoreRequest deserializedAzureWorkloadSqlPointInTimeRestoreRequest + = new AzureWorkloadSqlPointInTimeRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlPointInTimeRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("shouldUseAlternateTargetLocation".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withShouldUseAlternateTargetLocation(reader.getNullable(JsonReader::getBoolean)); + } else if ("isNonRecoverable".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withIsNonRecoverable(reader.getNullable(JsonReader::getBoolean)); + } else if ("alternateDirectoryPaths".equals(fieldName)) { + List alternateDirectoryPaths + = reader.readArray(reader1 -> SqlDataDirectoryMapping.fromJson(reader1)); + deserializedAzureWorkloadSqlPointInTimeRestoreRequest + .withAlternateDirectoryPaths(alternateDirectoryPaths); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest.objectType = reader.getString(); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreRequest.pointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlPointInTimeRestoreRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.java index 38cbbf800f7b1..805fba2277e46 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.java @@ -5,37 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * AzureWorkload SQL-specific restore with integrated rehydration of recovery point. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest") @Fluent public final class AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest extends AzureWorkloadSqlPointInTimeRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest"; /* * RP Rehydration Info */ - @JsonProperty(value = "recoveryPointRehydrationInfo") private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; /** @@ -216,9 +210,124 @@ public AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest withRecoveryMode(R */ @Override public void validate() { - super.validate(); if (recoveryPointRehydrationInfo() != null) { recoveryPointRehydrationInfo().validate(); } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + if (alternateDirectoryPaths() != null) { + alternateDirectoryPaths().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeBooleanField("shouldUseAlternateTargetLocation", shouldUseAlternateTargetLocation()); + jsonWriter.writeBooleanField("isNonRecoverable", isNonRecoverable()); + jsonWriter.writeArrayField("alternateDirectoryPaths", alternateDirectoryPaths(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("pointInTime", + pointInTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(pointInTime())); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest. + */ + public static AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + = new AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("shouldUseAlternateTargetLocation".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withShouldUseAlternateTargetLocation(reader.getNullable(JsonReader::getBoolean)); + } else if ("isNonRecoverable".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withIsNonRecoverable(reader.getNullable(JsonReader::getBoolean)); + } else if ("alternateDirectoryPaths".equals(fieldName)) { + List alternateDirectoryPaths + = reader.readArray(reader1 -> SqlDataDirectoryMapping.fromJson(reader1)); + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest + .withAlternateDirectoryPaths(alternateDirectoryPaths); + } else if ("pointInTime".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.withPointInTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.objectType = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPoint.java index 5392c0f1c4352..cfbf313e88e87 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPoint.java @@ -5,35 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * SQL specific recoverypoint, specifically encapsulates full/diff recoverypoint along with extended info. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSqlRecoveryPoint.class, - visible = true) -@JsonTypeName("AzureWorkloadSQLRecoveryPoint") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadSQLPointInTimeRecoveryPoint", - value = AzureWorkloadSqlPointInTimeRecoveryPoint.class) }) @Fluent public class AzureWorkloadSqlRecoveryPoint extends AzureWorkloadRecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSQLRecoveryPoint"; /* @@ -41,7 +31,6 @@ public class AzureWorkloadSqlRecoveryPoint extends AzureWorkloadRecoveryPoint { * When a specific recovery point is accessed using GetRecoveryPoint * Or when ListRecoveryPoints is called for Log RP only with ExtendedInfo query filter */ - @JsonProperty(value = "extendedInfo") private AzureWorkloadSqlRecoveryPointExtendedInfo extendedInfo; /** @@ -141,9 +130,114 @@ public AzureWorkloadSqlRecoveryPoint withRecoveryPointProperties(RecoveryPointPr */ @Override public void validate() { - super.validate(); if (extendedInfo() != null) { extendedInfo().validate(); } + if (recoveryPointTierDetails() != null) { + recoveryPointTierDetails().forEach(e -> e.validate()); + } + if (recoveryPointMoveReadinessInfo() != null) { + recoveryPointMoveReadinessInfo().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recoveryPointTimeInUTC", + recoveryPointTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(recoveryPointTimeInUtc())); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("recoveryPointTierDetails", recoveryPointTierDetails(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", recoveryPointMoveReadinessInfo(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("recoveryPointProperties", recoveryPointProperties()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlRecoveryPoint if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlRecoveryPoint. + */ + public static AzureWorkloadSqlRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSQLPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadSqlRecoveryPoint fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlRecoveryPoint deserializedAzureWorkloadSqlRecoveryPoint + = new AzureWorkloadSqlRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadSqlRecoveryPoint.withRecoveryPointTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("type".equals(fieldName)) { + deserializedAzureWorkloadSqlRecoveryPoint.withType(RestorePointType.fromString(reader.getString())); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedAzureWorkloadSqlRecoveryPoint.withRecoveryPointTierDetails(recoveryPointTierDetails); + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedAzureWorkloadSqlRecoveryPoint + .withRecoveryPointMoveReadinessInfo(recoveryPointMoveReadinessInfo); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedAzureWorkloadSqlRecoveryPoint + .withRecoveryPointProperties(RecoveryPointProperties.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSqlRecoveryPoint.objectType = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlRecoveryPoint.extendedInfo + = AzureWorkloadSqlRecoveryPointExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlRecoveryPoint; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPointExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPointExtendedInfo.java index a3754a31df5f5..27b42402629eb 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPointExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRecoveryPointExtendedInfo.java @@ -5,25 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Extended info class details. */ @Fluent -public final class AzureWorkloadSqlRecoveryPointExtendedInfo { +public final class AzureWorkloadSqlRecoveryPointExtendedInfo + implements JsonSerializable { /* * UTC time at which data directory info was captured */ - @JsonProperty(value = "dataDirectoryTimeInUTC") private OffsetDateTime dataDirectoryTimeInUtc; /* * List of data directory paths during restore operation. */ - @JsonProperty(value = "dataDirectoryPaths") private List dataDirectoryPaths; /** @@ -82,4 +87,51 @@ public void validate() { dataDirectoryPaths().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataDirectoryTimeInUTC", + this.dataDirectoryTimeInUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dataDirectoryTimeInUtc)); + jsonWriter.writeArrayField("dataDirectoryPaths", this.dataDirectoryPaths, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlRecoveryPointExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlRecoveryPointExtendedInfo if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlRecoveryPointExtendedInfo. + */ + public static AzureWorkloadSqlRecoveryPointExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlRecoveryPointExtendedInfo deserializedAzureWorkloadSqlRecoveryPointExtendedInfo + = new AzureWorkloadSqlRecoveryPointExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataDirectoryTimeInUTC".equals(fieldName)) { + deserializedAzureWorkloadSqlRecoveryPointExtendedInfo.dataDirectoryTimeInUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("dataDirectoryPaths".equals(fieldName)) { + List dataDirectoryPaths + = reader.readArray(reader1 -> SqlDataDirectory.fromJson(reader1)); + deserializedAzureWorkloadSqlRecoveryPointExtendedInfo.dataDirectoryPaths = dataDirectoryPaths; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlRecoveryPointExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreRequest.java index dff0304f2d0b8..3c339e85f749a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreRequest.java @@ -5,55 +5,37 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; /** * AzureWorkload SQL -specific restore. Specifically for full/diff restore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSqlRestoreRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSQLRestoreRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureWorkloadSQLPointInTimeRestoreRequest", - value = AzureWorkloadSqlPointInTimeRestoreRequest.class), - @JsonSubTypes.Type( - name = "AzureWorkloadSQLRestoreWithRehydrateRequest", - value = AzureWorkloadSqlRestoreWithRehydrateRequest.class) }) @Fluent public class AzureWorkloadSqlRestoreRequest extends AzureWorkloadRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSQLRestoreRequest"; /* * Default option set to true. If this is set to false, alternate data directory must be provided */ - @JsonProperty(value = "shouldUseAlternateTargetLocation") private Boolean shouldUseAlternateTargetLocation; /* * SQL specific property where user can chose to set no-recovery when restore operation is tried */ - @JsonProperty(value = "isNonRecoverable") private Boolean isNonRecoverable; /* * Data directory details */ - @JsonProperty(value = "alternateDirectoryPaths") private List alternateDirectoryPaths; /** @@ -239,9 +221,135 @@ public AzureWorkloadSqlRestoreRequest withTargetVirtualMachineId(String targetVi */ @Override public void validate() { - super.validate(); if (alternateDirectoryPaths() != null) { alternateDirectoryPaths().forEach(e -> e.validate()); } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeBooleanField("shouldUseAlternateTargetLocation", this.shouldUseAlternateTargetLocation); + jsonWriter.writeBooleanField("isNonRecoverable", this.isNonRecoverable); + jsonWriter.writeArrayField("alternateDirectoryPaths", this.alternateDirectoryPaths, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlRestoreRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlRestoreRequest. + */ + public static AzureWorkloadSqlRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkloadSQLPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSQLRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AzureWorkloadSqlRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlRestoreRequest deserializedAzureWorkloadSqlRestoreRequest + = new AzureWorkloadSqlRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlRestoreRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlRestoreRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest.withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest.withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest.withTargetVirtualMachineId(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest.objectType = reader.getString(); + } else if ("shouldUseAlternateTargetLocation".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest.shouldUseAlternateTargetLocation + = reader.getNullable(JsonReader::getBoolean); + } else if ("isNonRecoverable".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreRequest.isNonRecoverable + = reader.getNullable(JsonReader::getBoolean); + } else if ("alternateDirectoryPaths".equals(fieldName)) { + List alternateDirectoryPaths + = reader.readArray(reader1 -> SqlDataDirectoryMapping.fromJson(reader1)); + deserializedAzureWorkloadSqlRestoreRequest.alternateDirectoryPaths = alternateDirectoryPaths; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlRestoreRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreWithRehydrateRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreWithRehydrateRequest.java index 94c99d498ae7b..defde9a45be29 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreWithRehydrateRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadSqlRestoreWithRehydrateRequest.java @@ -5,35 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; /** * AzureWorkload SQL-specific restore with integrated rehydration of recovery point. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = AzureWorkloadSqlRestoreWithRehydrateRequest.class, - visible = true) -@JsonTypeName("AzureWorkloadSQLRestoreWithRehydrateRequest") @Fluent public final class AzureWorkloadSqlRestoreWithRehydrateRequest extends AzureWorkloadSqlRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "AzureWorkloadSQLRestoreWithRehydrateRequest"; /* * RP Rehydration Info */ - @JsonProperty(value = "recoveryPointRehydrationInfo") private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; /** @@ -203,9 +195,117 @@ public AzureWorkloadSqlRestoreWithRehydrateRequest withTargetVirtualMachineId(St */ @Override public void validate() { - super.validate(); if (recoveryPointRehydrationInfo() != null) { recoveryPointRehydrationInfo().validate(); } + if (targetInfo() != null) { + targetInfo().validate(); + } + if (userAssignedManagedIdentityDetails() != null) { + userAssignedManagedIdentityDetails().validate(); + } + if (snapshotRestoreParameters() != null) { + snapshotRestoreParameters().validate(); + } + if (alternateDirectoryPaths() != null) { + alternateDirectoryPaths().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeMapField("propertyBag", propertyBag(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("targetInfo", targetInfo()); + jsonWriter.writeStringField("recoveryMode", recoveryMode() == null ? null : recoveryMode().toString()); + jsonWriter.writeStringField("targetResourceGroupName", targetResourceGroupName()); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", userAssignedManagedIdentityDetails()); + jsonWriter.writeJsonField("snapshotRestoreParameters", snapshotRestoreParameters()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeBooleanField("shouldUseAlternateTargetLocation", shouldUseAlternateTargetLocation()); + jsonWriter.writeBooleanField("isNonRecoverable", isNonRecoverable()); + jsonWriter.writeArrayField("alternateDirectoryPaths", alternateDirectoryPaths(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureWorkloadSqlRestoreWithRehydrateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureWorkloadSqlRestoreWithRehydrateRequest if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureWorkloadSqlRestoreWithRehydrateRequest. + */ + public static AzureWorkloadSqlRestoreWithRehydrateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureWorkloadSqlRestoreWithRehydrateRequest deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + = new AzureWorkloadSqlRestoreWithRehydrateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryType".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest.withSourceResourceId(reader.getString()); + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest.withPropertyBag(propertyBag); + } else if ("targetInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withTargetInfo(TargetRestoreInfo.fromJson(reader)); + } else if ("recoveryMode".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withRecoveryMode(RecoveryMode.fromString(reader.getString())); + } else if ("targetResourceGroupName".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withTargetResourceGroupName(reader.getString()); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withUserAssignedManagedIdentityDetails(UserAssignedManagedIdentityDetails.fromJson(reader)); + } else if ("snapshotRestoreParameters".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withSnapshotRestoreParameters(SnapshotRestoreParameters.fromJson(reader)); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withTargetVirtualMachineId(reader.getString()); + } else if ("shouldUseAlternateTargetLocation".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withShouldUseAlternateTargetLocation(reader.getNullable(JsonReader::getBoolean)); + } else if ("isNonRecoverable".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withIsNonRecoverable(reader.getNullable(JsonReader::getBoolean)); + } else if ("alternateDirectoryPaths".equals(fieldName)) { + List alternateDirectoryPaths + = reader.readArray(reader1 -> SqlDataDirectoryMapping.fromJson(reader1)); + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest + .withAlternateDirectoryPaths(alternateDirectoryPaths); + } else if ("objectType".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest.objectType = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedAzureWorkloadSqlRestoreWithRehydrateRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureWorkloadSqlRestoreWithRehydrateRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBase.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBase.java index da208424465d1..7bd5c0dda2922 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBase.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBase.java @@ -5,110 +5,86 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The base backup engine class. All workload specific backup engines derive from this class. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupEngineType", - defaultImpl = BackupEngineBase.class, - visible = true) -@JsonTypeName("BackupEngineBase") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureBackupServerEngine", value = AzureBackupServerEngine.class), - @JsonSubTypes.Type(name = "DpmBackupEngine", value = DpmBackupEngine.class) }) @Fluent -public class BackupEngineBase { +public class BackupEngineBase implements JsonSerializable { /* * Type of the backup engine. */ - @JsonTypeId - @JsonProperty(value = "backupEngineType", required = true) - private BackupEngineType backupEngineType; + private BackupEngineType backupEngineType = BackupEngineType.fromString("BackupEngineBase"); /* * Friendly name of the backup engine. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Type of backup management for the backup engine. */ - @JsonProperty(value = "backupManagementType") private BackupManagementType backupManagementType; /* * Registration status of the backup engine with the Recovery Services Vault. */ - @JsonProperty(value = "registrationStatus") private String registrationStatus; /* * Status of the backup engine with the Recovery Services Vault. = {Active/Deleting/DeleteFailed} */ - @JsonProperty(value = "backupEngineState") private String backupEngineState; /* * Backup status of the backup engine. */ - @JsonProperty(value = "healthStatus") private String healthStatus; /* * Flag indicating if the backup engine be registered, once already registered. */ - @JsonProperty(value = "canReRegister") private Boolean canReRegister; /* * ID of the backup engine. */ - @JsonProperty(value = "backupEngineId") private String backupEngineId; /* * Backup engine version */ - @JsonProperty(value = "dpmVersion") private String dpmVersion; /* * Backup agent version */ - @JsonProperty(value = "azureBackupAgentVersion") private String azureBackupAgentVersion; /* * To check if backup agent upgrade available */ - @JsonProperty(value = "isAzureBackupAgentUpgradeAvailable") private Boolean isAzureBackupAgentUpgradeAvailable; /* * To check if backup engine upgrade available */ - @JsonProperty(value = "isDpmUpgradeAvailable") private Boolean isDpmUpgradeAvailable; /* * Extended info of the backupengine */ - @JsonProperty(value = "extendedInfo") private BackupEngineExtendedInfo extendedInfo; /** * Creates an instance of BackupEngineBase class. */ public BackupEngineBase() { - this.backupEngineType = BackupEngineType.fromString("BackupEngineBase"); } /** @@ -372,4 +348,107 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupEngineType", + this.backupEngineType == null ? null : this.backupEngineType.toString()); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("backupManagementType", + this.backupManagementType == null ? null : this.backupManagementType.toString()); + jsonWriter.writeStringField("registrationStatus", this.registrationStatus); + jsonWriter.writeStringField("backupEngineState", this.backupEngineState); + jsonWriter.writeStringField("healthStatus", this.healthStatus); + jsonWriter.writeBooleanField("canReRegister", this.canReRegister); + jsonWriter.writeStringField("backupEngineId", this.backupEngineId); + jsonWriter.writeStringField("dpmVersion", this.dpmVersion); + jsonWriter.writeStringField("azureBackupAgentVersion", this.azureBackupAgentVersion); + jsonWriter.writeBooleanField("isAzureBackupAgentUpgradeAvailable", this.isAzureBackupAgentUpgradeAvailable); + jsonWriter.writeBooleanField("isDpmUpgradeAvailable", this.isDpmUpgradeAvailable); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupEngineBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupEngineBase if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupEngineBase. + */ + public static BackupEngineBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("backupEngineType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureBackupServerEngine".equals(discriminatorValue)) { + return AzureBackupServerEngine.fromJson(readerToUse.reset()); + } else if ("DpmBackupEngine".equals(discriminatorValue)) { + return DpmBackupEngine.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static BackupEngineBase fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupEngineBase deserializedBackupEngineBase = new BackupEngineBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupEngineType".equals(fieldName)) { + deserializedBackupEngineBase.backupEngineType = BackupEngineType.fromString(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedBackupEngineBase.friendlyName = reader.getString(); + } else if ("backupManagementType".equals(fieldName)) { + deserializedBackupEngineBase.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("registrationStatus".equals(fieldName)) { + deserializedBackupEngineBase.registrationStatus = reader.getString(); + } else if ("backupEngineState".equals(fieldName)) { + deserializedBackupEngineBase.backupEngineState = reader.getString(); + } else if ("healthStatus".equals(fieldName)) { + deserializedBackupEngineBase.healthStatus = reader.getString(); + } else if ("canReRegister".equals(fieldName)) { + deserializedBackupEngineBase.canReRegister = reader.getNullable(JsonReader::getBoolean); + } else if ("backupEngineId".equals(fieldName)) { + deserializedBackupEngineBase.backupEngineId = reader.getString(); + } else if ("dpmVersion".equals(fieldName)) { + deserializedBackupEngineBase.dpmVersion = reader.getString(); + } else if ("azureBackupAgentVersion".equals(fieldName)) { + deserializedBackupEngineBase.azureBackupAgentVersion = reader.getString(); + } else if ("isAzureBackupAgentUpgradeAvailable".equals(fieldName)) { + deserializedBackupEngineBase.isAzureBackupAgentUpgradeAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("isDpmUpgradeAvailable".equals(fieldName)) { + deserializedBackupEngineBase.isDpmUpgradeAvailable = reader.getNullable(JsonReader::getBoolean); + } else if ("extendedInfo".equals(fieldName)) { + deserializedBackupEngineBase.extendedInfo = BackupEngineExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupEngineBase; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBaseResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBaseResourceList.java index e122aae881085..71102710bf0fa 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBaseResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineBaseResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupEngineBaseResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class BackupEngineBaseResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,49 @@ public BackupEngineBaseResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupEngineBaseResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupEngineBaseResourceList if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupEngineBaseResourceList. + */ + public static BackupEngineBaseResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupEngineBaseResourceList deserializedBackupEngineBaseResourceList = new BackupEngineBaseResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedBackupEngineBaseResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BackupEngineBaseResourceInner.fromJson(reader1)); + deserializedBackupEngineBaseResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedBackupEngineBaseResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineExtendedInfo.java index 74241dcffa3a1..4d4774ba26ea5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineExtendedInfo.java @@ -5,60 +5,58 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Additional information on backup engine. */ @Fluent -public final class BackupEngineExtendedInfo { +public final class BackupEngineExtendedInfo implements JsonSerializable { /* * Database name of backup engine. */ - @JsonProperty(value = "databaseName") private String databaseName; /* * Number of protected items in the backup engine. */ - @JsonProperty(value = "protectedItemsCount") private Integer protectedItemsCount; /* * Number of protected servers in the backup engine. */ - @JsonProperty(value = "protectedServersCount") private Integer protectedServersCount; /* * Number of disks in the backup engine. */ - @JsonProperty(value = "diskCount") private Integer diskCount; /* * Disk space used in the backup engine. */ - @JsonProperty(value = "usedDiskSpace") private Double usedDiskSpace; /* * Disk space currently available in the backup engine. */ - @JsonProperty(value = "availableDiskSpace") private Double availableDiskSpace; /* * Last refresh time in the backup engine. */ - @JsonProperty(value = "refreshedAt") private OffsetDateTime refreshedAt; /* * Protected instances in the backup engine. */ - @JsonProperty(value = "azureProtectedInstances") private Integer azureProtectedInstances; /** @@ -234,4 +232,64 @@ public BackupEngineExtendedInfo withAzureProtectedInstances(Integer azureProtect */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeNumberField("protectedItemsCount", this.protectedItemsCount); + jsonWriter.writeNumberField("protectedServersCount", this.protectedServersCount); + jsonWriter.writeNumberField("diskCount", this.diskCount); + jsonWriter.writeNumberField("usedDiskSpace", this.usedDiskSpace); + jsonWriter.writeNumberField("availableDiskSpace", this.availableDiskSpace); + jsonWriter.writeStringField("refreshedAt", + this.refreshedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.refreshedAt)); + jsonWriter.writeNumberField("azureProtectedInstances", this.azureProtectedInstances); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupEngineExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupEngineExtendedInfo if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupEngineExtendedInfo. + */ + public static BackupEngineExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupEngineExtendedInfo deserializedBackupEngineExtendedInfo = new BackupEngineExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("databaseName".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.databaseName = reader.getString(); + } else if ("protectedItemsCount".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.protectedItemsCount = reader.getNullable(JsonReader::getInt); + } else if ("protectedServersCount".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.protectedServersCount = reader.getNullable(JsonReader::getInt); + } else if ("diskCount".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.diskCount = reader.getNullable(JsonReader::getInt); + } else if ("usedDiskSpace".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.usedDiskSpace = reader.getNullable(JsonReader::getDouble); + } else if ("availableDiskSpace".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.availableDiskSpace = reader.getNullable(JsonReader::getDouble); + } else if ("refreshedAt".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.refreshedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("azureProtectedInstances".equals(fieldName)) { + deserializedBackupEngineExtendedInfo.azureProtectedInstances + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupEngineExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineType.java index 31c475e78fcba..94c3f1e10fcd9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupEngineType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public BackupEngineType() { * @param name a name to look for. * @return the corresponding BackupEngineType. */ - @JsonCreator public static BackupEngineType fromString(String name) { return fromString(name, BackupEngineType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupItemType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupItemType.java index 0362f261cf592..f475a486ea9b6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupItemType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupItemType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -107,7 +106,6 @@ public BackupItemType() { * @param name a name to look for. * @return the corresponding BackupItemType. */ - @JsonCreator public static BackupItemType fromString(String name) { return fromString(name, BackupItemType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementType.java index 5774313378dc9..abdc199c12417 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -72,7 +71,6 @@ public BackupManagementType() { * @param name a name to look for. * @return the corresponding BackupManagementType. */ - @JsonCreator public static BackupManagementType fromString(String name) { return fromString(name, BackupManagementType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementUsageList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementUsageList.java index d4f7f0c4e99b8..9c78b518b4ab6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementUsageList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupManagementUsageList.java @@ -5,19 +5,22 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupManagementUsageInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Backup management usage for vault. */ @Fluent -public final class BackupManagementUsageList { +public final class BackupManagementUsageList implements JsonSerializable { /* * The list of backup management usages for the given vault. */ - @JsonProperty(value = "value") private List value; /** @@ -56,4 +59,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupManagementUsageList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupManagementUsageList if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupManagementUsageList. + */ + public static BackupManagementUsageList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupManagementUsageList deserializedBackupManagementUsageList = new BackupManagementUsageList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BackupManagementUsageInner.fromJson(reader1)); + deserializedBackupManagementUsageList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedBackupManagementUsageList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequest.java index 8969d32c9a8d1..0e4ffe3a6dd2c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequest.java @@ -5,35 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for backup request. Workload-specific backup requests are derived from this class. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "objectType", defaultImpl = BackupRequest.class, visible = true) -@JsonTypeName("BackupRequest") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureFileShareBackupRequest", value = AzureFileShareBackupRequest.class), - @JsonSubTypes.Type(name = "AzureWorkloadBackupRequest", value = AzureWorkloadBackupRequest.class), - @JsonSubTypes.Type(name = "IaasVMBackupRequest", value = IaasVMBackupRequest.class) }) @Immutable -public class BackupRequest { +public class BackupRequest implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "BackupRequest"; /** * Creates an instance of BackupRequest class. */ public BackupRequest() { - this.objectType = "BackupRequest"; } /** @@ -53,4 +45,69 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupRequest. + */ + public static BackupRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureFileShareBackupRequest".equals(discriminatorValue)) { + return AzureFileShareBackupRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadBackupRequest".equals(discriminatorValue)) { + return AzureWorkloadBackupRequest.fromJson(readerToUse.reset()); + } else if ("IaasVMBackupRequest".equals(discriminatorValue)) { + return IaasVMBackupRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static BackupRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupRequest deserializedBackupRequest = new BackupRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedBackupRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequestResource.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequestResource.java index bc957c0847e76..36d86e0dd7f1f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequestResource.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupRequestResource.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** @@ -17,15 +20,28 @@ public final class BackupRequestResource extends Resource { /* * BackupRequestResource properties */ - @JsonProperty(value = "properties") private BackupRequest properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of BackupRequestResource class. */ @@ -72,6 +88,36 @@ public BackupRequestResource withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -100,4 +146,57 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupRequestResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupRequestResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupRequestResource. + */ + public static BackupRequestResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupRequestResource deserializedBackupRequestResource = new BackupRequestResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBackupRequestResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBackupRequestResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBackupRequestResource.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedBackupRequestResource.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedBackupRequestResource.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedBackupRequestResource.properties = BackupRequest.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedBackupRequestResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupRequestResource; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceConfig.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceConfig.java index 95ef6cae7792e..63c832799fe19 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceConfig.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceConfig.java @@ -5,47 +5,45 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The resource storage details. */ @Fluent -public final class BackupResourceConfig { +public final class BackupResourceConfig implements JsonSerializable { /* * Storage type */ - @JsonProperty(value = "storageModelType") private StorageType storageModelType; /* * Storage type. */ - @JsonProperty(value = "storageType") private StorageType storageType; /* * Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. */ - @JsonProperty(value = "storageTypeState") private StorageTypeState storageTypeState; /* * Opt in details of Cross Region Restore feature. */ - @JsonProperty(value = "crossRegionRestoreFlag") private Boolean crossRegionRestoreFlag; /* * Vault Dedup state */ - @JsonProperty(value = "dedupState") private DedupState dedupState; /* * Vault x-cool state */ - @JsonProperty(value = "xcoolState") private XcoolState xcoolState; /** @@ -183,4 +181,58 @@ public BackupResourceConfig withXcoolState(XcoolState xcoolState) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageModelType", + this.storageModelType == null ? null : this.storageModelType.toString()); + jsonWriter.writeStringField("storageType", this.storageType == null ? null : this.storageType.toString()); + jsonWriter.writeStringField("storageTypeState", + this.storageTypeState == null ? null : this.storageTypeState.toString()); + jsonWriter.writeBooleanField("crossRegionRestoreFlag", this.crossRegionRestoreFlag); + jsonWriter.writeStringField("dedupState", this.dedupState == null ? null : this.dedupState.toString()); + jsonWriter.writeStringField("xcoolState", this.xcoolState == null ? null : this.xcoolState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceConfig if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupResourceConfig. + */ + public static BackupResourceConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceConfig deserializedBackupResourceConfig = new BackupResourceConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageModelType".equals(fieldName)) { + deserializedBackupResourceConfig.storageModelType = StorageType.fromString(reader.getString()); + } else if ("storageType".equals(fieldName)) { + deserializedBackupResourceConfig.storageType = StorageType.fromString(reader.getString()); + } else if ("storageTypeState".equals(fieldName)) { + deserializedBackupResourceConfig.storageTypeState = StorageTypeState.fromString(reader.getString()); + } else if ("crossRegionRestoreFlag".equals(fieldName)) { + deserializedBackupResourceConfig.crossRegionRestoreFlag + = reader.getNullable(JsonReader::getBoolean); + } else if ("dedupState".equals(fieldName)) { + deserializedBackupResourceConfig.dedupState = DedupState.fromString(reader.getString()); + } else if ("xcoolState".equals(fieldName)) { + deserializedBackupResourceConfig.xcoolState = XcoolState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceConfig; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfig.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfig.java index 7675d2acab8ad..bbd0f2d75318b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfig.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfig.java @@ -5,41 +5,40 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The BackupResourceEncryptionConfig model. */ @Fluent -public class BackupResourceEncryptionConfig { +public class BackupResourceEncryptionConfig implements JsonSerializable { /* * Encryption At Rest Type */ - @JsonProperty(value = "encryptionAtRestType") private EncryptionAtRestType encryptionAtRestType; /* * Key Vault Key URI */ - @JsonProperty(value = "keyUri") private String keyUri; /* * Key Vault Subscription Id */ - @JsonProperty(value = "subscriptionId") private String subscriptionId; /* * The lastUpdateStatus property. */ - @JsonProperty(value = "lastUpdateStatus") private LastUpdateStatus lastUpdateStatus; /* * The infrastructureEncryptionState property. */ - @JsonProperty(value = "infrastructureEncryptionState") private InfrastructureEncryptionState infrastructureEncryptionState; /** @@ -156,4 +155,59 @@ public InfrastructureEncryptionState infrastructureEncryptionState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("encryptionAtRestType", + this.encryptionAtRestType == null ? null : this.encryptionAtRestType.toString()); + jsonWriter.writeStringField("keyUri", this.keyUri); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("lastUpdateStatus", + this.lastUpdateStatus == null ? null : this.lastUpdateStatus.toString()); + jsonWriter.writeStringField("infrastructureEncryptionState", + this.infrastructureEncryptionState == null ? null : this.infrastructureEncryptionState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceEncryptionConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceEncryptionConfig if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupResourceEncryptionConfig. + */ + public static BackupResourceEncryptionConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceEncryptionConfig deserializedBackupResourceEncryptionConfig + = new BackupResourceEncryptionConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("encryptionAtRestType".equals(fieldName)) { + deserializedBackupResourceEncryptionConfig.encryptionAtRestType + = EncryptionAtRestType.fromString(reader.getString()); + } else if ("keyUri".equals(fieldName)) { + deserializedBackupResourceEncryptionConfig.keyUri = reader.getString(); + } else if ("subscriptionId".equals(fieldName)) { + deserializedBackupResourceEncryptionConfig.subscriptionId = reader.getString(); + } else if ("lastUpdateStatus".equals(fieldName)) { + deserializedBackupResourceEncryptionConfig.lastUpdateStatus + = LastUpdateStatus.fromString(reader.getString()); + } else if ("infrastructureEncryptionState".equals(fieldName)) { + deserializedBackupResourceEncryptionConfig.infrastructureEncryptionState + = InfrastructureEncryptionState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceEncryptionConfig; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigExtended.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigExtended.java index 8534110abc0c0..16c96413dc2a8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigExtended.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigExtended.java @@ -5,7 +5,10 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The BackupResourceEncryptionConfigExtended model. @@ -15,13 +18,11 @@ public final class BackupResourceEncryptionConfigExtended extends BackupResource /* * User Assigned Identity Id */ - @JsonProperty(value = "userAssignedIdentity") private String userAssignedIdentity; /* * bool to indicate whether to use system Assigned Identity or not */ - @JsonProperty(value = "useSystemAssignedIdentity") private Boolean useSystemAssignedIdentity; /** @@ -123,6 +124,67 @@ public BackupResourceEncryptionConfigExtended withLastUpdateStatus(LastUpdateSta */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("encryptionAtRestType", + encryptionAtRestType() == null ? null : encryptionAtRestType().toString()); + jsonWriter.writeStringField("keyUri", keyUri()); + jsonWriter.writeStringField("subscriptionId", subscriptionId()); + jsonWriter.writeStringField("lastUpdateStatus", + lastUpdateStatus() == null ? null : lastUpdateStatus().toString()); + jsonWriter.writeStringField("infrastructureEncryptionState", + infrastructureEncryptionState() == null ? null : infrastructureEncryptionState().toString()); + jsonWriter.writeStringField("userAssignedIdentity", this.userAssignedIdentity); + jsonWriter.writeBooleanField("useSystemAssignedIdentity", this.useSystemAssignedIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceEncryptionConfigExtended from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceEncryptionConfigExtended if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupResourceEncryptionConfigExtended. + */ + public static BackupResourceEncryptionConfigExtended fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceEncryptionConfigExtended deserializedBackupResourceEncryptionConfigExtended + = new BackupResourceEncryptionConfigExtended(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("encryptionAtRestType".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtended + .withEncryptionAtRestType(EncryptionAtRestType.fromString(reader.getString())); + } else if ("keyUri".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtended.withKeyUri(reader.getString()); + } else if ("subscriptionId".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtended.withSubscriptionId(reader.getString()); + } else if ("lastUpdateStatus".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtended + .withLastUpdateStatus(LastUpdateStatus.fromString(reader.getString())); + } else if ("infrastructureEncryptionState".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtended.withInfrastructureEncryptionState( + InfrastructureEncryptionState.fromString(reader.getString())); + } else if ("userAssignedIdentity".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtended.userAssignedIdentity = reader.getString(); + } else if ("useSystemAssignedIdentity".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigExtended.useSystemAssignedIdentity + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceEncryptionConfigExtended; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigResource.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigResource.java index f924f45367398..f9482cd014b22 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigResource.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceEncryptionConfigResource.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** @@ -17,15 +20,28 @@ public final class BackupResourceEncryptionConfigResource extends Resource { /* * BackupResourceEncryptionConfigResource properties */ - @JsonProperty(value = "properties") private BackupResourceEncryptionConfig properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of BackupResourceEncryptionConfigResource class. */ @@ -72,6 +88,36 @@ public BackupResourceEncryptionConfigResource withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -100,4 +146,59 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceEncryptionConfigResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceEncryptionConfigResource if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupResourceEncryptionConfigResource. + */ + public static BackupResourceEncryptionConfigResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceEncryptionConfigResource deserializedBackupResourceEncryptionConfigResource + = new BackupResourceEncryptionConfigResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigResource.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigResource.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedBackupResourceEncryptionConfigResource.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigResource.properties + = BackupResourceEncryptionConfig.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedBackupResourceEncryptionConfigResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceEncryptionConfigResource; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceVaultConfig.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceVaultConfig.java index 243f43d9082f4..727148a4325ec 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceVaultConfig.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupResourceVaultConfig.java @@ -5,60 +5,56 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Backup resource vault config details. */ @Fluent -public final class BackupResourceVaultConfig { +public final class BackupResourceVaultConfig implements JsonSerializable { /* * Storage type. */ - @JsonProperty(value = "storageModelType") private StorageType storageModelType; /* * Storage type. */ - @JsonProperty(value = "storageType") private StorageType storageType; /* * Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. */ - @JsonProperty(value = "storageTypeState") private StorageTypeState storageTypeState; /* * Enabled or Disabled. */ - @JsonProperty(value = "enhancedSecurityState") private EnhancedSecurityState enhancedSecurityState; /* * Soft Delete feature state */ - @JsonProperty(value = "softDeleteFeatureState") private SoftDeleteFeatureState softDeleteFeatureState; /* * Soft delete retention period in days */ - @JsonProperty(value = "softDeleteRetentionPeriodInDays") private Integer softDeleteRetentionPeriodInDays; /* * ResourceGuard Operation Requests */ - @JsonProperty(value = "resourceGuardOperationRequests") private List resourceGuardOperationRequests; /* * This flag is no longer in use. Please use 'softDeleteFeatureState' to set the soft delete state for the vault */ - @JsonProperty(value = "isSoftDeleteFeatureStateEditable") private Boolean isSoftDeleteFeatureStateEditable; /** @@ -238,4 +234,73 @@ public BackupResourceVaultConfig withIsSoftDeleteFeatureStateEditable(Boolean is */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageModelType", + this.storageModelType == null ? null : this.storageModelType.toString()); + jsonWriter.writeStringField("storageType", this.storageType == null ? null : this.storageType.toString()); + jsonWriter.writeStringField("storageTypeState", + this.storageTypeState == null ? null : this.storageTypeState.toString()); + jsonWriter.writeStringField("enhancedSecurityState", + this.enhancedSecurityState == null ? null : this.enhancedSecurityState.toString()); + jsonWriter.writeStringField("softDeleteFeatureState", + this.softDeleteFeatureState == null ? null : this.softDeleteFeatureState.toString()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", this.softDeleteRetentionPeriodInDays); + jsonWriter.writeArrayField("resourceGuardOperationRequests", this.resourceGuardOperationRequests, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isSoftDeleteFeatureStateEditable", this.isSoftDeleteFeatureStateEditable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResourceVaultConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResourceVaultConfig if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupResourceVaultConfig. + */ + public static BackupResourceVaultConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResourceVaultConfig deserializedBackupResourceVaultConfig = new BackupResourceVaultConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageModelType".equals(fieldName)) { + deserializedBackupResourceVaultConfig.storageModelType = StorageType.fromString(reader.getString()); + } else if ("storageType".equals(fieldName)) { + deserializedBackupResourceVaultConfig.storageType = StorageType.fromString(reader.getString()); + } else if ("storageTypeState".equals(fieldName)) { + deserializedBackupResourceVaultConfig.storageTypeState + = StorageTypeState.fromString(reader.getString()); + } else if ("enhancedSecurityState".equals(fieldName)) { + deserializedBackupResourceVaultConfig.enhancedSecurityState + = EnhancedSecurityState.fromString(reader.getString()); + } else if ("softDeleteFeatureState".equals(fieldName)) { + deserializedBackupResourceVaultConfig.softDeleteFeatureState + = SoftDeleteFeatureState.fromString(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedBackupResourceVaultConfig.softDeleteRetentionPeriodInDays + = reader.getNullable(JsonReader::getInt); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedBackupResourceVaultConfig.resourceGuardOperationRequests + = resourceGuardOperationRequests; + } else if ("isSoftDeleteFeatureStateEditable".equals(fieldName)) { + deserializedBackupResourceVaultConfig.isSoftDeleteFeatureStateEditable + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResourceVaultConfig; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupStatusRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupStatusRequest.java index 6ff7802e65b99..3bf6b74246055 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupStatusRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupStatusRequest.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * BackupStatus request. */ @Fluent -public final class BackupStatusRequest { +public final class BackupStatusRequest implements JsonSerializable { /* * Container Type - VM, SQLPaaS, DPM, AzureFileShare... */ - @JsonProperty(value = "resourceType") - private DataSourceType resourceType; + private DataSourceTypeAutoGenerated2 resourceType; /* * Entire ARM resource id of the resource */ - @JsonProperty(value = "resourceId") private String resourceId; /* * Protectable Item Logical Name */ - @JsonProperty(value = "poLogicalName") private String poLogicalName; /** @@ -41,7 +42,7 @@ public BackupStatusRequest() { * * @return the resourceType value. */ - public DataSourceType resourceType() { + public DataSourceTypeAutoGenerated2 resourceType() { return this.resourceType; } @@ -51,7 +52,7 @@ public DataSourceType resourceType() { * @param resourceType the resourceType value to set. * @return the BackupStatusRequest object itself. */ - public BackupStatusRequest withResourceType(DataSourceType resourceType) { + public BackupStatusRequest withResourceType(DataSourceTypeAutoGenerated2 resourceType) { this.resourceType = resourceType; return this; } @@ -103,4 +104,47 @@ public BackupStatusRequest withPoLogicalName(String poLogicalName) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceType", this.resourceType == null ? null : this.resourceType.toString()); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("poLogicalName", this.poLogicalName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupStatusRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupStatusRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupStatusRequest. + */ + public static BackupStatusRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupStatusRequest deserializedBackupStatusRequest = new BackupStatusRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceType".equals(fieldName)) { + deserializedBackupStatusRequest.resourceType + = DataSourceTypeAutoGenerated2.fromString(reader.getString()); + } else if ("resourceId".equals(fieldName)) { + deserializedBackupStatusRequest.resourceId = reader.getString(); + } else if ("poLogicalName".equals(fieldName)) { + deserializedBackupStatusRequest.poLogicalName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupStatusRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupType.java index 11913cc9f6512..93ea86f5364f7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BackupType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -67,7 +66,6 @@ public BackupType() { * @param name a name to look for. * @return the corresponding BackupType. */ - @JsonCreator public static BackupType fromString(String name) { return fromString(name, BackupType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BekDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BekDetails.java index b09d1ce29d8c9..d34bf52aa44ca 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BekDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/BekDetails.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * BEK is bitlocker encryption key. */ @Fluent -public final class BekDetails { +public final class BekDetails implements JsonSerializable { /* * Secret is BEK. */ - @JsonProperty(value = "secretUrl") private String secretUrl; /* * ID of the Key Vault where this Secret is stored. */ - @JsonProperty(value = "secretVaultId") private String secretVaultId; /* * BEK data. */ - @JsonProperty(value = "secretData") private String secretData; /** @@ -103,4 +104,46 @@ public BekDetails withSecretData(String secretData) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("secretUrl", this.secretUrl); + jsonWriter.writeStringField("secretVaultId", this.secretVaultId); + jsonWriter.writeStringField("secretData", this.secretData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BekDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BekDetails if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the BekDetails. + */ + public static BekDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BekDetails deserializedBekDetails = new BekDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("secretUrl".equals(fieldName)) { + deserializedBekDetails.secretUrl = reader.getString(); + } else if ("secretVaultId".equals(fieldName)) { + deserializedBekDetails.secretVaultId = reader.getString(); + } else if ("secretData".equals(fieldName)) { + deserializedBekDetails.secretData = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBekDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryDisplay.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryDisplay.java index 1f5868c94196e..06d9d30cfc691 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryDisplay.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryDisplay.java @@ -5,35 +5,35 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Localized display information of an operation. */ @Fluent -public final class ClientDiscoveryDisplay { +public final class ClientDiscoveryDisplay implements JsonSerializable { /* * Name of the provider for display purposes */ - @JsonProperty(value = "provider") private String provider; /* * ResourceType for which this Operation can be performed. */ - @JsonProperty(value = "resource") private String resource; /* * Operations Name itself. */ - @JsonProperty(value = "operation") private String operation; /* * Description of the operation having details of what operation is about. */ - @JsonProperty(value = "description") private String description; /** @@ -129,4 +129,49 @@ public ClientDiscoveryDisplay withDescription(String description) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", this.provider); + jsonWriter.writeStringField("resource", this.resource); + jsonWriter.writeStringField("operation", this.operation); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientDiscoveryDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientDiscoveryDisplay if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientDiscoveryDisplay. + */ + public static ClientDiscoveryDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientDiscoveryDisplay deserializedClientDiscoveryDisplay = new ClientDiscoveryDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedClientDiscoveryDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedClientDiscoveryDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedClientDiscoveryDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedClientDiscoveryDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClientDiscoveryDisplay; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForLogSpecification.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForLogSpecification.java index 69601d2e47b11..fdeb0a5de5e35 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForLogSpecification.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForLogSpecification.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Class to represent shoebox log specification in json client discovery. */ @Fluent -public final class ClientDiscoveryForLogSpecification { +public final class ClientDiscoveryForLogSpecification implements JsonSerializable { /* * Name for shoebox log specification. */ - @JsonProperty(value = "name") private String name; /* * Localized display name */ - @JsonProperty(value = "displayName") private String displayName; /* * blob duration of shoebox log specification */ - @JsonProperty(value = "blobDuration") private String blobDuration; /** @@ -103,4 +104,47 @@ public ClientDiscoveryForLogSpecification withBlobDuration(String blobDuration) */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("blobDuration", this.blobDuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientDiscoveryForLogSpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientDiscoveryForLogSpecification if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientDiscoveryForLogSpecification. + */ + public static ClientDiscoveryForLogSpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientDiscoveryForLogSpecification deserializedClientDiscoveryForLogSpecification + = new ClientDiscoveryForLogSpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedClientDiscoveryForLogSpecification.name = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedClientDiscoveryForLogSpecification.displayName = reader.getString(); + } else if ("blobDuration".equals(fieldName)) { + deserializedClientDiscoveryForLogSpecification.blobDuration = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClientDiscoveryForLogSpecification; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForProperties.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForProperties.java index 20e8422759cd7..b52bedfac12eb 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForProperties.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Class to represent shoebox properties in json client discovery. */ @Fluent -public final class ClientDiscoveryForProperties { +public final class ClientDiscoveryForProperties implements JsonSerializable { /* * Operation properties. */ - @JsonProperty(value = "serviceSpecification") private ClientDiscoveryForServiceSpecification serviceSpecification; /** @@ -55,4 +58,41 @@ public void validate() { serviceSpecification().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("serviceSpecification", this.serviceSpecification); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientDiscoveryForProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientDiscoveryForProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientDiscoveryForProperties. + */ + public static ClientDiscoveryForProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientDiscoveryForProperties deserializedClientDiscoveryForProperties = new ClientDiscoveryForProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceSpecification".equals(fieldName)) { + deserializedClientDiscoveryForProperties.serviceSpecification + = ClientDiscoveryForServiceSpecification.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedClientDiscoveryForProperties; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForServiceSpecification.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForServiceSpecification.java index 58e05cc058811..81cddab27157b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForServiceSpecification.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryForServiceSpecification.java @@ -5,18 +5,22 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Class to represent shoebox service specification in json client discovery. */ @Fluent -public final class ClientDiscoveryForServiceSpecification { +public final class ClientDiscoveryForServiceSpecification + implements JsonSerializable { /* * List of log specifications of this operation. */ - @JsonProperty(value = "logSpecifications") private List logSpecifications; /** @@ -56,4 +60,44 @@ public void validate() { logSpecifications().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("logSpecifications", this.logSpecifications, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientDiscoveryForServiceSpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientDiscoveryForServiceSpecification if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientDiscoveryForServiceSpecification. + */ + public static ClientDiscoveryForServiceSpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientDiscoveryForServiceSpecification deserializedClientDiscoveryForServiceSpecification + = new ClientDiscoveryForServiceSpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logSpecifications".equals(fieldName)) { + List logSpecifications + = reader.readArray(reader1 -> ClientDiscoveryForLogSpecification.fromJson(reader1)); + deserializedClientDiscoveryForServiceSpecification.logSpecifications = logSpecifications; + } else { + reader.skipChildren(); + } + } + + return deserializedClientDiscoveryForServiceSpecification; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryResponse.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryResponse.java index de9c93eeb3606..8b7c730671d56 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryResponse.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientDiscoveryResponse.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ClientDiscoveryValueForSingleApiInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Operations List response which contains list of available APIs. */ @Fluent -public final class ClientDiscoveryResponse { +public final class ClientDiscoveryResponse implements JsonSerializable { /* * List of available operations. */ - @JsonProperty(value = "value") private List value; /* * Link to the next chunk of Response. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -82,4 +84,45 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientDiscoveryResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientDiscoveryResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientDiscoveryResponse. + */ + public static ClientDiscoveryResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientDiscoveryResponse deserializedClientDiscoveryResponse = new ClientDiscoveryResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ClientDiscoveryValueForSingleApiInner.fromJson(reader1)); + deserializedClientDiscoveryResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedClientDiscoveryResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClientDiscoveryResponse; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientScriptForConnect.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientScriptForConnect.java index 1bff719aca0f4..c5adaa4222aa7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientScriptForConnect.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ClientScriptForConnect.java @@ -5,42 +5,41 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Client script details for file / folder restore. */ @Fluent -public final class ClientScriptForConnect { +public final class ClientScriptForConnect implements JsonSerializable { /* * File content of the client script for file / folder restore. */ - @JsonProperty(value = "scriptContent") private String scriptContent; /* * File extension of the client script for file / folder restore - .ps1 , .sh , etc. */ - @JsonProperty(value = "scriptExtension") private String scriptExtension; /* * OS type - Windows, Linux etc. for which this file / folder restore client script works. */ - @JsonProperty(value = "osType") private String osType; /* * URL of Executable from where to source the content. If this is not null then ScriptContent should not be used */ - @JsonProperty(value = "url") private String url; /* * 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. */ - @JsonProperty(value = "scriptNameSuffix") private String scriptNameSuffix; /** @@ -164,4 +163,52 @@ public ClientScriptForConnect withScriptNameSuffix(String scriptNameSuffix) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("scriptContent", this.scriptContent); + jsonWriter.writeStringField("scriptExtension", this.scriptExtension); + jsonWriter.writeStringField("osType", this.osType); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("scriptNameSuffix", this.scriptNameSuffix); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientScriptForConnect from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientScriptForConnect if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientScriptForConnect. + */ + public static ClientScriptForConnect fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientScriptForConnect deserializedClientScriptForConnect = new ClientScriptForConnect(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("scriptContent".equals(fieldName)) { + deserializedClientScriptForConnect.scriptContent = reader.getString(); + } else if ("scriptExtension".equals(fieldName)) { + deserializedClientScriptForConnect.scriptExtension = reader.getString(); + } else if ("osType".equals(fieldName)) { + deserializedClientScriptForConnect.osType = reader.getString(); + } else if ("url".equals(fieldName)) { + deserializedClientScriptForConnect.url = reader.getString(); + } else if ("scriptNameSuffix".equals(fieldName)) { + deserializedClientScriptForConnect.scriptNameSuffix = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedClientScriptForConnect; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ContainerIdentityInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ContainerIdentityInfo.java index 9a57f351562c4..fc50da8867f75 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ContainerIdentityInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ContainerIdentityInfo.java @@ -5,35 +5,35 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Container identity information. */ @Fluent -public final class ContainerIdentityInfo { +public final class ContainerIdentityInfo implements JsonSerializable { /* * Unique name of the container */ - @JsonProperty(value = "uniqueName") private String uniqueName; /* * Protection container identity - AAD Tenant */ - @JsonProperty(value = "aadTenantId") private String aadTenantId; /* * Protection container identity - AAD Service Principal */ - @JsonProperty(value = "servicePrincipalClientId") private String servicePrincipalClientId; /* * Protection container identity - Audience */ - @JsonProperty(value = "audience") private String audience; /** @@ -129,4 +129,49 @@ public ContainerIdentityInfo withAudience(String audience) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("uniqueName", this.uniqueName); + jsonWriter.writeStringField("aadTenantId", this.aadTenantId); + jsonWriter.writeStringField("servicePrincipalClientId", this.servicePrincipalClientId); + jsonWriter.writeStringField("audience", this.audience); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContainerIdentityInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContainerIdentityInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContainerIdentityInfo. + */ + public static ContainerIdentityInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContainerIdentityInfo deserializedContainerIdentityInfo = new ContainerIdentityInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uniqueName".equals(fieldName)) { + deserializedContainerIdentityInfo.uniqueName = reader.getString(); + } else if ("aadTenantId".equals(fieldName)) { + deserializedContainerIdentityInfo.aadTenantId = reader.getString(); + } else if ("servicePrincipalClientId".equals(fieldName)) { + deserializedContainerIdentityInfo.servicePrincipalClientId = reader.getString(); + } else if ("audience".equals(fieldName)) { + deserializedContainerIdentityInfo.audience = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedContainerIdentityInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CopyOptions.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CopyOptions.java index b222ee65577cb..093239af4715e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CopyOptions.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CopyOptions.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public CopyOptions() { * @param name a name to look for. * @return the corresponding CopyOptions. */ - @JsonCreator public static CopyOptions fromString(String name) { return fromString(name, CopyOptions.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CreateMode.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CreateMode.java index 57e226d01f054..b3c3a933e7e5d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CreateMode.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/CreateMode.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public CreateMode() { * @param name a name to look for. * @return the corresponding CreateMode. */ - @JsonCreator public static CreateMode fromString(String name) { return fromString(name, CreateMode.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionFormat.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionFormat.java index 8e9ed65d080e1..fb2c37de3da1c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionFormat.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionFormat.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Daily retention format. */ @Fluent -public final class DailyRetentionFormat { +public final class DailyRetentionFormat implements JsonSerializable { /* * List of days of the month. */ - @JsonProperty(value = "daysOfTheMonth") private List daysOfTheMonth; /** @@ -55,4 +58,42 @@ public void validate() { daysOfTheMonth().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("daysOfTheMonth", this.daysOfTheMonth, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DailyRetentionFormat from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DailyRetentionFormat if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DailyRetentionFormat. + */ + public static DailyRetentionFormat fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DailyRetentionFormat deserializedDailyRetentionFormat = new DailyRetentionFormat(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("daysOfTheMonth".equals(fieldName)) { + List daysOfTheMonth = reader.readArray(reader1 -> Day.fromJson(reader1)); + deserializedDailyRetentionFormat.daysOfTheMonth = daysOfTheMonth; + } else { + reader.skipChildren(); + } + } + + return deserializedDailyRetentionFormat; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionSchedule.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionSchedule.java index e576dd15a01cd..fae8de9c63a83 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionSchedule.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailyRetentionSchedule.java @@ -5,25 +5,29 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Daily retention schedule. */ @Fluent -public final class DailyRetentionSchedule { +public final class DailyRetentionSchedule implements JsonSerializable { /* * Retention times of retention policy. */ - @JsonProperty(value = "retentionTimes") private List retentionTimes; /* * Retention duration of retention Policy. */ - @JsonProperty(value = "retentionDuration") private RetentionDuration retentionDuration; /** @@ -82,4 +86,46 @@ public void validate() { retentionDuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("retentionTimes", this.retentionTimes, (writer, element) -> writer + .writeString(element == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(element))); + jsonWriter.writeJsonField("retentionDuration", this.retentionDuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DailyRetentionSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DailyRetentionSchedule if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DailyRetentionSchedule. + */ + public static DailyRetentionSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DailyRetentionSchedule deserializedDailyRetentionSchedule = new DailyRetentionSchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionTimes".equals(fieldName)) { + List retentionTimes = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + deserializedDailyRetentionSchedule.retentionTimes = retentionTimes; + } else if ("retentionDuration".equals(fieldName)) { + deserializedDailyRetentionSchedule.retentionDuration = RetentionDuration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDailyRetentionSchedule; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailySchedule.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailySchedule.java index 5d266cb474406..a4084a3e4b1f8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailySchedule.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DailySchedule.java @@ -5,19 +5,24 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * The DailySchedule model. */ @Fluent -public final class DailySchedule { +public final class DailySchedule implements JsonSerializable { /* * List of times of day this schedule has to be run. */ - @JsonProperty(value = "scheduleRunTimes") private List scheduleRunTimes; /** @@ -53,4 +58,43 @@ public DailySchedule withScheduleRunTimes(List scheduleRunTimes) */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("scheduleRunTimes", this.scheduleRunTimes, (writer, element) -> writer + .writeString(element == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(element))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DailySchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DailySchedule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DailySchedule. + */ + public static DailySchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DailySchedule deserializedDailySchedule = new DailySchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("scheduleRunTimes".equals(fieldName)) { + List scheduleRunTimes = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + deserializedDailySchedule.scheduleRunTimes = scheduleRunTimes; + } else { + reader.skipChildren(); + } + } + + return deserializedDailySchedule; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataMoveLevel.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataMoveLevel.java index e9c93ab2305b5..0c0386134ef9d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataMoveLevel.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataMoveLevel.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public DataMoveLevel() { * @param name a name to look for. * @return the corresponding DataMoveLevel. */ - @JsonCreator public static DataMoveLevel fromString(String name) { return fromString(name, DataMoveLevel.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceType.java deleted file mode 100644 index 2cbd40f63be06..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceType.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Type of workload this item represents. - */ -public final class DataSourceType extends ExpandableStringEnum { - /** - * Static value Invalid for DataSourceType. - */ - public static final DataSourceType INVALID = fromString("Invalid"); - - /** - * Static value VM for DataSourceType. - */ - public static final DataSourceType VM = fromString("VM"); - - /** - * Static value FileFolder for DataSourceType. - */ - public static final DataSourceType FILE_FOLDER = fromString("FileFolder"); - - /** - * Static value AzureSqlDb for DataSourceType. - */ - public static final DataSourceType AZURE_SQL_DB = fromString("AzureSqlDb"); - - /** - * Static value SQLDB for DataSourceType. - */ - public static final DataSourceType SQLDB = fromString("SQLDB"); - - /** - * Static value Exchange for DataSourceType. - */ - public static final DataSourceType EXCHANGE = fromString("Exchange"); - - /** - * Static value Sharepoint for DataSourceType. - */ - public static final DataSourceType SHAREPOINT = fromString("Sharepoint"); - - /** - * Static value VMwareVM for DataSourceType. - */ - public static final DataSourceType VMWARE_VM = fromString("VMwareVM"); - - /** - * Static value SystemState for DataSourceType. - */ - public static final DataSourceType SYSTEM_STATE = fromString("SystemState"); - - /** - * Static value Client for DataSourceType. - */ - public static final DataSourceType CLIENT = fromString("Client"); - - /** - * Static value GenericDataSource for DataSourceType. - */ - public static final DataSourceType GENERIC_DATA_SOURCE = fromString("GenericDataSource"); - - /** - * Static value SQLDataBase for DataSourceType. - */ - public static final DataSourceType SQLDATA_BASE = fromString("SQLDataBase"); - - /** - * Static value AzureFileShare for DataSourceType. - */ - public static final DataSourceType AZURE_FILE_SHARE = fromString("AzureFileShare"); - - /** - * Static value SAPHanaDatabase for DataSourceType. - */ - public static final DataSourceType SAPHANA_DATABASE = fromString("SAPHanaDatabase"); - - /** - * Static value SAPAseDatabase for DataSourceType. - */ - public static final DataSourceType SAPASE_DATABASE = fromString("SAPAseDatabase"); - - /** - * Static value SAPHanaDBInstance for DataSourceType. - */ - public static final DataSourceType SAPHANA_DBINSTANCE = fromString("SAPHanaDBInstance"); - - /** - * Creates a new instance of DataSourceType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public DataSourceType() { - } - - /** - * Creates or finds a DataSourceType from its string representation. - * - * @param name a name to look for. - * @return the corresponding DataSourceType. - */ - @JsonCreator - public static DataSourceType fromString(String name) { - return fromString(name, DataSourceType.class); - } - - /** - * Gets known DataSourceType values. - * - * @return known DataSourceType values. - */ - public static Collection values() { - return values(DataSourceType.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated.java new file mode 100644 index 0000000000000..c3685ec8309f3 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc. + */ +public final class DataSourceTypeAutoGenerated extends ExpandableStringEnum { + /** + * Static value Invalid for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated INVALID = fromString("Invalid"); + + /** + * Static value VM for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated VM = fromString("VM"); + + /** + * Static value FileFolder for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated FILE_FOLDER = fromString("FileFolder"); + + /** + * Static value AzureSqlDb for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated AZURE_SQL_DB = fromString("AzureSqlDb"); + + /** + * Static value SQLDB for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated SQLDB = fromString("SQLDB"); + + /** + * Static value Exchange for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated EXCHANGE = fromString("Exchange"); + + /** + * Static value Sharepoint for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated SHAREPOINT = fromString("Sharepoint"); + + /** + * Static value VMwareVM for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated VMWARE_VM = fromString("VMwareVM"); + + /** + * Static value SystemState for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated SYSTEM_STATE = fromString("SystemState"); + + /** + * Static value Client for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated CLIENT = fromString("Client"); + + /** + * Static value GenericDataSource for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated GENERIC_DATA_SOURCE = fromString("GenericDataSource"); + + /** + * Static value SQLDataBase for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated SQLDATA_BASE = fromString("SQLDataBase"); + + /** + * Static value AzureFileShare for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated AZURE_FILE_SHARE = fromString("AzureFileShare"); + + /** + * Static value SAPHanaDatabase for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated SAPHANA_DATABASE = fromString("SAPHanaDatabase"); + + /** + * Static value SAPAseDatabase for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated SAPASE_DATABASE = fromString("SAPAseDatabase"); + + /** + * Static value SAPHanaDBInstance for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated SAPHANA_DBINSTANCE = fromString("SAPHanaDBInstance"); + + /** + * Static value OracleDatabase for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated ORACLE_DATABASE = fromString("OracleDatabase"); + + /** + * Static value AnyDatabase for DataSourceTypeAutoGenerated. + */ + public static final DataSourceTypeAutoGenerated ANY_DATABASE = fromString("AnyDatabase"); + + /** + * Creates a new instance of DataSourceTypeAutoGenerated value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataSourceTypeAutoGenerated() { + } + + /** + * Creates or finds a DataSourceTypeAutoGenerated from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataSourceTypeAutoGenerated. + */ + public static DataSourceTypeAutoGenerated fromString(String name) { + return fromString(name, DataSourceTypeAutoGenerated.class); + } + + /** + * Gets known DataSourceTypeAutoGenerated values. + * + * @return known DataSourceTypeAutoGenerated values. + */ + public static Collection values() { + return values(DataSourceTypeAutoGenerated.class); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated2.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated2.java new file mode 100644 index 0000000000000..cbffc45ccee02 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated2.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Container Type - VM, SQLPaaS, DPM, AzureFileShare... + */ +public final class DataSourceTypeAutoGenerated2 extends ExpandableStringEnum { + /** + * Static value Invalid for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 INVALID = fromString("Invalid"); + + /** + * Static value VM for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 VM = fromString("VM"); + + /** + * Static value FileFolder for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 FILE_FOLDER = fromString("FileFolder"); + + /** + * Static value AzureSqlDb for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 AZURE_SQL_DB = fromString("AzureSqlDb"); + + /** + * Static value SQLDB for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 SQLDB = fromString("SQLDB"); + + /** + * Static value Exchange for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 EXCHANGE = fromString("Exchange"); + + /** + * Static value Sharepoint for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 SHAREPOINT = fromString("Sharepoint"); + + /** + * Static value VMwareVM for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 VMWARE_VM = fromString("VMwareVM"); + + /** + * Static value SystemState for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 SYSTEM_STATE = fromString("SystemState"); + + /** + * Static value Client for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 CLIENT = fromString("Client"); + + /** + * Static value GenericDataSource for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 GENERIC_DATA_SOURCE = fromString("GenericDataSource"); + + /** + * Static value SQLDataBase for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 SQLDATA_BASE = fromString("SQLDataBase"); + + /** + * Static value AzureFileShare for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 AZURE_FILE_SHARE = fromString("AzureFileShare"); + + /** + * Static value SAPHanaDatabase for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 SAPHANA_DATABASE = fromString("SAPHanaDatabase"); + + /** + * Static value SAPAseDatabase for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 SAPASE_DATABASE = fromString("SAPAseDatabase"); + + /** + * Static value SAPHanaDBInstance for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 SAPHANA_DBINSTANCE = fromString("SAPHanaDBInstance"); + + /** + * Static value OracleDatabase for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 ORACLE_DATABASE = fromString("OracleDatabase"); + + /** + * Static value AnyDatabase for DataSourceTypeAutoGenerated2. + */ + public static final DataSourceTypeAutoGenerated2 ANY_DATABASE = fromString("AnyDatabase"); + + /** + * Creates a new instance of DataSourceTypeAutoGenerated2 value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataSourceTypeAutoGenerated2() { + } + + /** + * Creates or finds a DataSourceTypeAutoGenerated2 from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataSourceTypeAutoGenerated2. + */ + public static DataSourceTypeAutoGenerated2 fromString(String name) { + return fromString(name, DataSourceTypeAutoGenerated2.class); + } + + /** + * Gets known DataSourceTypeAutoGenerated2 values. + * + * @return known DataSourceTypeAutoGenerated2 values. + */ + public static Collection values() { + return values(DataSourceTypeAutoGenerated2.class); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated3.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated3.java new file mode 100644 index 0000000000000..2d6f4d1f8370c --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DataSourceTypeAutoGenerated3.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of workload this item represents. + */ +public final class DataSourceTypeAutoGenerated3 extends ExpandableStringEnum { + /** + * Static value Invalid for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 INVALID = fromString("Invalid"); + + /** + * Static value VM for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 VM = fromString("VM"); + + /** + * Static value FileFolder for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 FILE_FOLDER = fromString("FileFolder"); + + /** + * Static value AzureSqlDb for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 AZURE_SQL_DB = fromString("AzureSqlDb"); + + /** + * Static value SQLDB for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 SQLDB = fromString("SQLDB"); + + /** + * Static value Exchange for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 EXCHANGE = fromString("Exchange"); + + /** + * Static value Sharepoint for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 SHAREPOINT = fromString("Sharepoint"); + + /** + * Static value VMwareVM for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 VMWARE_VM = fromString("VMwareVM"); + + /** + * Static value SystemState for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 SYSTEM_STATE = fromString("SystemState"); + + /** + * Static value Client for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 CLIENT = fromString("Client"); + + /** + * Static value GenericDataSource for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 GENERIC_DATA_SOURCE = fromString("GenericDataSource"); + + /** + * Static value SQLDataBase for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 SQLDATA_BASE = fromString("SQLDataBase"); + + /** + * Static value AzureFileShare for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 AZURE_FILE_SHARE = fromString("AzureFileShare"); + + /** + * Static value SAPHanaDatabase for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 SAPHANA_DATABASE = fromString("SAPHanaDatabase"); + + /** + * Static value SAPAseDatabase for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 SAPASE_DATABASE = fromString("SAPAseDatabase"); + + /** + * Static value SAPHanaDBInstance for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 SAPHANA_DBINSTANCE = fromString("SAPHanaDBInstance"); + + /** + * Static value OracleDatabase for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 ORACLE_DATABASE = fromString("OracleDatabase"); + + /** + * Static value AnyDatabase for DataSourceTypeAutoGenerated3. + */ + public static final DataSourceTypeAutoGenerated3 ANY_DATABASE = fromString("AnyDatabase"); + + /** + * Creates a new instance of DataSourceTypeAutoGenerated3 value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataSourceTypeAutoGenerated3() { + } + + /** + * Creates or finds a DataSourceTypeAutoGenerated3 from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataSourceTypeAutoGenerated3. + */ + public static DataSourceTypeAutoGenerated3 fromString(String name) { + return fromString(name, DataSourceTypeAutoGenerated3.class); + } + + /** + * Gets known DataSourceTypeAutoGenerated3 values. + * + * @return known DataSourceTypeAutoGenerated3 values. + */ + public static Collection values() { + return values(DataSourceTypeAutoGenerated3.class); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Day.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Day.java index 540c6c445451f..77e241573ec1e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Day.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Day.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Day of the week. */ @Fluent -public final class Day { +public final class Day implements JsonSerializable { /* * Date of the month */ - @JsonProperty(value = "date") private Integer date; /* * Whether Date is last date of month */ - @JsonProperty(value = "isLast") private Boolean isLast; /** @@ -77,4 +79,43 @@ public Day withIsLast(Boolean isLast) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("date", this.date); + jsonWriter.writeBooleanField("isLast", this.isLast); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Day from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Day if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Day. + */ + public static Day fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Day deserializedDay = new Day(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("date".equals(fieldName)) { + deserializedDay.date = reader.getNullable(JsonReader::getInt); + } else if ("isLast".equals(fieldName)) { + deserializedDay.isLast = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDay; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DayOfWeek.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DayOfWeek.java index 15260d3d3c127..67ef6b2cf93f1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DayOfWeek.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DayOfWeek.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Defines values for DayOfWeek. */ @@ -61,7 +58,6 @@ public enum DayOfWeek { * @param value the serialized value to parse. * @return the parsed DayOfWeek object, or null if unable to parse. */ - @JsonCreator public static DayOfWeek fromString(String value) { if (value == null) { return null; @@ -78,7 +74,6 @@ public static DayOfWeek fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DedupState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DedupState.java index 64c71d6b735a7..1102a69cb0f3b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DedupState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DedupState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public DedupState() { * @param name a name to look for. * @return the corresponding DedupState. */ - @JsonCreator public static DedupState fromString(String name) { return fromString(name, DedupState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskExclusionProperties.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskExclusionProperties.java index 6d99d50d5a289..87db1719d8859 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskExclusionProperties.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskExclusionProperties.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * The DiskExclusionProperties model. */ @Fluent -public final class DiskExclusionProperties { +public final class DiskExclusionProperties implements JsonSerializable { /* * List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. */ - @JsonProperty(value = "diskLunList") private List diskLunList; /* * Flag to indicate whether DiskLunList is to be included/ excluded from backup. */ - @JsonProperty(value = "isInclusionList") private Boolean isInclusionList; /** @@ -78,4 +80,44 @@ public DiskExclusionProperties withIsInclusionList(Boolean isInclusionList) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("diskLunList", this.diskLunList, (writer, element) -> writer.writeInt(element)); + jsonWriter.writeBooleanField("isInclusionList", this.isInclusionList); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiskExclusionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiskExclusionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DiskExclusionProperties. + */ + public static DiskExclusionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiskExclusionProperties deserializedDiskExclusionProperties = new DiskExclusionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("diskLunList".equals(fieldName)) { + List diskLunList = reader.readArray(reader1 -> reader1.getInt()); + deserializedDiskExclusionProperties.diskLunList = diskLunList; + } else if ("isInclusionList".equals(fieldName)) { + deserializedDiskExclusionProperties.isInclusionList = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDiskExclusionProperties; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskInformation.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskInformation.java index 88fdf6e78ae93..b6e32fc311de8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskInformation.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DiskInformation.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Disk information. */ @Fluent -public final class DiskInformation { +public final class DiskInformation implements JsonSerializable { /* * The lun property. */ - @JsonProperty(value = "lun") private Integer lun; /* * The name property. */ - @JsonProperty(value = "name") private String name; /** @@ -77,4 +79,43 @@ public DiskInformation withName(String name) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("lun", this.lun); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiskInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiskInformation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DiskInformation. + */ + public static DiskInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiskInformation deserializedDiskInformation = new DiskInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lun".equals(fieldName)) { + deserializedDiskInformation.lun = reader.getNullable(JsonReader::getInt); + } else if ("name".equals(fieldName)) { + deserializedDiskInformation.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiskInformation; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DistributedNodesInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DistributedNodesInfo.java index 2ea8566ee05ce..7593e202c5999 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DistributedNodesInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DistributedNodesInfo.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * This is used to represent the various nodes of the distributed container. */ @Fluent -public final class DistributedNodesInfo { +public final class DistributedNodesInfo implements JsonSerializable { /* * Name of the node under a distributed container. */ - @JsonProperty(value = "nodeName") private String nodeName; /* * Status of this Node. * Failed | Succeeded */ - @JsonProperty(value = "status") private String status; /* * Error Details if the Status is non-success. */ - @JsonProperty(value = "errorDetail") private ErrorDetail errorDetail; /* * ARM resource id of the node */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /** @@ -135,4 +135,49 @@ public void validate() { errorDetail().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nodeName", this.nodeName); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeJsonField("errorDetail", this.errorDetail); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistributedNodesInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistributedNodesInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DistributedNodesInfo. + */ + public static DistributedNodesInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DistributedNodesInfo deserializedDistributedNodesInfo = new DistributedNodesInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nodeName".equals(fieldName)) { + deserializedDistributedNodesInfo.nodeName = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedDistributedNodesInfo.status = reader.getString(); + } else if ("errorDetail".equals(fieldName)) { + deserializedDistributedNodesInfo.errorDetail = ErrorDetail.fromJson(reader); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedDistributedNodesInfo.sourceResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDistributedNodesInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmBackupEngine.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmBackupEngine.java index a9215dd48b0cc..b36548d6cb7b3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmBackupEngine.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmBackupEngine.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Data Protection Manager (DPM) specific backup engine. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupEngineType", - defaultImpl = DpmBackupEngine.class, - visible = true) -@JsonTypeName("DpmBackupEngine") @Fluent public final class DpmBackupEngine extends BackupEngineBase { /* * Type of the backup engine. */ - @JsonTypeId - @JsonProperty(value = "backupEngineType", required = true) private BackupEngineType backupEngineType = BackupEngineType.DPM_BACKUP_ENGINE; /** @@ -159,6 +151,84 @@ public DpmBackupEngine withExtendedInfo(BackupEngineExtendedInfo extendedInfo) { */ @Override public void validate() { - super.validate(); + if (extendedInfo() != null) { + extendedInfo().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("backupEngineState", backupEngineState()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeBooleanField("canReRegister", canReRegister()); + jsonWriter.writeStringField("backupEngineId", backupEngineId()); + jsonWriter.writeStringField("dpmVersion", dpmVersion()); + jsonWriter.writeStringField("azureBackupAgentVersion", azureBackupAgentVersion()); + jsonWriter.writeBooleanField("isAzureBackupAgentUpgradeAvailable", isAzureBackupAgentUpgradeAvailable()); + jsonWriter.writeBooleanField("isDpmUpgradeAvailable", isDpmUpgradeAvailable()); + jsonWriter.writeJsonField("extendedInfo", extendedInfo()); + jsonWriter.writeStringField("backupEngineType", + this.backupEngineType == null ? null : this.backupEngineType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmBackupEngine from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmBackupEngine if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmBackupEngine. + */ + public static DpmBackupEngine fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmBackupEngine deserializedDpmBackupEngine = new DpmBackupEngine(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedDpmBackupEngine.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedDpmBackupEngine + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedDpmBackupEngine.withRegistrationStatus(reader.getString()); + } else if ("backupEngineState".equals(fieldName)) { + deserializedDpmBackupEngine.withBackupEngineState(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedDpmBackupEngine.withHealthStatus(reader.getString()); + } else if ("canReRegister".equals(fieldName)) { + deserializedDpmBackupEngine.withCanReRegister(reader.getNullable(JsonReader::getBoolean)); + } else if ("backupEngineId".equals(fieldName)) { + deserializedDpmBackupEngine.withBackupEngineId(reader.getString()); + } else if ("dpmVersion".equals(fieldName)) { + deserializedDpmBackupEngine.withDpmVersion(reader.getString()); + } else if ("azureBackupAgentVersion".equals(fieldName)) { + deserializedDpmBackupEngine.withAzureBackupAgentVersion(reader.getString()); + } else if ("isAzureBackupAgentUpgradeAvailable".equals(fieldName)) { + deserializedDpmBackupEngine + .withIsAzureBackupAgentUpgradeAvailable(reader.getNullable(JsonReader::getBoolean)); + } else if ("isDpmUpgradeAvailable".equals(fieldName)) { + deserializedDpmBackupEngine.withIsDpmUpgradeAvailable(reader.getNullable(JsonReader::getBoolean)); + } else if ("extendedInfo".equals(fieldName)) { + deserializedDpmBackupEngine.withExtendedInfo(BackupEngineExtendedInfo.fromJson(reader)); + } else if ("backupEngineType".equals(fieldName)) { + deserializedDpmBackupEngine.backupEngineType = BackupEngineType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmBackupEngine; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainer.java index 4f8548617e123..78ea389356df0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainer.java @@ -5,77 +5,64 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * DPM workload-specific protection container. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "containerType", defaultImpl = DpmContainer.class, visible = true) -@JsonTypeName("DPMContainer") -@JsonSubTypes({ @JsonSubTypes.Type(name = "AzureBackupServerContainer", value = AzureBackupServerContainer.class) }) @Fluent public class DpmContainer extends ProtectionContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.DPMCONTAINER; /* * Specifies whether the container is re-registrable. */ - @JsonProperty(value = "canReRegister") private Boolean canReRegister; /* * ID of container. */ - @JsonProperty(value = "containerId") private String containerId; /* * Number of protected items in the BackupEngine */ - @JsonProperty(value = "protectedItemCount") private Long protectedItemCount; /* * Backup engine Agent version */ - @JsonProperty(value = "dpmAgentVersion") private String dpmAgentVersion; /* * List of BackupEngines protecting the container */ - @JsonProperty(value = "dpmServers") private List dpmServers; /* * To check if upgrade available */ - @JsonProperty(value = "upgradeAvailable") private Boolean upgradeAvailable; /* * Protection status of the container. */ - @JsonProperty(value = "protectionStatus") private String protectionStatus; /* * Extended Info of the container. */ - @JsonProperty(value = "extendedInfo") private DpmContainerExtendedInfo extendedInfo; /** @@ -310,9 +297,111 @@ public DpmContainer withProtectableObjectType(String protectableObjectType) { */ @Override public void validate() { - super.validate(); if (extendedInfo() != null) { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + jsonWriter.writeBooleanField("canReRegister", this.canReRegister); + jsonWriter.writeStringField("containerId", this.containerId); + jsonWriter.writeNumberField("protectedItemCount", this.protectedItemCount); + jsonWriter.writeStringField("dpmAgentVersion", this.dpmAgentVersion); + jsonWriter.writeArrayField("dpmServers", this.dpmServers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("upgradeAvailable", this.upgradeAvailable); + jsonWriter.writeStringField("protectionStatus", this.protectionStatus); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmContainer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmContainer. + */ + public static DpmContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("containerType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureBackupServerContainer".equals(discriminatorValue)) { + return AzureBackupServerContainer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static DpmContainer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmContainer deserializedDpmContainer = new DpmContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedDpmContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedDpmContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedDpmContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedDpmContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedDpmContainer.withProtectableObjectType(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedDpmContainer.containerType = ProtectableContainerType.fromString(reader.getString()); + } else if ("canReRegister".equals(fieldName)) { + deserializedDpmContainer.canReRegister = reader.getNullable(JsonReader::getBoolean); + } else if ("containerId".equals(fieldName)) { + deserializedDpmContainer.containerId = reader.getString(); + } else if ("protectedItemCount".equals(fieldName)) { + deserializedDpmContainer.protectedItemCount = reader.getNullable(JsonReader::getLong); + } else if ("dpmAgentVersion".equals(fieldName)) { + deserializedDpmContainer.dpmAgentVersion = reader.getString(); + } else if ("dpmServers".equals(fieldName)) { + List dpmServers = reader.readArray(reader1 -> reader1.getString()); + deserializedDpmContainer.dpmServers = dpmServers; + } else if ("upgradeAvailable".equals(fieldName)) { + deserializedDpmContainer.upgradeAvailable = reader.getNullable(JsonReader::getBoolean); + } else if ("protectionStatus".equals(fieldName)) { + deserializedDpmContainer.protectionStatus = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedDpmContainer.extendedInfo = DpmContainerExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmContainer; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainerExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainerExtendedInfo.java index df594e98368ae..08447674eb631 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainerExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmContainerExtendedInfo.java @@ -5,18 +5,23 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Additional information of the DPMContainer. */ @Fluent -public final class DpmContainerExtendedInfo { +public final class DpmContainerExtendedInfo implements JsonSerializable { /* * Last refresh time of the DPMContainer. */ - @JsonProperty(value = "lastRefreshedAt") private OffsetDateTime lastRefreshedAt; /** @@ -52,4 +57,42 @@ public DpmContainerExtendedInfo withLastRefreshedAt(OffsetDateTime lastRefreshed */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastRefreshedAt", + this.lastRefreshedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastRefreshedAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmContainerExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmContainerExtendedInfo if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmContainerExtendedInfo. + */ + public static DpmContainerExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmContainerExtendedInfo deserializedDpmContainerExtendedInfo = new DpmContainerExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastRefreshedAt".equals(fieldName)) { + deserializedDpmContainerExtendedInfo.lastRefreshedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmContainerExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmErrorInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmErrorInfo.java index 5ccef811ac0cd..a8a7a99f89f2d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmErrorInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmErrorInfo.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * DPM workload-specific error information. */ @Fluent -public final class DpmErrorInfo { +public final class DpmErrorInfo implements JsonSerializable { /* * Localized error string. */ - @JsonProperty(value = "errorString") private String errorString; /* * List of localized recommendations for above error code. */ - @JsonProperty(value = "recommendations") private List recommendations; /** @@ -78,4 +80,45 @@ public DpmErrorInfo withRecommendations(List recommendations) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorString", this.errorString); + jsonWriter.writeArrayField("recommendations", this.recommendations, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmErrorInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmErrorInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmErrorInfo. + */ + public static DpmErrorInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmErrorInfo deserializedDpmErrorInfo = new DpmErrorInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorString".equals(fieldName)) { + deserializedDpmErrorInfo.errorString = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedDpmErrorInfo.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedDpmErrorInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJob.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJob.java index b536c85e9c487..3ed8cc6a2e7b2 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJob.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJob.java @@ -5,74 +5,65 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * DPM workload-specific job object. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = DpmJob.class, visible = true) -@JsonTypeName("DpmJob") @Fluent public final class DpmJob extends Job { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) private String jobType = "DpmJob"; /* * Time elapsed for job. */ - @JsonProperty(value = "duration") private Duration duration; /* * DPM server name managing the backup item or backup job. */ - @JsonProperty(value = "dpmServerName") private String dpmServerName; /* * Name of cluster/server protecting current backup item, if any. */ - @JsonProperty(value = "containerName") private String containerName; /* * Type of container. */ - @JsonProperty(value = "containerType") private String containerType; /* * Type of backup item. */ - @JsonProperty(value = "workloadType") private String workloadType; /* * The state/actions applicable on this job like cancel/retry. */ - @JsonProperty(value = "actionsInfo") private List actionsInfo; /* * The errors. */ - @JsonProperty(value = "errorDetails") private List errorDetails; /* * Additional information for this job. */ - @JsonProperty(value = "extendedInfo") private DpmJobExtendedInfo extendedInfo; /** @@ -322,7 +313,6 @@ public DpmJob withActivityId(String activityId) { */ @Override public void validate() { - super.validate(); if (errorDetails() != null) { errorDetails().forEach(e -> e.validate()); } @@ -330,4 +320,95 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityFriendlyName", entityFriendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("operation", operation()); + jsonWriter.writeStringField("status", status()); + jsonWriter.writeStringField("startTime", + startTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(startTime())); + jsonWriter.writeStringField("endTime", + endTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(endTime())); + jsonWriter.writeStringField("activityId", activityId()); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("dpmServerName", this.dpmServerName); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("containerType", this.containerType); + jsonWriter.writeStringField("workloadType", this.workloadType); + jsonWriter.writeArrayField("actionsInfo", this.actionsInfo, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("errorDetails", this.errorDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmJob if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the DpmJob. + */ + public static DpmJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmJob deserializedDpmJob = new DpmJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityFriendlyName".equals(fieldName)) { + deserializedDpmJob.withEntityFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedDpmJob.withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("operation".equals(fieldName)) { + deserializedDpmJob.withOperation(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedDpmJob.withStatus(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedDpmJob.withStartTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("endTime".equals(fieldName)) { + deserializedDpmJob.withEndTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("activityId".equals(fieldName)) { + deserializedDpmJob.withActivityId(reader.getString()); + } else if ("jobType".equals(fieldName)) { + deserializedDpmJob.jobType = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedDpmJob.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("dpmServerName".equals(fieldName)) { + deserializedDpmJob.dpmServerName = reader.getString(); + } else if ("containerName".equals(fieldName)) { + deserializedDpmJob.containerName = reader.getString(); + } else if ("containerType".equals(fieldName)) { + deserializedDpmJob.containerType = reader.getString(); + } else if ("workloadType".equals(fieldName)) { + deserializedDpmJob.workloadType = reader.getString(); + } else if ("actionsInfo".equals(fieldName)) { + List actionsInfo + = reader.readArray(reader1 -> JobSupportedAction.fromString(reader1.getString())); + deserializedDpmJob.actionsInfo = actionsInfo; + } else if ("errorDetails".equals(fieldName)) { + List errorDetails = reader.readArray(reader1 -> DpmErrorInfo.fromJson(reader1)); + deserializedDpmJob.errorDetails = errorDetails; + } else if ("extendedInfo".equals(fieldName)) { + deserializedDpmJob.extendedInfo = DpmJobExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmJob; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobExtendedInfo.java index c3a591fc535c6..401fbba27a96d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobExtendedInfo.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -14,24 +17,20 @@ * Additional information on the DPM workload-specific job. */ @Fluent -public final class DpmJobExtendedInfo { +public final class DpmJobExtendedInfo implements JsonSerializable { /* * List of tasks associated with this job. */ - @JsonProperty(value = "tasksList") private List tasksList; /* * The job properties. */ - @JsonProperty(value = "propertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map propertyBag; /* * Non localized error message on job execution. */ - @JsonProperty(value = "dynamicErrorMessage") private String dynamicErrorMessage; /** @@ -110,4 +109,49 @@ public void validate() { tasksList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tasksList", this.tasksList, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("propertyBag", this.propertyBag, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("dynamicErrorMessage", this.dynamicErrorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmJobExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmJobExtendedInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmJobExtendedInfo. + */ + public static DpmJobExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmJobExtendedInfo deserializedDpmJobExtendedInfo = new DpmJobExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tasksList".equals(fieldName)) { + List tasksList + = reader.readArray(reader1 -> DpmJobTaskDetails.fromJson(reader1)); + deserializedDpmJobExtendedInfo.tasksList = tasksList; + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedDpmJobExtendedInfo.propertyBag = propertyBag; + } else if ("dynamicErrorMessage".equals(fieldName)) { + deserializedDpmJobExtendedInfo.dynamicErrorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmJobExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobTaskDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobTaskDetails.java index 8808c2803ddb2..fd04ea8bc8c9b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobTaskDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmJobTaskDetails.java @@ -5,43 +5,44 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * DPM workload-specific job task details. */ @Fluent -public final class DpmJobTaskDetails { +public final class DpmJobTaskDetails implements JsonSerializable { /* * The task display name. */ - @JsonProperty(value = "taskId") private String taskId; /* * The start time. */ - @JsonProperty(value = "startTime") private OffsetDateTime startTime; /* * The end time. */ - @JsonProperty(value = "endTime") private OffsetDateTime endTime; /* * Time elapsed for task. */ - @JsonProperty(value = "duration") private Duration duration; /* * The status. */ - @JsonProperty(value = "status") private String status; /** @@ -157,4 +158,57 @@ public DpmJobTaskDetails withStatus(String status) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("taskId", this.taskId); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmJobTaskDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmJobTaskDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmJobTaskDetails. + */ + public static DpmJobTaskDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmJobTaskDetails deserializedDpmJobTaskDetails = new DpmJobTaskDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taskId".equals(fieldName)) { + deserializedDpmJobTaskDetails.taskId = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedDpmJobTaskDetails.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedDpmJobTaskDetails.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("duration".equals(fieldName)) { + deserializedDpmJobTaskDetails.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("status".equals(fieldName)) { + deserializedDpmJobTaskDetails.status = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmJobTaskDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItem.java index 7a9387177d033..6c8e80af4dd70 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItem.java @@ -5,55 +5,60 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Additional information on Backup engine specific backup item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = DpmProtectedItem.class, - visible = true) -@JsonTypeName("DPMProtectedItem") @Fluent public final class DpmProtectedItem extends ProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "DPMProtectedItem"; /* * Friendly name of the managed item */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Backup Management server protecting this backup item */ - @JsonProperty(value = "backupEngineName") private String backupEngineName; /* * Protection state of the backup engine */ - @JsonProperty(value = "protectionState") private ProtectedItemState protectionState; /* * Extended info of the backup item. */ - @JsonProperty(value = "extendedInfo") private DpmProtectedItemExtendedInfo extendedInfo; + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of DpmProtectedItem class. */ @@ -150,6 +155,36 @@ public DpmProtectedItem withExtendedInfo(DpmProtectedItemExtendedInfo extendedIn return this; } + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -292,9 +327,120 @@ public DpmProtectedItem withSoftDeleteRetentionPeriod(Integer softDeleteRetentio */ @Override public void validate() { - super.validate(); if (extendedInfo() != null) { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("backupEngineName", this.backupEngineName); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmProtectedItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmProtectedItem. + */ + public static DpmProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmProtectedItem deserializedDpmProtectedItem = new DpmProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedDpmProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedDpmProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedDpmProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedDpmProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedDpmProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedDpmProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedDpmProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedDpmProtectedItem.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedDpmProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedDpmProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedDpmProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedDpmProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedDpmProtectedItem.withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedDpmProtectedItem.withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedDpmProtectedItem.withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedDpmProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedDpmProtectedItem.withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedDpmProtectedItem.vaultId = reader.getString(); + } else if ("protectedItemType".equals(fieldName)) { + deserializedDpmProtectedItem.protectedItemType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedDpmProtectedItem.friendlyName = reader.getString(); + } else if ("backupEngineName".equals(fieldName)) { + deserializedDpmProtectedItem.backupEngineName = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedDpmProtectedItem.protectionState = ProtectedItemState.fromString(reader.getString()); + } else if ("extendedInfo".equals(fieldName)) { + deserializedDpmProtectedItem.extendedInfo = DpmProtectedItemExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmProtectedItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItemExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItemExtendedInfo.java index 731e875fefa16..3dc14dae9f37e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItemExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/DpmProtectedItemExtendedInfo.java @@ -5,99 +5,89 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Map; /** * Additional information of DPM Protected item. */ @Fluent -public final class DpmProtectedItemExtendedInfo { +public final class DpmProtectedItemExtendedInfo implements JsonSerializable { /* * Attribute to provide information on various DBs. */ - @JsonProperty(value = "protectableObjectLoadPath") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map protectableObjectLoadPath; /* * To check if backup item is disk protected. */ - @JsonProperty(value = "protected") private Boolean protectedProperty; /* * To check if backup item is cloud protected. */ - @JsonProperty(value = "isPresentOnCloud") private Boolean isPresentOnCloud; /* * Last backup status information on backup item. */ - @JsonProperty(value = "lastBackupStatus") private String lastBackupStatus; /* * Last refresh time on backup item. */ - @JsonProperty(value = "lastRefreshedAt") private OffsetDateTime lastRefreshedAt; /* * Oldest cloud recovery point time. */ - @JsonProperty(value = "oldestRecoveryPoint") private OffsetDateTime oldestRecoveryPoint; /* * cloud recovery point count. */ - @JsonProperty(value = "recoveryPointCount") private Integer recoveryPointCount; /* * Oldest disk recovery point time. */ - @JsonProperty(value = "onPremiseOldestRecoveryPoint") private OffsetDateTime onPremiseOldestRecoveryPoint; /* * latest disk recovery point time. */ - @JsonProperty(value = "onPremiseLatestRecoveryPoint") private OffsetDateTime onPremiseLatestRecoveryPoint; /* * disk recovery point count. */ - @JsonProperty(value = "onPremiseRecoveryPointCount") private Integer onPremiseRecoveryPointCount; /* * To check if backup item is collocated. */ - @JsonProperty(value = "isCollocated") private Boolean isCollocated; /* * Protection group name of the backup item. */ - @JsonProperty(value = "protectionGroupName") private String protectionGroupName; /* * Used Disk storage in bytes. */ - @JsonProperty(value = "diskStorageUsedInBytes") private String diskStorageUsedInBytes; /* * total Disk storage in bytes. */ - @JsonProperty(value = "totalDiskStorageSizeInBytes") private String totalDiskStorageSizeInBytes; /** @@ -393,4 +383,99 @@ public DpmProtectedItemExtendedInfo withTotalDiskStorageSizeInBytes(String total */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("protectableObjectLoadPath", this.protectableObjectLoadPath, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("protected", this.protectedProperty); + jsonWriter.writeBooleanField("isPresentOnCloud", this.isPresentOnCloud); + jsonWriter.writeStringField("lastBackupStatus", this.lastBackupStatus); + jsonWriter.writeStringField("lastRefreshedAt", + this.lastRefreshedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastRefreshedAt)); + jsonWriter.writeStringField("oldestRecoveryPoint", + this.oldestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPoint)); + jsonWriter.writeNumberField("recoveryPointCount", this.recoveryPointCount); + jsonWriter.writeStringField("onPremiseOldestRecoveryPoint", + this.onPremiseOldestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.onPremiseOldestRecoveryPoint)); + jsonWriter.writeStringField("onPremiseLatestRecoveryPoint", + this.onPremiseLatestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.onPremiseLatestRecoveryPoint)); + jsonWriter.writeNumberField("onPremiseRecoveryPointCount", this.onPremiseRecoveryPointCount); + jsonWriter.writeBooleanField("isCollocated", this.isCollocated); + jsonWriter.writeStringField("protectionGroupName", this.protectionGroupName); + jsonWriter.writeStringField("diskStorageUsedInBytes", this.diskStorageUsedInBytes); + jsonWriter.writeStringField("totalDiskStorageSizeInBytes", this.totalDiskStorageSizeInBytes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DpmProtectedItemExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DpmProtectedItemExtendedInfo if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DpmProtectedItemExtendedInfo. + */ + public static DpmProtectedItemExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DpmProtectedItemExtendedInfo deserializedDpmProtectedItemExtendedInfo = new DpmProtectedItemExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectableObjectLoadPath".equals(fieldName)) { + Map protectableObjectLoadPath = reader.readMap(reader1 -> reader1.getString()); + deserializedDpmProtectedItemExtendedInfo.protectableObjectLoadPath = protectableObjectLoadPath; + } else if ("protected".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.protectedProperty + = reader.getNullable(JsonReader::getBoolean); + } else if ("isPresentOnCloud".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.isPresentOnCloud + = reader.getNullable(JsonReader::getBoolean); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.lastBackupStatus = reader.getString(); + } else if ("lastRefreshedAt".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.lastRefreshedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("oldestRecoveryPoint".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.oldestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointCount".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.recoveryPointCount + = reader.getNullable(JsonReader::getInt); + } else if ("onPremiseOldestRecoveryPoint".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.onPremiseOldestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("onPremiseLatestRecoveryPoint".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.onPremiseLatestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("onPremiseRecoveryPointCount".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.onPremiseRecoveryPointCount + = reader.getNullable(JsonReader::getInt); + } else if ("isCollocated".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.isCollocated = reader.getNullable(JsonReader::getBoolean); + } else if ("protectionGroupName".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.protectionGroupName = reader.getString(); + } else if ("diskStorageUsedInBytes".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.diskStorageUsedInBytes = reader.getString(); + } else if ("totalDiskStorageSizeInBytes".equals(fieldName)) { + deserializedDpmProtectedItemExtendedInfo.totalDiskStorageSizeInBytes = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDpmProtectedItemExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionAtRestType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionAtRestType.java index ee839687fefc5..3e0ca802bb601 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionAtRestType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionAtRestType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public EncryptionAtRestType() { * @param name a name to look for. * @return the corresponding EncryptionAtRestType. */ - @JsonCreator public static EncryptionAtRestType fromString(String name) { return fromString(name, EncryptionAtRestType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionDetails.java index 3c68555404d99..4ad1eb666b39d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EncryptionDetails.java @@ -5,41 +5,40 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Details needed if the VM was encrypted at the time of backup. */ @Fluent -public final class EncryptionDetails { +public final class EncryptionDetails implements JsonSerializable { /* * Identifies whether this backup copy represents an encrypted VM at the time of backup. */ - @JsonProperty(value = "encryptionEnabled") private Boolean encryptionEnabled; /* * Key Url. */ - @JsonProperty(value = "kekUrl") private String kekUrl; /* * Secret Url. */ - @JsonProperty(value = "secretKeyUrl") private String secretKeyUrl; /* * ID of Key Vault where KEK is stored. */ - @JsonProperty(value = "kekVaultId") private String kekVaultId; /* * ID of Key Vault where Secret is stored. */ - @JsonProperty(value = "secretKeyVaultId") private String secretKeyVaultId; /** @@ -157,4 +156,52 @@ public EncryptionDetails withSecretKeyVaultId(String secretKeyVaultId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("encryptionEnabled", this.encryptionEnabled); + jsonWriter.writeStringField("kekUrl", this.kekUrl); + jsonWriter.writeStringField("secretKeyUrl", this.secretKeyUrl); + jsonWriter.writeStringField("kekVaultId", this.kekVaultId); + jsonWriter.writeStringField("secretKeyVaultId", this.secretKeyVaultId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EncryptionDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EncryptionDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EncryptionDetails. + */ + public static EncryptionDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EncryptionDetails deserializedEncryptionDetails = new EncryptionDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("encryptionEnabled".equals(fieldName)) { + deserializedEncryptionDetails.encryptionEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("kekUrl".equals(fieldName)) { + deserializedEncryptionDetails.kekUrl = reader.getString(); + } else if ("secretKeyUrl".equals(fieldName)) { + deserializedEncryptionDetails.secretKeyUrl = reader.getString(); + } else if ("kekVaultId".equals(fieldName)) { + deserializedEncryptionDetails.kekVaultId = reader.getString(); + } else if ("secretKeyVaultId".equals(fieldName)) { + deserializedEncryptionDetails.secretKeyVaultId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEncryptionDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EnhancedSecurityState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EnhancedSecurityState.java index d4b84ef8453f6..0fc9cc16f2fa6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EnhancedSecurityState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/EnhancedSecurityState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public EnhancedSecurityState() { * @param name a name to look for. * @return the corresponding EnhancedSecurityState. */ - @JsonCreator public static EnhancedSecurityState fromString(String name) { return fromString(name, EnhancedSecurityState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ErrorDetail.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ErrorDetail.java index ba51441227022..1048cb899fe84 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ErrorDetail.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ErrorDetail.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Error Detail class which encapsulates Code, Message and Recommendations. */ @Immutable -public final class ErrorDetail { +public final class ErrorDetail implements JsonSerializable { /* * Error code. */ - @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) private String code; /* * Error Message related to the Code. */ - @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) private String message; /* * List of recommendation strings. */ - @JsonProperty(value = "recommendations", access = JsonProperty.Access.WRITE_ONLY) private List recommendations; /** @@ -71,4 +72,44 @@ public List recommendations() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ErrorDetail from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ErrorDetail if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ErrorDetail. + */ + public static ErrorDetail fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ErrorDetail deserializedErrorDetail = new ErrorDetail(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedErrorDetail.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedErrorDetail.message = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedErrorDetail.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedErrorDetail; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExportJobsOperationResultInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExportJobsOperationResultInfo.java index 0f7517aab8421..e869f9b2a844f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExportJobsOperationResultInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExportJobsOperationResultInfo.java @@ -5,51 +5,40 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * This class is used to send blob details after exporting jobs. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = ExportJobsOperationResultInfo.class, - visible = true) -@JsonTypeName("ExportJobsOperationResultInfo") @Fluent public final class ExportJobsOperationResultInfo extends OperationResultInfoBase { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "ExportJobsOperationResultInfo"; /* * URL of the blob into which the serialized string of list of jobs is exported. */ - @JsonProperty(value = "blobUrl") private String blobUrl; /* * SAS key to access the blob. It expires in 15 mins. */ - @JsonProperty(value = "blobSasKey") private String blobSasKey; /* * URL of the blob into which the ExcelFile is uploaded. */ - @JsonProperty(value = "excelFileBlobUrl") private String excelFileBlobUrl; /* * SAS key to access the blob. It expires in 15 mins. */ - @JsonProperty(value = "excelFileBlobSasKey") private String excelFileBlobSasKey; /** @@ -156,6 +145,54 @@ public ExportJobsOperationResultInfo withExcelFileBlobSasKey(String excelFileBlo */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("blobUrl", this.blobUrl); + jsonWriter.writeStringField("blobSasKey", this.blobSasKey); + jsonWriter.writeStringField("excelFileBlobUrl", this.excelFileBlobUrl); + jsonWriter.writeStringField("excelFileBlobSasKey", this.excelFileBlobSasKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExportJobsOperationResultInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExportJobsOperationResultInfo if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExportJobsOperationResultInfo. + */ + public static ExportJobsOperationResultInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExportJobsOperationResultInfo deserializedExportJobsOperationResultInfo + = new ExportJobsOperationResultInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedExportJobsOperationResultInfo.objectType = reader.getString(); + } else if ("blobUrl".equals(fieldName)) { + deserializedExportJobsOperationResultInfo.blobUrl = reader.getString(); + } else if ("blobSasKey".equals(fieldName)) { + deserializedExportJobsOperationResultInfo.blobSasKey = reader.getString(); + } else if ("excelFileBlobUrl".equals(fieldName)) { + deserializedExportJobsOperationResultInfo.excelFileBlobUrl = reader.getString(); + } else if ("excelFileBlobSasKey".equals(fieldName)) { + deserializedExportJobsOperationResultInfo.excelFileBlobSasKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExportJobsOperationResultInfo; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedLocation.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedLocation.java index e638934fd2fa0..64c8de01d8e59 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedLocation.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedLocation.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The extended location of Recovery point where VM was present. */ @Fluent -public final class ExtendedLocation { +public final class ExtendedLocation implements JsonSerializable { /* * Name of the extended location. */ - @JsonProperty(value = "name") private String name; /* * Type of the extended location. Possible values include: 'EdgeZone' */ - @JsonProperty(value = "type") private String type; /** @@ -77,4 +79,43 @@ public ExtendedLocation withType(String type) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendedLocation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendedLocation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtendedLocation. + */ + public static ExtendedLocation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtendedLocation deserializedExtendedLocation = new ExtendedLocation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedExtendedLocation.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExtendedLocation.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExtendedLocation; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedProperties.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedProperties.java index fc482e2f23085..0a8c1f81640a3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedProperties.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ExtendedProperties.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Extended Properties for Azure IaasVM Backup. */ @Fluent -public final class ExtendedProperties { +public final class ExtendedProperties implements JsonSerializable { /* * Extended Properties for Disk Exclusion. */ - @JsonProperty(value = "diskExclusionProperties") private DiskExclusionProperties diskExclusionProperties; /* * Linux VM name */ - @JsonProperty(value = "linuxVmApplicationName") private String linuxVmApplicationName; /** @@ -80,4 +82,43 @@ public void validate() { diskExclusionProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("diskExclusionProperties", this.diskExclusionProperties); + jsonWriter.writeStringField("linuxVmApplicationName", this.linuxVmApplicationName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendedProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendedProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtendedProperties. + */ + public static ExtendedProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtendedProperties deserializedExtendedProperties = new ExtendedProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("diskExclusionProperties".equals(fieldName)) { + deserializedExtendedProperties.diskExclusionProperties = DiskExclusionProperties.fromJson(reader); + } else if ("linuxVmApplicationName".equals(fieldName)) { + deserializedExtendedProperties.linuxVmApplicationName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExtendedProperties; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FabricName.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FabricName.java index 8a74cd279d425..ece5642c4e854 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FabricName.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FabricName.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public FabricName() { * @param name a name to look for. * @return the corresponding FabricName. */ - @JsonCreator public static FabricName fromString(String name) { return fromString(name, FabricName.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FeatureSupportRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FeatureSupportRequest.java index c02aaedf90a5c..0f084851f392a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FeatureSupportRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FeatureSupportRequest.java @@ -5,38 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for feature request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "featureType", - defaultImpl = FeatureSupportRequest.class, - visible = true) -@JsonTypeName("FeatureSupportRequest") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureBackupGoals", value = AzureBackupGoalFeatureSupportRequest.class), - @JsonSubTypes.Type(name = "AzureVMResourceBackup", value = AzureVMResourceFeatureSupportRequest.class) }) @Immutable -public class FeatureSupportRequest { +public class FeatureSupportRequest implements JsonSerializable { /* * backup support feature type. */ - @JsonTypeId - @JsonProperty(value = "featureType", required = true) - private String featureType; + private String featureType = "FeatureSupportRequest"; /** * Creates an instance of FeatureSupportRequest class. */ public FeatureSupportRequest() { - this.featureType = "FeatureSupportRequest"; } /** @@ -55,4 +43,67 @@ public String featureType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("featureType", this.featureType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FeatureSupportRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FeatureSupportRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FeatureSupportRequest. + */ + public static FeatureSupportRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("featureType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureBackupGoals".equals(discriminatorValue)) { + return AzureBackupGoalFeatureSupportRequest.fromJson(readerToUse.reset()); + } else if ("AzureVMResourceBackup".equals(discriminatorValue)) { + return AzureVMResourceFeatureSupportRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static FeatureSupportRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FeatureSupportRequest deserializedFeatureSupportRequest = new FeatureSupportRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("featureType".equals(fieldName)) { + deserializedFeatureSupportRequest.featureType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFeatureSupportRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoForRehydrationRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoForRehydrationRequest.java index 690892b5dc701..2871e986b387b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoForRehydrationRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoForRehydrationRequest.java @@ -6,51 +6,40 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Request parameters for fetching cost info of rehydration. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = FetchTieringCostInfoForRehydrationRequest.class, - visible = true) -@JsonTypeName("FetchTieringCostInfoForRehydrationRequest") @Fluent public final class FetchTieringCostInfoForRehydrationRequest extends FetchTieringCostInfoRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "FetchTieringCostInfoForRehydrationRequest"; /* * Name of the protected item container */ - @JsonProperty(value = "containerName", required = true) private String containerName; /* * Name of the protectedItemName */ - @JsonProperty(value = "protectedItemName", required = true) private String protectedItemName; /* * ID of the backup copy for rehydration cost info needs to be fetched. */ - @JsonProperty(value = "recoveryPointId", required = true) private String recoveryPointId; /* * Rehydration Priority */ - @JsonProperty(value = "rehydrationPriority", required = true) private RehydrationPriority rehydrationPriority; /** @@ -175,7 +164,6 @@ public FetchTieringCostInfoForRehydrationRequest withTargetTierType(RecoveryPoin */ @Override public void validate() { - super.validate(); if (containerName() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -196,7 +184,77 @@ public void validate() { .log(new IllegalArgumentException( "Missing required property rehydrationPriority in model FetchTieringCostInfoForRehydrationRequest")); } + if (sourceTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceTierType in model FetchTieringCostInfoForRehydrationRequest")); + } + if (targetTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetTierType in model FetchTieringCostInfoForRehydrationRequest")); + } } private static final ClientLogger LOGGER = new ClientLogger(FetchTieringCostInfoForRehydrationRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceTierType", sourceTierType() == null ? null : sourceTierType().toString()); + jsonWriter.writeStringField("targetTierType", targetTierType() == null ? null : targetTierType().toString()); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("protectedItemName", this.protectedItemName); + jsonWriter.writeStringField("recoveryPointId", this.recoveryPointId); + jsonWriter.writeStringField("rehydrationPriority", + this.rehydrationPriority == null ? null : this.rehydrationPriority.toString()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FetchTieringCostInfoForRehydrationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FetchTieringCostInfoForRehydrationRequest if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FetchTieringCostInfoForRehydrationRequest. + */ + public static FetchTieringCostInfoForRehydrationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FetchTieringCostInfoForRehydrationRequest deserializedFetchTieringCostInfoForRehydrationRequest + = new FetchTieringCostInfoForRehydrationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceTierType".equals(fieldName)) { + deserializedFetchTieringCostInfoForRehydrationRequest + .withSourceTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("targetTierType".equals(fieldName)) { + deserializedFetchTieringCostInfoForRehydrationRequest + .withTargetTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("containerName".equals(fieldName)) { + deserializedFetchTieringCostInfoForRehydrationRequest.containerName = reader.getString(); + } else if ("protectedItemName".equals(fieldName)) { + deserializedFetchTieringCostInfoForRehydrationRequest.protectedItemName = reader.getString(); + } else if ("recoveryPointId".equals(fieldName)) { + deserializedFetchTieringCostInfoForRehydrationRequest.recoveryPointId = reader.getString(); + } else if ("rehydrationPriority".equals(fieldName)) { + deserializedFetchTieringCostInfoForRehydrationRequest.rehydrationPriority + = RehydrationPriority.fromString(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedFetchTieringCostInfoForRehydrationRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFetchTieringCostInfoForRehydrationRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoRequest.java index 8197c060318c9..b7bb5b37bd403 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostInfoRequest.java @@ -6,61 +6,38 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for tiering cost request. * Specific cost request types are derived from this class. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = FetchTieringCostInfoRequest.class, - visible = true) -@JsonTypeName("FetchTieringCostInfoRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "FetchTieringCostInfoForRehydrationRequest", - value = FetchTieringCostInfoForRehydrationRequest.class), - @JsonSubTypes.Type( - name = "FetchTieringCostSavingsInfoForPolicyRequest", - value = FetchTieringCostSavingsInfoForPolicyRequest.class), - @JsonSubTypes.Type( - name = "FetchTieringCostSavingsInfoForProtectedItemRequest", - value = FetchTieringCostSavingsInfoForProtectedItemRequest.class), - @JsonSubTypes.Type( - name = "FetchTieringCostSavingsInfoForVaultRequest", - value = FetchTieringCostSavingsInfoForVaultRequest.class) }) @Fluent -public class FetchTieringCostInfoRequest { +public class FetchTieringCostInfoRequest implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "FetchTieringCostInfoRequest"; /* * Source tier for the request */ - @JsonProperty(value = "sourceTierType", required = true) private RecoveryPointTierType sourceTierType; /* * target tier for the request */ - @JsonProperty(value = "targetTierType", required = true) private RecoveryPointTierType targetTierType; /** * Creates an instance of FetchTieringCostInfoRequest class. */ public FetchTieringCostInfoRequest() { - this.objectType = "FetchTieringCostInfoRequest"; } /** @@ -132,4 +109,82 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(FetchTieringCostInfoRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceTierType", + this.sourceTierType == null ? null : this.sourceTierType.toString()); + jsonWriter.writeStringField("targetTierType", + this.targetTierType == null ? null : this.targetTierType.toString()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FetchTieringCostInfoRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FetchTieringCostInfoRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FetchTieringCostInfoRequest. + */ + public static FetchTieringCostInfoRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("FetchTieringCostInfoForRehydrationRequest".equals(discriminatorValue)) { + return FetchTieringCostInfoForRehydrationRequest.fromJson(readerToUse.reset()); + } else if ("FetchTieringCostSavingsInfoForPolicyRequest".equals(discriminatorValue)) { + return FetchTieringCostSavingsInfoForPolicyRequest.fromJson(readerToUse.reset()); + } else if ("FetchTieringCostSavingsInfoForProtectedItemRequest".equals(discriminatorValue)) { + return FetchTieringCostSavingsInfoForProtectedItemRequest.fromJson(readerToUse.reset()); + } else if ("FetchTieringCostSavingsInfoForVaultRequest".equals(discriminatorValue)) { + return FetchTieringCostSavingsInfoForVaultRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static FetchTieringCostInfoRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FetchTieringCostInfoRequest deserializedFetchTieringCostInfoRequest = new FetchTieringCostInfoRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceTierType".equals(fieldName)) { + deserializedFetchTieringCostInfoRequest.sourceTierType + = RecoveryPointTierType.fromString(reader.getString()); + } else if ("targetTierType".equals(fieldName)) { + deserializedFetchTieringCostInfoRequest.targetTierType + = RecoveryPointTierType.fromString(reader.getString()); + } else if ("objectType".equals(fieldName)) { + deserializedFetchTieringCostInfoRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFetchTieringCostInfoRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForPolicyRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForPolicyRequest.java index 9d13761ddf50c..b09be6a6f7810 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForPolicyRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForPolicyRequest.java @@ -6,33 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Request parameters for tiering cost info for policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = FetchTieringCostSavingsInfoForPolicyRequest.class, - visible = true) -@JsonTypeName("FetchTieringCostSavingsInfoForPolicyRequest") @Fluent public final class FetchTieringCostSavingsInfoForPolicyRequest extends FetchTieringCostInfoRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "FetchTieringCostSavingsInfoForPolicyRequest"; /* * Name of the backup policy for which the cost savings information is requested */ - @JsonProperty(value = "policyName", required = true) private String policyName; /** @@ -97,13 +89,71 @@ public FetchTieringCostSavingsInfoForPolicyRequest withTargetTierType(RecoveryPo */ @Override public void validate() { - super.validate(); if (policyName() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( "Missing required property policyName in model FetchTieringCostSavingsInfoForPolicyRequest")); } + if (sourceTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceTierType in model FetchTieringCostSavingsInfoForPolicyRequest")); + } + if (targetTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetTierType in model FetchTieringCostSavingsInfoForPolicyRequest")); + } } private static final ClientLogger LOGGER = new ClientLogger(FetchTieringCostSavingsInfoForPolicyRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceTierType", sourceTierType() == null ? null : sourceTierType().toString()); + jsonWriter.writeStringField("targetTierType", targetTierType() == null ? null : targetTierType().toString()); + jsonWriter.writeStringField("policyName", this.policyName); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FetchTieringCostSavingsInfoForPolicyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FetchTieringCostSavingsInfoForPolicyRequest if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FetchTieringCostSavingsInfoForPolicyRequest. + */ + public static FetchTieringCostSavingsInfoForPolicyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FetchTieringCostSavingsInfoForPolicyRequest deserializedFetchTieringCostSavingsInfoForPolicyRequest + = new FetchTieringCostSavingsInfoForPolicyRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceTierType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForPolicyRequest + .withSourceTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("targetTierType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForPolicyRequest + .withTargetTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("policyName".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForPolicyRequest.policyName = reader.getString(); + } else if ("objectType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForPolicyRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFetchTieringCostSavingsInfoForPolicyRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForProtectedItemRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForProtectedItemRequest.java index ad53dbcbbe46f..ca5f1078554c1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForProtectedItemRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForProtectedItemRequest.java @@ -6,39 +6,30 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Request parameters for tiering cost info for protected item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = FetchTieringCostSavingsInfoForProtectedItemRequest.class, - visible = true) -@JsonTypeName("FetchTieringCostSavingsInfoForProtectedItemRequest") @Fluent public final class FetchTieringCostSavingsInfoForProtectedItemRequest extends FetchTieringCostInfoRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "FetchTieringCostSavingsInfoForProtectedItemRequest"; /* * Name of the protected item container */ - @JsonProperty(value = "containerName", required = true) private String containerName; /* * Name of the protectedItemName */ - @JsonProperty(value = "protectedItemName", required = true) private String protectedItemName; /** @@ -123,7 +114,6 @@ public FetchTieringCostSavingsInfoForProtectedItemRequest withTargetTierType(Rec */ @Override public void validate() { - super.validate(); if (containerName() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -134,8 +124,72 @@ public void validate() { .log(new IllegalArgumentException( "Missing required property protectedItemName in model FetchTieringCostSavingsInfoForProtectedItemRequest")); } + if (sourceTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceTierType in model FetchTieringCostSavingsInfoForProtectedItemRequest")); + } + if (targetTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetTierType in model FetchTieringCostSavingsInfoForProtectedItemRequest")); + } } private static final ClientLogger LOGGER = new ClientLogger(FetchTieringCostSavingsInfoForProtectedItemRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceTierType", sourceTierType() == null ? null : sourceTierType().toString()); + jsonWriter.writeStringField("targetTierType", targetTierType() == null ? null : targetTierType().toString()); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("protectedItemName", this.protectedItemName); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FetchTieringCostSavingsInfoForProtectedItemRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FetchTieringCostSavingsInfoForProtectedItemRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FetchTieringCostSavingsInfoForProtectedItemRequest. + */ + public static FetchTieringCostSavingsInfoForProtectedItemRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + FetchTieringCostSavingsInfoForProtectedItemRequest deserializedFetchTieringCostSavingsInfoForProtectedItemRequest + = new FetchTieringCostSavingsInfoForProtectedItemRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceTierType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForProtectedItemRequest + .withSourceTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("targetTierType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForProtectedItemRequest + .withTargetTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("containerName".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForProtectedItemRequest.containerName = reader.getString(); + } else if ("protectedItemName".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForProtectedItemRequest.protectedItemName + = reader.getString(); + } else if ("objectType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForProtectedItemRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFetchTieringCostSavingsInfoForProtectedItemRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForVaultRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForVaultRequest.java index 4a609559e9477..54a7125a7a440 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForVaultRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/FetchTieringCostSavingsInfoForVaultRequest.java @@ -5,27 +5,21 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Request parameters for tiering cost info for vault. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = FetchTieringCostSavingsInfoForVaultRequest.class, - visible = true) -@JsonTypeName("FetchTieringCostSavingsInfoForVaultRequest") @Fluent public final class FetchTieringCostSavingsInfoForVaultRequest extends FetchTieringCostInfoRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "FetchTieringCostSavingsInfoForVaultRequest"; /** @@ -70,6 +64,63 @@ public FetchTieringCostSavingsInfoForVaultRequest withTargetTierType(RecoveryPoi */ @Override public void validate() { - super.validate(); + if (sourceTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceTierType in model FetchTieringCostSavingsInfoForVaultRequest")); + } + if (targetTierType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetTierType in model FetchTieringCostSavingsInfoForVaultRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FetchTieringCostSavingsInfoForVaultRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceTierType", sourceTierType() == null ? null : sourceTierType().toString()); + jsonWriter.writeStringField("targetTierType", targetTierType() == null ? null : targetTierType().toString()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FetchTieringCostSavingsInfoForVaultRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FetchTieringCostSavingsInfoForVaultRequest if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FetchTieringCostSavingsInfoForVaultRequest. + */ + public static FetchTieringCostSavingsInfoForVaultRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FetchTieringCostSavingsInfoForVaultRequest deserializedFetchTieringCostSavingsInfoForVaultRequest + = new FetchTieringCostSavingsInfoForVaultRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceTierType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForVaultRequest + .withSourceTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("targetTierType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForVaultRequest + .withTargetTierType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("objectType".equals(fieldName)) { + deserializedFetchTieringCostSavingsInfoForVaultRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFetchTieringCostSavingsInfoForVaultRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainer.java index 60ebeaa7dc50a..b7ec52296c6db 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainer.java @@ -5,42 +5,33 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for generic container of backup items. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = GenericContainer.class, - visible = true) -@JsonTypeName("GenericContainer") @Fluent public final class GenericContainer extends ProtectionContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.GENERIC_CONTAINER; /* * Name of the container's fabric */ - @JsonProperty(value = "fabricName") private String fabricName; /* * Extended information (not returned in List container API calls) */ - @JsonProperty(value = "extendedInformation") private GenericContainerExtendedInfo extendedInformation; /** @@ -155,9 +146,68 @@ public GenericContainer withProtectableObjectType(String protectableObjectType) */ @Override public void validate() { - super.validate(); if (extendedInformation() != null) { extendedInformation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + jsonWriter.writeStringField("fabricName", this.fabricName); + jsonWriter.writeJsonField("extendedInformation", this.extendedInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenericContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenericContainer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GenericContainer. + */ + public static GenericContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenericContainer deserializedGenericContainer = new GenericContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedGenericContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedGenericContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedGenericContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedGenericContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedGenericContainer.withProtectableObjectType(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedGenericContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else if ("fabricName".equals(fieldName)) { + deserializedGenericContainer.fabricName = reader.getString(); + } else if ("extendedInformation".equals(fieldName)) { + deserializedGenericContainer.extendedInformation = GenericContainerExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGenericContainer; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainerExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainerExtendedInfo.java index 03f3a70c96ead..6e54533419bc6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainerExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericContainerExtendedInfo.java @@ -5,32 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** * Container extended information. */ @Fluent -public final class GenericContainerExtendedInfo { +public final class GenericContainerExtendedInfo implements JsonSerializable { /* * Public key of container cert */ - @JsonProperty(value = "rawCertData") private String rawCertData; /* * Container identity information */ - @JsonProperty(value = "containerIdentityInfo") private ContainerIdentityInfo containerIdentityInfo; /* * Azure Backup Service Endpoints for the container */ - @JsonProperty(value = "serviceEndpoints") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map serviceEndpoints; /** @@ -109,4 +108,49 @@ public void validate() { containerIdentityInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("rawCertData", this.rawCertData); + jsonWriter.writeJsonField("containerIdentityInfo", this.containerIdentityInfo); + jsonWriter.writeMapField("serviceEndpoints", this.serviceEndpoints, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenericContainerExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenericContainerExtendedInfo if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GenericContainerExtendedInfo. + */ + public static GenericContainerExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenericContainerExtendedInfo deserializedGenericContainerExtendedInfo = new GenericContainerExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rawCertData".equals(fieldName)) { + deserializedGenericContainerExtendedInfo.rawCertData = reader.getString(); + } else if ("containerIdentityInfo".equals(fieldName)) { + deserializedGenericContainerExtendedInfo.containerIdentityInfo + = ContainerIdentityInfo.fromJson(reader); + } else if ("serviceEndpoints".equals(fieldName)) { + Map serviceEndpoints = reader.readMap(reader1 -> reader1.getString()); + deserializedGenericContainerExtendedInfo.serviceEndpoints = serviceEndpoints; + } else { + reader.skipChildren(); + } + } + + return deserializedGenericContainerExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectedItem.java index f91edbd0e9246..08aa4f5c2d0c0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectedItem.java @@ -5,70 +5,71 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * Base class for backup items. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = GenericProtectedItem.class, - visible = true) -@JsonTypeName("GenericProtectedItem") @Fluent public final class GenericProtectedItem extends ProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "GenericProtectedItem"; /* * Friendly name of the container. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Indicates consistency of policy object and policy applied to this backup item. */ - @JsonProperty(value = "policyState") private String policyState; /* * Backup state of this backup item. */ - @JsonProperty(value = "protectionState") private ProtectionState protectionState; /* * Data Plane Service ID of the protected item. */ - @JsonProperty(value = "protectedItemId") private Long protectedItemId; /* * Loosely coupled (type, value) associations (example - parent of a protected item) */ - @JsonProperty(value = "sourceAssociations") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map sourceAssociations; /* * Name of this backup item's fabric. */ - @JsonProperty(value = "fabricName") private String fabricName; + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of GenericProtectedItem class. */ @@ -207,6 +208,36 @@ public GenericProtectedItem withFabricName(String fabricName) { return this; } + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -349,6 +380,126 @@ public GenericProtectedItem withSoftDeleteRetentionPeriod(Integer softDeleteRete */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("policyState", this.policyState); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + jsonWriter.writeNumberField("protectedItemId", this.protectedItemId); + jsonWriter.writeMapField("sourceAssociations", this.sourceAssociations, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("fabricName", this.fabricName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenericProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenericProtectedItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the GenericProtectedItem. + */ + public static GenericProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenericProtectedItem deserializedGenericProtectedItem = new GenericProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedGenericProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedGenericProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedGenericProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedGenericProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedGenericProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedGenericProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedGenericProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedGenericProtectedItem.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedGenericProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedGenericProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedGenericProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedGenericProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedGenericProtectedItem.withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedGenericProtectedItem.withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedGenericProtectedItem.withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedGenericProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedGenericProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedGenericProtectedItem.vaultId = reader.getString(); + } else if ("protectedItemType".equals(fieldName)) { + deserializedGenericProtectedItem.protectedItemType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedGenericProtectedItem.friendlyName = reader.getString(); + } else if ("policyState".equals(fieldName)) { + deserializedGenericProtectedItem.policyState = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedGenericProtectedItem.protectionState = ProtectionState.fromString(reader.getString()); + } else if ("protectedItemId".equals(fieldName)) { + deserializedGenericProtectedItem.protectedItemId = reader.getNullable(JsonReader::getLong); + } else if ("sourceAssociations".equals(fieldName)) { + Map sourceAssociations = reader.readMap(reader1 -> reader1.getString()); + deserializedGenericProtectedItem.sourceAssociations = sourceAssociations; + } else if ("fabricName".equals(fieldName)) { + deserializedGenericProtectedItem.fabricName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGenericProtectedItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectionPolicy.java index 06831b2d1b805..c357921631d73 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericProtectionPolicy.java @@ -5,46 +5,36 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Azure VM (Mercury) workload-specific backup policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupManagementType", - defaultImpl = GenericProtectionPolicy.class, - visible = true) -@JsonTypeName("GenericProtectionPolicy") @Fluent public final class GenericProtectionPolicy extends ProtectionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "backupManagementType", required = true) private String backupManagementType = "GenericProtectionPolicy"; /* * List of sub-protection policies which includes schedule and retention */ - @JsonProperty(value = "subProtectionPolicy") private List subProtectionPolicy; /* * TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". */ - @JsonProperty(value = "timeZone") private String timeZone; /* * Name of this policy's fabric. */ - @JsonProperty(value = "fabricName") private String fabricName; /** @@ -149,9 +139,65 @@ public GenericProtectionPolicy withResourceGuardOperationRequests(List r */ @Override public void validate() { - super.validate(); if (subProtectionPolicy() != null) { subProtectionPolicy().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("protectedItemsCount", protectedItemsCount()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeArrayField("subProtectionPolicy", this.subProtectionPolicy, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeStringField("fabricName", this.fabricName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenericProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenericProtectionPolicy if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the GenericProtectionPolicy. + */ + public static GenericProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenericProtectionPolicy deserializedGenericProtectionPolicy = new GenericProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectedItemsCount".equals(fieldName)) { + deserializedGenericProtectionPolicy.withProtectedItemsCount(reader.getNullable(JsonReader::getInt)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedGenericProtectionPolicy + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("backupManagementType".equals(fieldName)) { + deserializedGenericProtectionPolicy.backupManagementType = reader.getString(); + } else if ("subProtectionPolicy".equals(fieldName)) { + List subProtectionPolicy + = reader.readArray(reader1 -> SubProtectionPolicy.fromJson(reader1)); + deserializedGenericProtectionPolicy.subProtectionPolicy = subProtectionPolicy; + } else if ("timeZone".equals(fieldName)) { + deserializedGenericProtectionPolicy.timeZone = reader.getString(); + } else if ("fabricName".equals(fieldName)) { + deserializedGenericProtectionPolicy.fabricName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGenericProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericRecoveryPoint.java index 53091a29dcb20..e0b221d98964f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/GenericRecoveryPoint.java @@ -5,58 +5,48 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Generic backup copy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = GenericRecoveryPoint.class, - visible = true) -@JsonTypeName("GenericRecoveryPoint") @Fluent public final class GenericRecoveryPoint extends RecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "GenericRecoveryPoint"; /* * Friendly name of the backup copy. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Type of the backup copy. */ - @JsonProperty(value = "recoveryPointType") private String recoveryPointType; /* * Time at which this backup copy was created. */ - @JsonProperty(value = "recoveryPointTime") private OffsetDateTime recoveryPointTime; /* * Additional information associated with this backup copy. */ - @JsonProperty(value = "recoveryPointAdditionalInfo") private String recoveryPointAdditionalInfo; /* * Properties of Recovery Point */ - @JsonProperty(value = "recoveryPointProperties") private RecoveryPointProperties recoveryPointProperties; /** @@ -183,9 +173,63 @@ public GenericRecoveryPoint withRecoveryPointProperties(RecoveryPointProperties */ @Override public void validate() { - super.validate(); if (recoveryPointProperties() != null) { recoveryPointProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("recoveryPointType", this.recoveryPointType); + jsonWriter.writeStringField("recoveryPointTime", + this.recoveryPointTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.recoveryPointTime)); + jsonWriter.writeStringField("recoveryPointAdditionalInfo", this.recoveryPointAdditionalInfo); + jsonWriter.writeJsonField("recoveryPointProperties", this.recoveryPointProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenericRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenericRecoveryPoint if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the GenericRecoveryPoint. + */ + public static GenericRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenericRecoveryPoint deserializedGenericRecoveryPoint = new GenericRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedGenericRecoveryPoint.objectType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedGenericRecoveryPoint.friendlyName = reader.getString(); + } else if ("recoveryPointType".equals(fieldName)) { + deserializedGenericRecoveryPoint.recoveryPointType = reader.getString(); + } else if ("recoveryPointTime".equals(fieldName)) { + deserializedGenericRecoveryPoint.recoveryPointTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointAdditionalInfo".equals(fieldName)) { + deserializedGenericRecoveryPoint.recoveryPointAdditionalInfo = reader.getString(); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedGenericRecoveryPoint.recoveryPointProperties = RecoveryPointProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGenericRecoveryPoint; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HealthStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HealthStatus.java index a9cac4fa4c833..167edf764650f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HealthStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HealthStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public HealthStatus() { * @param name a name to look for. * @return the corresponding HealthStatus. */ - @JsonCreator public static HealthStatus fromString(String name) { return fromString(name, HealthStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HourlySchedule.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HourlySchedule.java index c325d1c0e83c0..b343b231a780d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HourlySchedule.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HourlySchedule.java @@ -5,31 +5,34 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * The HourlySchedule model. */ @Fluent -public final class HourlySchedule { +public final class HourlySchedule implements JsonSerializable { /* * Interval at which backup needs to be triggered. For hourly the value - * can be 4/6/8/12 + * can be 4/6/8/12 */ - @JsonProperty(value = "interval") private Integer interval; /* * To specify start time of the backup window */ - @JsonProperty(value = "scheduleWindowStartTime") private OffsetDateTime scheduleWindowStartTime; /* * To specify duration of the backup window */ - @JsonProperty(value = "scheduleWindowDuration") private Integer scheduleWindowDuration; /** @@ -107,4 +110,50 @@ public HourlySchedule withScheduleWindowDuration(Integer scheduleWindowDuration) */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("interval", this.interval); + jsonWriter.writeStringField("scheduleWindowStartTime", + this.scheduleWindowStartTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.scheduleWindowStartTime)); + jsonWriter.writeNumberField("scheduleWindowDuration", this.scheduleWindowDuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HourlySchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HourlySchedule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the HourlySchedule. + */ + public static HourlySchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HourlySchedule deserializedHourlySchedule = new HourlySchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("interval".equals(fieldName)) { + deserializedHourlySchedule.interval = reader.getNullable(JsonReader::getInt); + } else if ("scheduleWindowStartTime".equals(fieldName)) { + deserializedHourlySchedule.scheduleWindowStartTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("scheduleWindowDuration".equals(fieldName)) { + deserializedHourlySchedule.scheduleWindowDuration = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedHourlySchedule; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HttpStatusCode.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HttpStatusCode.java index b5c07ccd4c1af..18aadb46c26f6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HttpStatusCode.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/HttpStatusCode.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * HTTP Status Code of the operation. */ @@ -261,7 +258,6 @@ public enum HttpStatusCode { * @param value the serialized value to parse. * @return the parsed HttpStatusCode object, or null if unable to parse. */ - @JsonCreator public static HttpStatusCode fromString(String value) { if (value == null) { return null; @@ -278,7 +274,6 @@ public static HttpStatusCode fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmContainer.java index 22b08d6498450..5ade93838c558 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmContainer.java @@ -5,54 +5,38 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM workload-specific container. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = IaaSvmContainer.class, - visible = true) -@JsonTypeName("IaasVMContainer") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "Microsoft.ClassicCompute/virtualMachines", - value = AzureIaaSClassicComputeVMContainer.class), - @JsonSubTypes.Type(name = "Microsoft.Compute/virtualMachines", value = AzureIaaSComputeVMContainer.class) }) @Fluent public class IaaSvmContainer extends ProtectionContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.IAAS_VMCONTAINER; /* * Fully qualified ARM url of the virtual machine represented by this Azure IaaS VM container. */ - @JsonProperty(value = "virtualMachineId") private String virtualMachineId; /* * Specifies whether the container represents a Classic or an Azure Resource Manager VM. */ - @JsonProperty(value = "virtualMachineVersion") private String virtualMachineVersion; /* * Resource group name of Recovery Services Vault. */ - @JsonProperty(value = "resourceGroup") private String resourceGroup; /** @@ -191,6 +175,94 @@ public IaaSvmContainer withProtectableObjectType(String protectableObjectType) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + jsonWriter.writeStringField("virtualMachineId", this.virtualMachineId); + jsonWriter.writeStringField("virtualMachineVersion", this.virtualMachineVersion); + jsonWriter.writeStringField("resourceGroup", this.resourceGroup); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IaaSvmContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IaaSvmContainer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IaaSvmContainer. + */ + public static IaaSvmContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("containerType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Microsoft.ClassicCompute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSClassicComputeVMContainer.fromJson(readerToUse.reset()); + } else if ("Microsoft.Compute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSComputeVMContainer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static IaaSvmContainer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IaaSvmContainer deserializedIaaSvmContainer = new IaaSvmContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedIaaSvmContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedIaaSvmContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedIaaSvmContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedIaaSvmContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedIaaSvmContainer.withProtectableObjectType(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedIaaSvmContainer.containerType = ProtectableContainerType.fromString(reader.getString()); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedIaaSvmContainer.virtualMachineId = reader.getString(); + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedIaaSvmContainer.virtualMachineVersion = reader.getString(); + } else if ("resourceGroup".equals(fieldName)) { + deserializedIaaSvmContainer.resourceGroup = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIaaSvmContainer; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmProtectableItem.java index edb7a705719c3..dbad01fc1d8b0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaaSvmProtectableItem.java @@ -5,51 +5,34 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM workload-specific backup item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableItemType", - defaultImpl = IaaSvmProtectableItem.class, - visible = true) -@JsonTypeName("IaaSVMProtectableItem") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "Microsoft.ClassicCompute/virtualMachines", - value = AzureIaaSClassicComputeVMProtectableItem.class), - @JsonSubTypes.Type(name = "Microsoft.Compute/virtualMachines", value = AzureIaaSComputeVMProtectableItem.class) }) @Fluent public class IaaSvmProtectableItem extends WorkloadProtectableItem { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) private String protectableItemType = "IaaSVMProtectableItem"; /* * Fully qualified ARM ID of the virtual machine. */ - @JsonProperty(value = "virtualMachineId") private String virtualMachineId; /* * Specifies whether the container represents a Classic or an Azure Resource Manager VM. */ - @JsonProperty(value = "virtualMachineVersion") private String virtualMachineVersion; /* * Resource group name of Recovery Services Vault. */ - @JsonProperty(value = "resourceGroup") private String resourceGroup; /** @@ -173,6 +156,90 @@ public IaaSvmProtectableItem withProtectionState(ProtectionStatus protectionStat */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", backupManagementType()); + jsonWriter.writeStringField("workloadType", workloadType()); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("protectionState", protectionState() == null ? null : protectionState().toString()); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + jsonWriter.writeStringField("virtualMachineId", this.virtualMachineId); + jsonWriter.writeStringField("virtualMachineVersion", this.virtualMachineVersion); + jsonWriter.writeStringField("resourceGroup", this.resourceGroup); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IaaSvmProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IaaSvmProtectableItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the IaaSvmProtectableItem. + */ + public static IaaSvmProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectableItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Microsoft.ClassicCompute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSClassicComputeVMProtectableItem.fromJson(readerToUse.reset()); + } else if ("Microsoft.Compute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSComputeVMProtectableItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static IaaSvmProtectableItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IaaSvmProtectableItem deserializedIaaSvmProtectableItem = new IaaSvmProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedIaaSvmProtectableItem.withBackupManagementType(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedIaaSvmProtectableItem.withWorkloadType(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedIaaSvmProtectableItem.withFriendlyName(reader.getString()); + } else if ("protectionState".equals(fieldName)) { + deserializedIaaSvmProtectableItem + .withProtectionState(ProtectionStatus.fromString(reader.getString())); + } else if ("protectableItemType".equals(fieldName)) { + deserializedIaaSvmProtectableItem.protectableItemType = reader.getString(); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedIaaSvmProtectableItem.virtualMachineId = reader.getString(); + } else if ("virtualMachineVersion".equals(fieldName)) { + deserializedIaaSvmProtectableItem.virtualMachineVersion = reader.getString(); + } else if ("resourceGroup".equals(fieldName)) { + deserializedIaaSvmProtectableItem.resourceGroup = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIaaSvmProtectableItem; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMBackupRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMBackupRequest.java index 28678b2371b11..61070517d5e2a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMBackupRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMBackupRequest.java @@ -5,34 +5,28 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * IaaS VM workload-specific backup request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = IaasVMBackupRequest.class, - visible = true) -@JsonTypeName("IaasVMBackupRequest") @Fluent public final class IaasVMBackupRequest extends BackupRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "IaasVMBackupRequest"; /* * Backup copy will expire after the time specified (UTC). */ - @JsonProperty(value = "recoveryPointExpiryTimeInUTC") private OffsetDateTime recoveryPointExpiryTimeInUtc; /** @@ -79,6 +73,48 @@ public IaasVMBackupRequest withRecoveryPointExpiryTimeInUtc(OffsetDateTime recov */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointExpiryTimeInUTC", + this.recoveryPointExpiryTimeInUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.recoveryPointExpiryTimeInUtc)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IaasVMBackupRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IaasVMBackupRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IaasVMBackupRequest. + */ + public static IaasVMBackupRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IaasVMBackupRequest deserializedIaasVMBackupRequest = new IaasVMBackupRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedIaasVMBackupRequest.objectType = reader.getString(); + } else if ("recoveryPointExpiryTimeInUTC".equals(fieldName)) { + deserializedIaasVMBackupRequest.recoveryPointExpiryTimeInUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedIaasVMBackupRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRecoveryPoint.java index 949a85211e1c1..89c70583dba80 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRecoveryPoint.java @@ -5,147 +5,121 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; /** * IaaS VM workload specific backup copy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = IaasVMRecoveryPoint.class, - visible = true) -@JsonTypeName("IaasVMRecoveryPoint") @Fluent public final class IaasVMRecoveryPoint extends RecoveryPoint { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "IaasVMRecoveryPoint"; /* * Type of the backup copy. */ - @JsonProperty(value = "recoveryPointType") private String recoveryPointType; /* * Time at which this backup copy was created. */ - @JsonProperty(value = "recoveryPointTime") private OffsetDateTime recoveryPointTime; /* * Additional information associated with this backup copy. */ - @JsonProperty(value = "recoveryPointAdditionalInfo") private String recoveryPointAdditionalInfo; /* * Storage type of the VM whose backup copy is created. */ - @JsonProperty(value = "sourceVMStorageType") private String sourceVMStorageType; /* * Identifies whether the VM was encrypted when the backup copy is created. */ - @JsonProperty(value = "isSourceVMEncrypted") private Boolean isSourceVMEncrypted; /* * Required details for recovering an encrypted VM. Applicable only when IsSourceVMEncrypted is true. */ - @JsonProperty(value = "keyAndSecret") private KeyAndSecretDetails keyAndSecret; /* * Is the session to recover items from this backup copy still active. */ - @JsonProperty(value = "isInstantIlrSessionActive") private Boolean isInstantIlrSessionActive; /* * Recovery point tier information. */ - @JsonProperty(value = "recoveryPointTierDetails") private List recoveryPointTierDetails; /* * Whether VM is with Managed Disks */ - @JsonProperty(value = "isManagedVirtualMachine") private Boolean isManagedVirtualMachine; /* * Virtual Machine Size */ - @JsonProperty(value = "virtualMachineSize") private String virtualMachineSize; /* * Original Storage Account Option */ - @JsonProperty(value = "originalStorageAccountOption") private Boolean originalStorageAccountOption; /* * OS type */ - @JsonProperty(value = "osType") private String osType; /* * Disk configuration */ - @JsonProperty(value = "recoveryPointDiskConfiguration") private RecoveryPointDiskConfiguration recoveryPointDiskConfiguration; /* * Identifies the zone of the VM at the time of backup. Applicable only for zone-pinned Vms */ - @JsonProperty(value = "zones") private List zones; /* * Eligibility of RP to be moved to another tier */ - @JsonProperty(value = "recoveryPointMoveReadinessInfo") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map recoveryPointMoveReadinessInfo; /* * Security Type of the Disk */ - @JsonProperty(value = "securityType") private String securityType; /* * Properties of Recovery Point */ - @JsonProperty(value = "recoveryPointProperties") private RecoveryPointProperties recoveryPointProperties; /* * This flag denotes if any of the disks in the VM are using Private access network setting */ - @JsonProperty(value = "isPrivateAccessEnabledOnAnyDisk") private Boolean isPrivateAccessEnabledOnAnyDisk; /* * Extended location of the VM recovery point, * should be null if VM is in public cloud */ - @JsonProperty(value = "extendedLocation") private ExtendedLocation extendedLocation; /** @@ -561,7 +535,6 @@ public IaasVMRecoveryPoint withExtendedLocation(ExtendedLocation extendedLocatio */ @Override public void validate() { - super.validate(); if (keyAndSecret() != null) { keyAndSecret().validate(); } @@ -585,4 +558,113 @@ public void validate() { extendedLocation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointType", this.recoveryPointType); + jsonWriter.writeStringField("recoveryPointTime", + this.recoveryPointTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.recoveryPointTime)); + jsonWriter.writeStringField("recoveryPointAdditionalInfo", this.recoveryPointAdditionalInfo); + jsonWriter.writeStringField("sourceVMStorageType", this.sourceVMStorageType); + jsonWriter.writeBooleanField("isSourceVMEncrypted", this.isSourceVMEncrypted); + jsonWriter.writeJsonField("keyAndSecret", this.keyAndSecret); + jsonWriter.writeBooleanField("isInstantIlrSessionActive", this.isInstantIlrSessionActive); + jsonWriter.writeArrayField("recoveryPointTierDetails", this.recoveryPointTierDetails, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("isManagedVirtualMachine", this.isManagedVirtualMachine); + jsonWriter.writeStringField("virtualMachineSize", this.virtualMachineSize); + jsonWriter.writeBooleanField("originalStorageAccountOption", this.originalStorageAccountOption); + jsonWriter.writeStringField("osType", this.osType); + jsonWriter.writeJsonField("recoveryPointDiskConfiguration", this.recoveryPointDiskConfiguration); + jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("recoveryPointMoveReadinessInfo", this.recoveryPointMoveReadinessInfo, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("securityType", this.securityType); + jsonWriter.writeJsonField("recoveryPointProperties", this.recoveryPointProperties); + jsonWriter.writeBooleanField("isPrivateAccessEnabledOnAnyDisk", this.isPrivateAccessEnabledOnAnyDisk); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IaasVMRecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IaasVMRecoveryPoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IaasVMRecoveryPoint. + */ + public static IaasVMRecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IaasVMRecoveryPoint deserializedIaasVMRecoveryPoint = new IaasVMRecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.objectType = reader.getString(); + } else if ("recoveryPointType".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.recoveryPointType = reader.getString(); + } else if ("recoveryPointTime".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.recoveryPointTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointAdditionalInfo".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.recoveryPointAdditionalInfo = reader.getString(); + } else if ("sourceVMStorageType".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.sourceVMStorageType = reader.getString(); + } else if ("isSourceVMEncrypted".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.isSourceVMEncrypted = reader.getNullable(JsonReader::getBoolean); + } else if ("keyAndSecret".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.keyAndSecret = KeyAndSecretDetails.fromJson(reader); + } else if ("isInstantIlrSessionActive".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.isInstantIlrSessionActive + = reader.getNullable(JsonReader::getBoolean); + } else if ("recoveryPointTierDetails".equals(fieldName)) { + List recoveryPointTierDetails + = reader.readArray(reader1 -> RecoveryPointTierInformationV2.fromJson(reader1)); + deserializedIaasVMRecoveryPoint.recoveryPointTierDetails = recoveryPointTierDetails; + } else if ("isManagedVirtualMachine".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.isManagedVirtualMachine + = reader.getNullable(JsonReader::getBoolean); + } else if ("virtualMachineSize".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.virtualMachineSize = reader.getString(); + } else if ("originalStorageAccountOption".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.originalStorageAccountOption + = reader.getNullable(JsonReader::getBoolean); + } else if ("osType".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.osType = reader.getString(); + } else if ("recoveryPointDiskConfiguration".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.recoveryPointDiskConfiguration + = RecoveryPointDiskConfiguration.fromJson(reader); + } else if ("zones".equals(fieldName)) { + List zones = reader.readArray(reader1 -> reader1.getString()); + deserializedIaasVMRecoveryPoint.zones = zones; + } else if ("recoveryPointMoveReadinessInfo".equals(fieldName)) { + Map recoveryPointMoveReadinessInfo + = reader.readMap(reader1 -> RecoveryPointMoveReadinessInfo.fromJson(reader1)); + deserializedIaasVMRecoveryPoint.recoveryPointMoveReadinessInfo = recoveryPointMoveReadinessInfo; + } else if ("securityType".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.securityType = reader.getString(); + } else if ("recoveryPointProperties".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.recoveryPointProperties = RecoveryPointProperties.fromJson(reader); + } else if ("isPrivateAccessEnabledOnAnyDisk".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.isPrivateAccessEnabledOnAnyDisk + = reader.getNullable(JsonReader::getBoolean); + } else if ("extendedLocation".equals(fieldName)) { + deserializedIaasVMRecoveryPoint.extendedLocation = ExtendedLocation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIaasVMRecoveryPoint; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreRequest.java index e8f6de09d01c9..a60634f201b7b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreRequest.java @@ -5,179 +5,145 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * IaaS VM workload-specific restore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = IaasVMRestoreRequest.class, - visible = true) -@JsonTypeName("IaasVMRestoreRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "IaasVMRestoreWithRehydrationRequest", - value = IaasVMRestoreWithRehydrationRequest.class) }) @Fluent public class IaasVMRestoreRequest extends RestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "IaasVMRestoreRequest"; /* * ID of the backup copy to be recovered. */ - @JsonProperty(value = "recoveryPointId") private String recoveryPointId; /* * Type of this recovery. */ - @JsonProperty(value = "recoveryType") private RecoveryType recoveryType; /* * Fully qualified ARM ID of the VM which is being recovered. */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /* * 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} */ - @JsonProperty(value = "targetVirtualMachineId") private String targetVirtualMachineId; /* * 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} */ - @JsonProperty(value = "targetResourceGroupId") private String targetResourceGroupId; /* * Fully qualified ARM ID of the storage account to which the VM has to be restored. */ - @JsonProperty(value = "storageAccountId") private String storageAccountId; /* * 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. */ - @JsonProperty(value = "virtualNetworkId") private String virtualNetworkId; /* * 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 + * {VnetID}/Subnet/{SubnetName} and, for the Azure Resource Manager VMs it would be ARM resource ID used to + * represent * the subnet. */ - @JsonProperty(value = "subnetId") private String subnetId; /* * Fully qualified ARM ID of the domain name to be associated to the VM being restored. This applies only to Classic * Virtual Machines. */ - @JsonProperty(value = "targetDomainNameId") private String targetDomainNameId; /* * Region in which the virtual machine is restored. */ - @JsonProperty(value = "region") private String region; /* * Affinity group associated to VM to be restored. Used only for Classic Compute Virtual Machines. */ - @JsonProperty(value = "affinityGroup") private String affinityGroup; /* * 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. */ - @JsonProperty(value = "createNewCloudService") private Boolean createNewCloudService; /* * Original Storage Account Option */ - @JsonProperty(value = "originalStorageAccountOption") private Boolean originalStorageAccountOption; /* * Details needed if the VM was encrypted at the time of backup. */ - @JsonProperty(value = "encryptionDetails") private EncryptionDetails encryptionDetails; /* * List of Disk LUNs for partial restore */ - @JsonProperty(value = "restoreDiskLunList") private List restoreDiskLunList; /* * Flag to denote of an Unmanaged disk VM should be restored with Managed disks. */ - @JsonProperty(value = "restoreWithManagedDisks") private Boolean restoreWithManagedDisks; /* * DiskEncryptionSet's ID - needed if the VM needs to be encrypted at rest during restore with customer managed key. */ - @JsonProperty(value = "diskEncryptionSetId") private String diskEncryptionSetId; /* * Target zone where the VM and its disks should be restored. */ - @JsonProperty(value = "zones") private List zones; /* * Managed Identity information required to access customer storage account. */ - @JsonProperty(value = "identityInfo") private IdentityInfo identityInfo; /* * IaaS VM workload specific restore details for restores using managed identity. */ - @JsonProperty(value = "identityBasedRestoreDetails") private IdentityBasedRestoreDetails identityBasedRestoreDetails; /* * Target extended location where the VM should be restored, * should be null if restore is to be done in public cloud */ - @JsonProperty(value = "extendedLocation") private ExtendedLocation extendedLocation; /* * Stores Secured VM Details */ - @JsonProperty(value = "securedVMDetails") private SecuredVMDetails securedVMDetails; /* * Specifies target network access settings for disks of VM to be restored, */ - @JsonProperty(value = "targetDiskNetworkAccessSettings") private TargetDiskNetworkAccessSettings targetDiskNetworkAccessSettings; /** @@ -715,7 +681,6 @@ public IaasVMRestoreRequest withResourceGuardOperationRequests(List reso */ @Override public void validate() { - super.validate(); if (encryptionDetails() != null) { encryptionDetails().validate(); } @@ -735,4 +700,146 @@ public void validate() { targetDiskNetworkAccessSettings().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointId", this.recoveryPointId); + jsonWriter.writeStringField("recoveryType", this.recoveryType == null ? null : this.recoveryType.toString()); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("targetVirtualMachineId", this.targetVirtualMachineId); + jsonWriter.writeStringField("targetResourceGroupId", this.targetResourceGroupId); + jsonWriter.writeStringField("storageAccountId", this.storageAccountId); + jsonWriter.writeStringField("virtualNetworkId", this.virtualNetworkId); + jsonWriter.writeStringField("subnetId", this.subnetId); + jsonWriter.writeStringField("targetDomainNameId", this.targetDomainNameId); + jsonWriter.writeStringField("region", this.region); + jsonWriter.writeStringField("affinityGroup", this.affinityGroup); + jsonWriter.writeBooleanField("createNewCloudService", this.createNewCloudService); + jsonWriter.writeBooleanField("originalStorageAccountOption", this.originalStorageAccountOption); + jsonWriter.writeJsonField("encryptionDetails", this.encryptionDetails); + jsonWriter.writeArrayField("restoreDiskLunList", this.restoreDiskLunList, + (writer, element) -> writer.writeInt(element)); + jsonWriter.writeBooleanField("restoreWithManagedDisks", this.restoreWithManagedDisks); + jsonWriter.writeStringField("diskEncryptionSetId", this.diskEncryptionSetId); + jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identityInfo", this.identityInfo); + jsonWriter.writeJsonField("identityBasedRestoreDetails", this.identityBasedRestoreDetails); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + jsonWriter.writeJsonField("securedVMDetails", this.securedVMDetails); + jsonWriter.writeJsonField("targetDiskNetworkAccessSettings", this.targetDiskNetworkAccessSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IaasVMRestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IaasVMRestoreRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the IaasVMRestoreRequest. + */ + public static IaasVMRestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("IaasVMRestoreWithRehydrationRequest".equals(discriminatorValue)) { + return IaasVMRestoreWithRehydrationRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static IaasVMRestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IaasVMRestoreRequest deserializedIaasVMRestoreRequest = new IaasVMRestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedIaasVMRestoreRequest.withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("objectType".equals(fieldName)) { + deserializedIaasVMRestoreRequest.objectType = reader.getString(); + } else if ("recoveryPointId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.recoveryPointId = reader.getString(); + } else if ("recoveryType".equals(fieldName)) { + deserializedIaasVMRestoreRequest.recoveryType = RecoveryType.fromString(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.sourceResourceId = reader.getString(); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.targetVirtualMachineId = reader.getString(); + } else if ("targetResourceGroupId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.targetResourceGroupId = reader.getString(); + } else if ("storageAccountId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.storageAccountId = reader.getString(); + } else if ("virtualNetworkId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.virtualNetworkId = reader.getString(); + } else if ("subnetId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.subnetId = reader.getString(); + } else if ("targetDomainNameId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.targetDomainNameId = reader.getString(); + } else if ("region".equals(fieldName)) { + deserializedIaasVMRestoreRequest.region = reader.getString(); + } else if ("affinityGroup".equals(fieldName)) { + deserializedIaasVMRestoreRequest.affinityGroup = reader.getString(); + } else if ("createNewCloudService".equals(fieldName)) { + deserializedIaasVMRestoreRequest.createNewCloudService = reader.getNullable(JsonReader::getBoolean); + } else if ("originalStorageAccountOption".equals(fieldName)) { + deserializedIaasVMRestoreRequest.originalStorageAccountOption + = reader.getNullable(JsonReader::getBoolean); + } else if ("encryptionDetails".equals(fieldName)) { + deserializedIaasVMRestoreRequest.encryptionDetails = EncryptionDetails.fromJson(reader); + } else if ("restoreDiskLunList".equals(fieldName)) { + List restoreDiskLunList = reader.readArray(reader1 -> reader1.getInt()); + deserializedIaasVMRestoreRequest.restoreDiskLunList = restoreDiskLunList; + } else if ("restoreWithManagedDisks".equals(fieldName)) { + deserializedIaasVMRestoreRequest.restoreWithManagedDisks + = reader.getNullable(JsonReader::getBoolean); + } else if ("diskEncryptionSetId".equals(fieldName)) { + deserializedIaasVMRestoreRequest.diskEncryptionSetId = reader.getString(); + } else if ("zones".equals(fieldName)) { + List zones = reader.readArray(reader1 -> reader1.getString()); + deserializedIaasVMRestoreRequest.zones = zones; + } else if ("identityInfo".equals(fieldName)) { + deserializedIaasVMRestoreRequest.identityInfo = IdentityInfo.fromJson(reader); + } else if ("identityBasedRestoreDetails".equals(fieldName)) { + deserializedIaasVMRestoreRequest.identityBasedRestoreDetails + = IdentityBasedRestoreDetails.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedIaasVMRestoreRequest.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("securedVMDetails".equals(fieldName)) { + deserializedIaasVMRestoreRequest.securedVMDetails = SecuredVMDetails.fromJson(reader); + } else if ("targetDiskNetworkAccessSettings".equals(fieldName)) { + deserializedIaasVMRestoreRequest.targetDiskNetworkAccessSettings + = TargetDiskNetworkAccessSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIaasVMRestoreRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreWithRehydrationRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreWithRehydrationRequest.java index 8f8ad40192ff0..9023f01b5e3a5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreWithRehydrationRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMRestoreWithRehydrationRequest.java @@ -5,34 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * IaaS VM workload-specific restore with integrated rehydration of recovery point. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = IaasVMRestoreWithRehydrationRequest.class, - visible = true) -@JsonTypeName("IaasVMRestoreWithRehydrationRequest") @Fluent public final class IaasVMRestoreWithRehydrationRequest extends IaasVMRestoreRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "IaasVMRestoreWithRehydrationRequest"; /* * RP Rehydration Info */ - @JsonProperty(value = "recoveryPointRehydrationInfo") private RecoveryPointRehydrationInfo recoveryPointRehydrationInfo; /** @@ -299,9 +291,154 @@ public IaasVMRestoreWithRehydrationRequest withSecuredVMDetails(SecuredVMDetails */ @Override public void validate() { - super.validate(); if (recoveryPointRehydrationInfo() != null) { recoveryPointRehydrationInfo().validate(); } + if (encryptionDetails() != null) { + encryptionDetails().validate(); + } + if (identityInfo() != null) { + identityInfo().validate(); + } + if (identityBasedRestoreDetails() != null) { + identityBasedRestoreDetails().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + if (securedVMDetails() != null) { + securedVMDetails().validate(); + } + if (targetDiskNetworkAccessSettings() != null) { + targetDiskNetworkAccessSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("recoveryPointId", recoveryPointId()); + jsonWriter.writeStringField("recoveryType", recoveryType() == null ? null : recoveryType().toString()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("targetVirtualMachineId", targetVirtualMachineId()); + jsonWriter.writeStringField("targetResourceGroupId", targetResourceGroupId()); + jsonWriter.writeStringField("storageAccountId", storageAccountId()); + jsonWriter.writeStringField("virtualNetworkId", virtualNetworkId()); + jsonWriter.writeStringField("subnetId", subnetId()); + jsonWriter.writeStringField("targetDomainNameId", targetDomainNameId()); + jsonWriter.writeStringField("region", region()); + jsonWriter.writeStringField("affinityGroup", affinityGroup()); + jsonWriter.writeBooleanField("createNewCloudService", createNewCloudService()); + jsonWriter.writeBooleanField("originalStorageAccountOption", originalStorageAccountOption()); + jsonWriter.writeJsonField("encryptionDetails", encryptionDetails()); + jsonWriter.writeArrayField("restoreDiskLunList", restoreDiskLunList(), + (writer, element) -> writer.writeInt(element)); + jsonWriter.writeBooleanField("restoreWithManagedDisks", restoreWithManagedDisks()); + jsonWriter.writeStringField("diskEncryptionSetId", diskEncryptionSetId()); + jsonWriter.writeArrayField("zones", zones(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identityInfo", identityInfo()); + jsonWriter.writeJsonField("identityBasedRestoreDetails", identityBasedRestoreDetails()); + jsonWriter.writeJsonField("extendedLocation", extendedLocation()); + jsonWriter.writeJsonField("securedVMDetails", securedVMDetails()); + jsonWriter.writeJsonField("targetDiskNetworkAccessSettings", targetDiskNetworkAccessSettings()); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryPointRehydrationInfo", this.recoveryPointRehydrationInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IaasVMRestoreWithRehydrationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IaasVMRestoreWithRehydrationRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IaasVMRestoreWithRehydrationRequest. + */ + public static IaasVMRestoreWithRehydrationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IaasVMRestoreWithRehydrationRequest deserializedIaasVMRestoreWithRehydrationRequest + = new IaasVMRestoreWithRehydrationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedIaasVMRestoreWithRehydrationRequest + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("recoveryPointId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withRecoveryPointId(reader.getString()); + } else if ("recoveryType".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withRecoveryType(RecoveryType.fromString(reader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withSourceResourceId(reader.getString()); + } else if ("targetVirtualMachineId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withTargetVirtualMachineId(reader.getString()); + } else if ("targetResourceGroupId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withTargetResourceGroupId(reader.getString()); + } else if ("storageAccountId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withStorageAccountId(reader.getString()); + } else if ("virtualNetworkId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withVirtualNetworkId(reader.getString()); + } else if ("subnetId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withSubnetId(reader.getString()); + } else if ("targetDomainNameId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withTargetDomainNameId(reader.getString()); + } else if ("region".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withRegion(reader.getString()); + } else if ("affinityGroup".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withAffinityGroup(reader.getString()); + } else if ("createNewCloudService".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withCreateNewCloudService(reader.getNullable(JsonReader::getBoolean)); + } else if ("originalStorageAccountOption".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withOriginalStorageAccountOption(reader.getNullable(JsonReader::getBoolean)); + } else if ("encryptionDetails".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withEncryptionDetails(EncryptionDetails.fromJson(reader)); + } else if ("restoreDiskLunList".equals(fieldName)) { + List restoreDiskLunList = reader.readArray(reader1 -> reader1.getInt()); + deserializedIaasVMRestoreWithRehydrationRequest.withRestoreDiskLunList(restoreDiskLunList); + } else if ("restoreWithManagedDisks".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withRestoreWithManagedDisks(reader.getNullable(JsonReader::getBoolean)); + } else if ("diskEncryptionSetId".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withDiskEncryptionSetId(reader.getString()); + } else if ("zones".equals(fieldName)) { + List zones = reader.readArray(reader1 -> reader1.getString()); + deserializedIaasVMRestoreWithRehydrationRequest.withZones(zones); + } else if ("identityInfo".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.withIdentityInfo(IdentityInfo.fromJson(reader)); + } else if ("identityBasedRestoreDetails".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withIdentityBasedRestoreDetails(IdentityBasedRestoreDetails.fromJson(reader)); + } else if ("extendedLocation".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withExtendedLocation(ExtendedLocation.fromJson(reader)); + } else if ("securedVMDetails".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withSecuredVMDetails(SecuredVMDetails.fromJson(reader)); + } else if ("targetDiskNetworkAccessSettings".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest + .withTargetDiskNetworkAccessSettings(TargetDiskNetworkAccessSettings.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.objectType = reader.getString(); + } else if ("recoveryPointRehydrationInfo".equals(fieldName)) { + deserializedIaasVMRestoreWithRehydrationRequest.recoveryPointRehydrationInfo + = RecoveryPointRehydrationInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIaasVMRestoreWithRehydrationRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMSnapshotConsistencyType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMSnapshotConsistencyType.java index 7b1e28de7c881..3548fea49e80c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMSnapshotConsistencyType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVMSnapshotConsistencyType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public IaasVMSnapshotConsistencyType() { * @param name a name to look for. * @return the corresponding IaasVMSnapshotConsistencyType. */ - @JsonCreator public static IaasVMSnapshotConsistencyType fromString(String name) { return fromString(name, IaasVMSnapshotConsistencyType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVmilrRegistrationRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVmilrRegistrationRequest.java index ede517b1dd238..909dd624a6ed1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVmilrRegistrationRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasVmilrRegistrationRequest.java @@ -5,51 +5,40 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Restore files/folders from a backup copy of IaaS VM. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = IaasVmilrRegistrationRequest.class, - visible = true) -@JsonTypeName("IaasVMILRRegistrationRequest") @Fluent public final class IaasVmilrRegistrationRequest extends IlrRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "IaasVMILRRegistrationRequest"; /* * ID of the IaaS VM backup copy from where the files/folders have to be restored. */ - @JsonProperty(value = "recoveryPointId") private String recoveryPointId; /* * Fully qualified ARM ID of the virtual machine whose the files / folders have to be restored. */ - @JsonProperty(value = "virtualMachineId") private String virtualMachineId; /* * iSCSI initiator name. */ - @JsonProperty(value = "initiatorName") private String initiatorName; /* * Whether to renew existing registration with the iSCSI server. */ - @JsonProperty(value = "renewExistingRegistration") private Boolean renewExistingRegistration; /** @@ -158,6 +147,54 @@ public IaasVmilrRegistrationRequest withRenewExistingRegistration(Boolean renewE */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("recoveryPointId", this.recoveryPointId); + jsonWriter.writeStringField("virtualMachineId", this.virtualMachineId); + jsonWriter.writeStringField("initiatorName", this.initiatorName); + jsonWriter.writeBooleanField("renewExistingRegistration", this.renewExistingRegistration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IaasVmilrRegistrationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IaasVmilrRegistrationRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IaasVmilrRegistrationRequest. + */ + public static IaasVmilrRegistrationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IaasVmilrRegistrationRequest deserializedIaasVmilrRegistrationRequest = new IaasVmilrRegistrationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedIaasVmilrRegistrationRequest.objectType = reader.getString(); + } else if ("recoveryPointId".equals(fieldName)) { + deserializedIaasVmilrRegistrationRequest.recoveryPointId = reader.getString(); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedIaasVmilrRegistrationRequest.virtualMachineId = reader.getString(); + } else if ("initiatorName".equals(fieldName)) { + deserializedIaasVmilrRegistrationRequest.initiatorName = reader.getString(); + } else if ("renewExistingRegistration".equals(fieldName)) { + deserializedIaasVmilrRegistrationRequest.renewExistingRegistration + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedIaasVmilrRegistrationRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasvmPolicyType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasvmPolicyType.java index 486216f930492..465cdd0236e96 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasvmPolicyType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IaasvmPolicyType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public IaasvmPolicyType() { * @param name a name to look for. * @return the corresponding IaasvmPolicyType. */ - @JsonCreator public static IaasvmPolicyType fromString(String name) { return fromString(name, IaasvmPolicyType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityBasedRestoreDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityBasedRestoreDetails.java index 9228bb962f601..e33551fc9a295 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityBasedRestoreDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityBasedRestoreDetails.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * IaaS VM workload specific restore details for restores using managed identity. */ @Fluent -public final class IdentityBasedRestoreDetails { +public final class IdentityBasedRestoreDetails implements JsonSerializable { /* * Gets the class type. */ - @JsonProperty(value = "objectType") private String objectType; /* * Fully qualified ARM ID of the target storage account. */ - @JsonProperty(value = "targetStorageAccountId") private String targetStorageAccountId; /** @@ -77,4 +79,43 @@ public IdentityBasedRestoreDetails withTargetStorageAccountId(String targetStora */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("targetStorageAccountId", this.targetStorageAccountId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IdentityBasedRestoreDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IdentityBasedRestoreDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IdentityBasedRestoreDetails. + */ + public static IdentityBasedRestoreDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IdentityBasedRestoreDetails deserializedIdentityBasedRestoreDetails = new IdentityBasedRestoreDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedIdentityBasedRestoreDetails.objectType = reader.getString(); + } else if ("targetStorageAccountId".equals(fieldName)) { + deserializedIdentityBasedRestoreDetails.targetStorageAccountId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIdentityBasedRestoreDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityInfo.java index e96dc030bd788..11d77dde08510 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IdentityInfo.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Encapsulates Managed Identity related information. */ @Fluent -public final class IdentityInfo { +public final class IdentityInfo implements JsonSerializable { /* * To differentiate if the managed identity is system assigned or user assigned */ - @JsonProperty(value = "isSystemAssignedIdentity") private Boolean isSystemAssignedIdentity; /* * Managed Identity Resource Id * Optional: Might not be required in the case of system assigned managed identity */ - @JsonProperty(value = "managedIdentityResourceId") private String managedIdentityResourceId; /** @@ -82,4 +84,43 @@ public IdentityInfo withManagedIdentityResourceId(String managedIdentityResource */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isSystemAssignedIdentity", this.isSystemAssignedIdentity); + jsonWriter.writeStringField("managedIdentityResourceId", this.managedIdentityResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IdentityInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IdentityInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IdentityInfo. + */ + public static IdentityInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IdentityInfo deserializedIdentityInfo = new IdentityInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isSystemAssignedIdentity".equals(fieldName)) { + deserializedIdentityInfo.isSystemAssignedIdentity = reader.getNullable(JsonReader::getBoolean); + } else if ("managedIdentityResourceId".equals(fieldName)) { + deserializedIdentityInfo.managedIdentityResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIdentityInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequest.java index a5184767c3b91..f14a787817129 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequest.java @@ -5,34 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Parameters to Provision ILR API. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "objectType", defaultImpl = IlrRequest.class, visible = true) -@JsonTypeName("IlrRequest") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureFileShareProvisionILRRequest", value = AzureFileShareProvisionIlrRequest.class), - @JsonSubTypes.Type(name = "IaasVMILRRegistrationRequest", value = IaasVmilrRegistrationRequest.class) }) @Immutable -public class IlrRequest { +public class IlrRequest implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "IlrRequest"; /** * Creates an instance of IlrRequest class. */ public IlrRequest() { - this.objectType = "IlrRequest"; } /** @@ -52,4 +45,67 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IlrRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IlrRequest if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the IlrRequest. + */ + public static IlrRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureFileShareProvisionILRRequest".equals(discriminatorValue)) { + return AzureFileShareProvisionIlrRequest.fromJson(readerToUse.reset()); + } else if ("IaasVMILRRegistrationRequest".equals(discriminatorValue)) { + return IaasVmilrRegistrationRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static IlrRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IlrRequest deserializedIlrRequest = new IlrRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedIlrRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIlrRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequestResource.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequestResource.java index 83fb7ec32904b..64f077178a8fe 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequestResource.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/IlrRequestResource.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** @@ -17,15 +20,28 @@ public final class IlrRequestResource extends Resource { /* * ILRRequestResource properties */ - @JsonProperty(value = "properties") private IlrRequest properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of IlrRequestResource class. */ @@ -72,6 +88,36 @@ public IlrRequestResource withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -100,4 +146,57 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IlrRequestResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IlrRequestResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IlrRequestResource. + */ + public static IlrRequestResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IlrRequestResource deserializedIlrRequestResource = new IlrRequestResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIlrRequestResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIlrRequestResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIlrRequestResource.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedIlrRequestResource.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedIlrRequestResource.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedIlrRequestResource.properties = IlrRequest.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedIlrRequestResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIlrRequestResource; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InfrastructureEncryptionState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InfrastructureEncryptionState.java index 5f7243f70782e..3b426bdfb590c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InfrastructureEncryptionState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InfrastructureEncryptionState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public InfrastructureEncryptionState() { * @param name a name to look for. * @return the corresponding InfrastructureEncryptionState. */ - @JsonCreator public static InfrastructureEncryptionState fromString(String name) { return fromString(name, InfrastructureEncryptionState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryInfo.java index 6240b3539f086..1ba0c91ff882d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryInfo.java @@ -5,32 +5,33 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Details about inquired protectable items under a given container. */ @Fluent -public final class InquiryInfo { +public final class InquiryInfo implements JsonSerializable { /* * Inquiry Status for this container such as * InProgress | Failed | Succeeded */ - @JsonProperty(value = "status") private String status; /* * Error Details if the Status is non-success. */ - @JsonProperty(value = "errorDetail") private ErrorDetail errorDetail; /* * Inquiry Details which will have workload specific details. * For e.g. - For SQL and oracle this will contain different details. */ - @JsonProperty(value = "inquiryDetails") private List inquiryDetails; /** @@ -116,4 +117,49 @@ public void validate() { inquiryDetails().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeJsonField("errorDetail", this.errorDetail); + jsonWriter.writeArrayField("inquiryDetails", this.inquiryDetails, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InquiryInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InquiryInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the InquiryInfo. + */ + public static InquiryInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InquiryInfo deserializedInquiryInfo = new InquiryInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedInquiryInfo.status = reader.getString(); + } else if ("errorDetail".equals(fieldName)) { + deserializedInquiryInfo.errorDetail = ErrorDetail.fromJson(reader); + } else if ("inquiryDetails".equals(fieldName)) { + List inquiryDetails + = reader.readArray(reader1 -> WorkloadInquiryDetails.fromJson(reader1)); + deserializedInquiryInfo.inquiryDetails = inquiryDetails; + } else { + reader.skipChildren(); + } + } + + return deserializedInquiryInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryStatus.java index 07b6d6b70e3c6..00e5f6eeda33c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public InquiryStatus() { * @param name a name to look for. * @return the corresponding InquiryStatus. */ - @JsonCreator public static InquiryStatus fromString(String name) { return fromString(name, InquiryStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryValidation.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryValidation.java index d6ca7ed5527d9..9e25d80b0c228 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryValidation.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InquiryValidation.java @@ -5,35 +5,35 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Validation for inquired protectable items under a given container. */ @Fluent -public final class InquiryValidation { +public final class InquiryValidation implements JsonSerializable { /* * Status for the Inquiry Validation. */ - @JsonProperty(value = "status") private String status; /* * Error Detail in case the status is non-success. */ - @JsonProperty(value = "errorDetail") private ErrorDetail errorDetail; /* * Error Additional Detail in case the status is non-success. */ - @JsonProperty(value = "additionalDetail", access = JsonProperty.Access.WRITE_ONLY) private String additionalDetail; /* * Dictionary to store the count of ProtectableItems with key POType. */ - @JsonProperty(value = "protectableItemCount", access = JsonProperty.Access.WRITE_ONLY) private Object protectableItemCount; /** @@ -110,4 +110,47 @@ public void validate() { errorDetail().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeJsonField("errorDetail", this.errorDetail); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InquiryValidation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InquiryValidation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the InquiryValidation. + */ + public static InquiryValidation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InquiryValidation deserializedInquiryValidation = new InquiryValidation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedInquiryValidation.status = reader.getString(); + } else if ("errorDetail".equals(fieldName)) { + deserializedInquiryValidation.errorDetail = ErrorDetail.fromJson(reader); + } else if ("additionalDetail".equals(fieldName)) { + deserializedInquiryValidation.additionalDetail = reader.getString(); + } else if ("protectableItemCount".equals(fieldName)) { + deserializedInquiryValidation.protectableItemCount = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedInquiryValidation; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantItemRecoveryTarget.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantItemRecoveryTarget.java index 1d56b70277e20..c9b1da8881214 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantItemRecoveryTarget.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantItemRecoveryTarget.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Target details for file / folder restore. */ @Fluent -public final class InstantItemRecoveryTarget { +public final class InstantItemRecoveryTarget implements JsonSerializable { /* * List of client scripts. */ - @JsonProperty(value = "clientScripts") private List clientScripts; /** @@ -55,4 +58,42 @@ public void validate() { clientScripts().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("clientScripts", this.clientScripts, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstantItemRecoveryTarget from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstantItemRecoveryTarget if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InstantItemRecoveryTarget. + */ + public static InstantItemRecoveryTarget fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstantItemRecoveryTarget deserializedInstantItemRecoveryTarget = new InstantItemRecoveryTarget(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientScripts".equals(fieldName)) { + List clientScripts + = reader.readArray(reader1 -> ClientScriptForConnect.fromJson(reader1)); + deserializedInstantItemRecoveryTarget.clientScripts = clientScripts; + } else { + reader.skipChildren(); + } + } + + return deserializedInstantItemRecoveryTarget; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantRPAdditionalDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantRPAdditionalDetails.java index 5f62c20798f43..e4642187bb5c7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantRPAdditionalDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/InstantRPAdditionalDetails.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The InstantRPAdditionalDetails model. */ @Fluent -public final class InstantRPAdditionalDetails { +public final class InstantRPAdditionalDetails implements JsonSerializable { /* * The azureBackupRGNamePrefix property. */ - @JsonProperty(value = "azureBackupRGNamePrefix") private String azureBackupRGNamePrefix; /* * The azureBackupRGNameSuffix property. */ - @JsonProperty(value = "azureBackupRGNameSuffix") private String azureBackupRGNameSuffix; /** @@ -77,4 +79,43 @@ public InstantRPAdditionalDetails withAzureBackupRGNameSuffix(String azureBackup */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureBackupRGNamePrefix", this.azureBackupRGNamePrefix); + jsonWriter.writeStringField("azureBackupRGNameSuffix", this.azureBackupRGNameSuffix); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstantRPAdditionalDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstantRPAdditionalDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InstantRPAdditionalDetails. + */ + public static InstantRPAdditionalDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstantRPAdditionalDetails deserializedInstantRPAdditionalDetails = new InstantRPAdditionalDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureBackupRGNamePrefix".equals(fieldName)) { + deserializedInstantRPAdditionalDetails.azureBackupRGNamePrefix = reader.getString(); + } else if ("azureBackupRGNameSuffix".equals(fieldName)) { + deserializedInstantRPAdditionalDetails.azureBackupRGNameSuffix = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInstantRPAdditionalDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Job.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Job.java index 58ce2d1fa5dce..93bba7c6fd140 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Job.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Job.java @@ -5,82 +5,65 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Defines workload agnostic properties for a job. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = Job.class, visible = true) -@JsonTypeName("Job") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureIaaSVMJob", value = AzureIaaSvmJob.class), - @JsonSubTypes.Type(name = "AzureIaaSVMJobV2", value = AzureIaaSvmJobV2.class), - @JsonSubTypes.Type(name = "AzureStorageJob", value = AzureStorageJob.class), - @JsonSubTypes.Type(name = "AzureWorkloadJob", value = AzureWorkloadJob.class), - @JsonSubTypes.Type(name = "DpmJob", value = DpmJob.class), - @JsonSubTypes.Type(name = "MabJob", value = MabJob.class), - @JsonSubTypes.Type(name = "VaultJob", value = VaultJob.class) }) @Fluent -public class Job { +public class Job implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) - private String jobType; + private String jobType = "Job"; /* * Friendly name of the entity on which the current job is executing. */ - @JsonProperty(value = "entityFriendlyName") private String entityFriendlyName; /* * Backup management type to execute the current job. */ - @JsonProperty(value = "backupManagementType") private BackupManagementType backupManagementType; /* * The operation name. */ - @JsonProperty(value = "operation") private String operation; /* * Job status. */ - @JsonProperty(value = "status") private String status; /* * The start time. */ - @JsonProperty(value = "startTime") private OffsetDateTime startTime; /* * The end time. */ - @JsonProperty(value = "endTime") private OffsetDateTime endTime; /* * ActivityId of job. */ - @JsonProperty(value = "activityId") private String activityId; /** * Creates an instance of Job class. */ public Job() { - this.jobType = "Job"; } /** @@ -240,4 +223,103 @@ public Job withActivityId(String activityId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeStringField("entityFriendlyName", this.entityFriendlyName); + jsonWriter.writeStringField("backupManagementType", + this.backupManagementType == null ? null : this.backupManagementType.toString()); + jsonWriter.writeStringField("operation", this.operation); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("activityId", this.activityId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Job from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Job if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Job. + */ + public static Job fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("jobType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureIaaSVMJob".equals(discriminatorValue)) { + return AzureIaaSvmJob.fromJson(readerToUse.reset()); + } else if ("AzureIaaSVMJobV2".equals(discriminatorValue)) { + return AzureIaaSvmJobV2.fromJson(readerToUse.reset()); + } else if ("AzureStorageJob".equals(discriminatorValue)) { + return AzureStorageJob.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadJob".equals(discriminatorValue)) { + return AzureWorkloadJob.fromJson(readerToUse.reset()); + } else if ("DpmJob".equals(discriminatorValue)) { + return DpmJob.fromJson(readerToUse.reset()); + } else if ("MabJob".equals(discriminatorValue)) { + return MabJob.fromJson(readerToUse.reset()); + } else if ("VaultJob".equals(discriminatorValue)) { + return VaultJob.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Job fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Job deserializedJob = new Job(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobType".equals(fieldName)) { + deserializedJob.jobType = reader.getString(); + } else if ("entityFriendlyName".equals(fieldName)) { + deserializedJob.entityFriendlyName = reader.getString(); + } else if ("backupManagementType".equals(fieldName)) { + deserializedJob.backupManagementType = BackupManagementType.fromString(reader.getString()); + } else if ("operation".equals(fieldName)) { + deserializedJob.operation = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedJob.status = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedJob.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedJob.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("activityId".equals(fieldName)) { + deserializedJob.activityId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJob; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobResourceList.java index f285a97fb2b47..047f8f277dee8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.JobResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class JobResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,48 @@ public JobResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobResourceList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the JobResourceList. + */ + public static JobResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobResourceList deserializedJobResourceList = new JobResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedJobResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> JobResourceInner.fromJson(reader1)); + deserializedJobResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedJobResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobSupportedAction.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobSupportedAction.java index 869eb88fad95e..430d21db5505d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobSupportedAction.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/JobSupportedAction.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Defines values for JobSupportedAction. */ @@ -41,7 +38,6 @@ public enum JobSupportedAction { * @param value the serialized value to parse. * @return the parsed JobSupportedAction object, or null if unable to parse. */ - @JsonCreator public static JobSupportedAction fromString(String value) { if (value == null) { return null; @@ -58,7 +54,6 @@ public static JobSupportedAction fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KekDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KekDetails.java index 3a7867eab8333..d2806ea016f5b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KekDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KekDetails.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * KEK is encryption key for BEK. */ @Fluent -public final class KekDetails { +public final class KekDetails implements JsonSerializable { /* * Key is KEK. */ - @JsonProperty(value = "keyUrl") private String keyUrl; /* * Key Vault ID where this Key is stored. */ - @JsonProperty(value = "keyVaultId") private String keyVaultId; /* * KEK data. */ - @JsonProperty(value = "keyBackupData") private String keyBackupData; /** @@ -103,4 +104,46 @@ public KekDetails withKeyBackupData(String keyBackupData) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyUrl", this.keyUrl); + jsonWriter.writeStringField("keyVaultId", this.keyVaultId); + jsonWriter.writeStringField("keyBackupData", this.keyBackupData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KekDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KekDetails if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the KekDetails. + */ + public static KekDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KekDetails deserializedKekDetails = new KekDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyUrl".equals(fieldName)) { + deserializedKekDetails.keyUrl = reader.getString(); + } else if ("keyVaultId".equals(fieldName)) { + deserializedKekDetails.keyVaultId = reader.getString(); + } else if ("keyBackupData".equals(fieldName)) { + deserializedKekDetails.keyBackupData = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKekDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KeyAndSecretDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KeyAndSecretDetails.java index af24326487d68..629c2e8346a86 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KeyAndSecretDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KeyAndSecretDetails.java @@ -5,7 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * BEK is bitlocker key. @@ -17,23 +21,20 @@ * BEK and KEK can potentially have different vault ids. */ @Fluent -public final class KeyAndSecretDetails { +public final class KeyAndSecretDetails implements JsonSerializable { /* * KEK is encryption key for BEK. */ - @JsonProperty(value = "kekDetails") private KekDetails kekDetails; /* * BEK is bitlocker encryption key. */ - @JsonProperty(value = "bekDetails") private BekDetails bekDetails; /* * Encryption mechanism: None/ SinglePass/ DoublePass */ - @JsonProperty(value = "encryptionMechanism") private String encryptionMechanism; /** @@ -115,4 +116,46 @@ public void validate() { bekDetails().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("kekDetails", this.kekDetails); + jsonWriter.writeJsonField("bekDetails", this.bekDetails); + jsonWriter.writeStringField("encryptionMechanism", this.encryptionMechanism); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeyAndSecretDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeyAndSecretDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the KeyAndSecretDetails. + */ + public static KeyAndSecretDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeyAndSecretDetails deserializedKeyAndSecretDetails = new KeyAndSecretDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kekDetails".equals(fieldName)) { + deserializedKeyAndSecretDetails.kekDetails = KekDetails.fromJson(reader); + } else if ("bekDetails".equals(fieldName)) { + deserializedKeyAndSecretDetails.bekDetails = BekDetails.fromJson(reader); + } else if ("encryptionMechanism".equals(fieldName)) { + deserializedKeyAndSecretDetails.encryptionMechanism = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKeyAndSecretDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KpiResourceHealthDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KpiResourceHealthDetails.java index 7a4b2896cbf94..c5d6ffef81e4e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KpiResourceHealthDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/KpiResourceHealthDetails.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * KPI Resource Health Details. */ @Fluent -public final class KpiResourceHealthDetails { +public final class KpiResourceHealthDetails implements JsonSerializable { /* * Resource Health Status */ - @JsonProperty(value = "resourceHealthStatus") private ResourceHealthStatus resourceHealthStatus; /* * Resource Health Status */ - @JsonProperty(value = "resourceHealthDetails") private List resourceHealthDetails; /** @@ -81,4 +83,48 @@ public void validate() { resourceHealthDetails().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceHealthStatus", + this.resourceHealthStatus == null ? null : this.resourceHealthStatus.toString()); + jsonWriter.writeArrayField("resourceHealthDetails", this.resourceHealthDetails, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KpiResourceHealthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KpiResourceHealthDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the KpiResourceHealthDetails. + */ + public static KpiResourceHealthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KpiResourceHealthDetails deserializedKpiResourceHealthDetails = new KpiResourceHealthDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceHealthStatus".equals(fieldName)) { + deserializedKpiResourceHealthDetails.resourceHealthStatus + = ResourceHealthStatus.fromString(reader.getString()); + } else if ("resourceHealthDetails".equals(fieldName)) { + List resourceHealthDetails + = reader.readArray(reader1 -> ResourceHealthDetails.fromJson(reader1)); + deserializedKpiResourceHealthDetails.resourceHealthDetails = resourceHealthDetails; + } else { + reader.skipChildren(); + } + } + + return deserializedKpiResourceHealthDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastBackupStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastBackupStatus.java index 2f1219348ed37..fe0a35e11c951 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastBackupStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastBackupStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public LastBackupStatus() { * @param name a name to look for. * @return the corresponding LastBackupStatus. */ - @JsonCreator public static LastBackupStatus fromString(String name) { return fromString(name, LastBackupStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastUpdateStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastUpdateStatus.java index 9b6a5097ce1b4..d359a574a6a03 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastUpdateStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LastUpdateStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -67,7 +66,6 @@ public LastUpdateStatus() { * @param name a name to look for. * @return the corresponding LastUpdateStatus. */ - @JsonCreator public static LastUpdateStatus fromString(String name) { return fromString(name, LastUpdateStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ListRecoveryPointsRecommendedForMoveRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ListRecoveryPointsRecommendedForMoveRequest.java index 1f6e18ffc9942..73e697ab265fb 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ListRecoveryPointsRecommendedForMoveRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ListRecoveryPointsRecommendedForMoveRequest.java @@ -5,24 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * ListRecoveryPointsRecommendedForMoveRequest Request. */ @Fluent -public final class ListRecoveryPointsRecommendedForMoveRequest { +public final class ListRecoveryPointsRecommendedForMoveRequest + implements JsonSerializable { /* * Gets the class type. */ - @JsonProperty(value = "objectType") private String objectType; /* * List of Recovery Points excluded from Move */ - @JsonProperty(value = "excludedRPList") private List excludedRPList; /** @@ -78,4 +81,46 @@ public ListRecoveryPointsRecommendedForMoveRequest withExcludedRPList(List writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListRecoveryPointsRecommendedForMoveRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListRecoveryPointsRecommendedForMoveRequest if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ListRecoveryPointsRecommendedForMoveRequest. + */ + public static ListRecoveryPointsRecommendedForMoveRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListRecoveryPointsRecommendedForMoveRequest deserializedListRecoveryPointsRecommendedForMoveRequest + = new ListRecoveryPointsRecommendedForMoveRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedListRecoveryPointsRecommendedForMoveRequest.objectType = reader.getString(); + } else if ("excludedRPList".equals(fieldName)) { + List excludedRPList = reader.readArray(reader1 -> reader1.getString()); + deserializedListRecoveryPointsRecommendedForMoveRequest.excludedRPList = excludedRPList; + } else { + reader.skipChildren(); + } + } + + return deserializedListRecoveryPointsRecommendedForMoveRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LogSchedulePolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LogSchedulePolicy.java index 39c71a16ffc2c..4db22640228d6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LogSchedulePolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LogSchedulePolicy.java @@ -5,33 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Log policy schedule. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "schedulePolicyType", - defaultImpl = LogSchedulePolicy.class, - visible = true) -@JsonTypeName("LogSchedulePolicy") @Fluent public final class LogSchedulePolicy extends SchedulePolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "schedulePolicyType", required = true) private String schedulePolicyType = "LogSchedulePolicy"; /* * Frequency of the log schedule operation of this policy in minutes. */ - @JsonProperty(value = "scheduleFrequencyInMins") private Integer scheduleFrequencyInMins; /** @@ -78,6 +70,44 @@ public LogSchedulePolicy withScheduleFrequencyInMins(Integer scheduleFrequencyIn */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schedulePolicyType", this.schedulePolicyType); + jsonWriter.writeNumberField("scheduleFrequencyInMins", this.scheduleFrequencyInMins); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogSchedulePolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogSchedulePolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LogSchedulePolicy. + */ + public static LogSchedulePolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogSchedulePolicy deserializedLogSchedulePolicy = new LogSchedulePolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedulePolicyType".equals(fieldName)) { + deserializedLogSchedulePolicy.schedulePolicyType = reader.getString(); + } else if ("scheduleFrequencyInMins".equals(fieldName)) { + deserializedLogSchedulePolicy.scheduleFrequencyInMins = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedLogSchedulePolicy; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermRetentionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermRetentionPolicy.java index 20d7c90fd96ca..3cc8b2252c7cf 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermRetentionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermRetentionPolicy.java @@ -5,51 +5,40 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Long term retention policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "retentionPolicyType", - defaultImpl = LongTermRetentionPolicy.class, - visible = true) -@JsonTypeName("LongTermRetentionPolicy") @Fluent public final class LongTermRetentionPolicy extends RetentionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "retentionPolicyType", required = true) private String retentionPolicyType = "LongTermRetentionPolicy"; /* * Daily retention schedule of the protection policy. */ - @JsonProperty(value = "dailySchedule") private DailyRetentionSchedule dailySchedule; /* * Weekly retention schedule of the protection policy. */ - @JsonProperty(value = "weeklySchedule") private WeeklyRetentionSchedule weeklySchedule; /* * Monthly retention schedule of the protection policy. */ - @JsonProperty(value = "monthlySchedule") private MonthlyRetentionSchedule monthlySchedule; /* * Yearly retention schedule of the protection policy. */ - @JsonProperty(value = "yearlySchedule") private YearlyRetentionSchedule yearlySchedule; /** @@ -156,7 +145,6 @@ public LongTermRetentionPolicy withYearlySchedule(YearlyRetentionSchedule yearly */ @Override public void validate() { - super.validate(); if (dailySchedule() != null) { dailySchedule().validate(); } @@ -170,4 +158,52 @@ public void validate() { yearlySchedule().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("retentionPolicyType", this.retentionPolicyType); + jsonWriter.writeJsonField("dailySchedule", this.dailySchedule); + jsonWriter.writeJsonField("weeklySchedule", this.weeklySchedule); + jsonWriter.writeJsonField("monthlySchedule", this.monthlySchedule); + jsonWriter.writeJsonField("yearlySchedule", this.yearlySchedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LongTermRetentionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LongTermRetentionPolicy if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the LongTermRetentionPolicy. + */ + public static LongTermRetentionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LongTermRetentionPolicy deserializedLongTermRetentionPolicy = new LongTermRetentionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionPolicyType".equals(fieldName)) { + deserializedLongTermRetentionPolicy.retentionPolicyType = reader.getString(); + } else if ("dailySchedule".equals(fieldName)) { + deserializedLongTermRetentionPolicy.dailySchedule = DailyRetentionSchedule.fromJson(reader); + } else if ("weeklySchedule".equals(fieldName)) { + deserializedLongTermRetentionPolicy.weeklySchedule = WeeklyRetentionSchedule.fromJson(reader); + } else if ("monthlySchedule".equals(fieldName)) { + deserializedLongTermRetentionPolicy.monthlySchedule = MonthlyRetentionSchedule.fromJson(reader); + } else if ("yearlySchedule".equals(fieldName)) { + deserializedLongTermRetentionPolicy.yearlySchedule = YearlyRetentionSchedule.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLongTermRetentionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermSchedulePolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermSchedulePolicy.java index 9daf6461fd65a..4548931a213a8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermSchedulePolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/LongTermSchedulePolicy.java @@ -5,27 +5,20 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Long term policy schedule. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "schedulePolicyType", - defaultImpl = LongTermSchedulePolicy.class, - visible = true) -@JsonTypeName("LongTermSchedulePolicy") @Immutable public final class LongTermSchedulePolicy extends SchedulePolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "schedulePolicyType", required = true) private String schedulePolicyType = "LongTermSchedulePolicy"; /** @@ -52,6 +45,41 @@ public String schedulePolicyType() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schedulePolicyType", this.schedulePolicyType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LongTermSchedulePolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LongTermSchedulePolicy if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the LongTermSchedulePolicy. + */ + public static LongTermSchedulePolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LongTermSchedulePolicy deserializedLongTermSchedulePolicy = new LongTermSchedulePolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedulePolicyType".equals(fieldName)) { + deserializedLongTermSchedulePolicy.schedulePolicyType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLongTermSchedulePolicy; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainer.java index 7eb067117c255..337f04bb3f379 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainer.java @@ -5,69 +5,59 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Container with items backed up using MAB backup engine. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "containerType", defaultImpl = MabContainer.class, visible = true) -@JsonTypeName("Windows") @Fluent public final class MabContainer extends ProtectionContainer { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) private ProtectableContainerType containerType = ProtectableContainerType.WINDOWS; /* * Can the container be registered one more time. */ - @JsonProperty(value = "canReRegister") private Boolean canReRegister; /* * ContainerID represents the container. */ - @JsonProperty(value = "containerId") private Long containerId; /* * Number of items backed up in this container. */ - @JsonProperty(value = "protectedItemCount") private Long protectedItemCount; /* * Agent version of this container. */ - @JsonProperty(value = "agentVersion") private String agentVersion; /* * Additional information for this container */ - @JsonProperty(value = "extendedInfo") private MabContainerExtendedInfo extendedInfo; /* * Health details on this mab container. */ - @JsonProperty(value = "mabContainerHealthDetails") private List mabContainerHealthDetails; /* * Health state of mab container. */ - @JsonProperty(value = "containerHealthState") private String containerHealthState; /** @@ -282,7 +272,6 @@ public MabContainer withProtectableObjectType(String protectableObjectType) { */ @Override public void validate() { - super.validate(); if (extendedInfo() != null) { extendedInfo().validate(); } @@ -290,4 +279,81 @@ public void validate() { mabContainerHealthDetails().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("friendlyName", friendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("registrationStatus", registrationStatus()); + jsonWriter.writeStringField("healthStatus", healthStatus()); + jsonWriter.writeStringField("protectableObjectType", protectableObjectType()); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + jsonWriter.writeBooleanField("canReRegister", this.canReRegister); + jsonWriter.writeNumberField("containerId", this.containerId); + jsonWriter.writeNumberField("protectedItemCount", this.protectedItemCount); + jsonWriter.writeStringField("agentVersion", this.agentVersion); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + jsonWriter.writeArrayField("mabContainerHealthDetails", this.mabContainerHealthDetails, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("containerHealthState", this.containerHealthState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabContainer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MabContainer. + */ + public static MabContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabContainer deserializedMabContainer = new MabContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("friendlyName".equals(fieldName)) { + deserializedMabContainer.withFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedMabContainer + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("registrationStatus".equals(fieldName)) { + deserializedMabContainer.withRegistrationStatus(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedMabContainer.withHealthStatus(reader.getString()); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedMabContainer.withProtectableObjectType(reader.getString()); + } else if ("containerType".equals(fieldName)) { + deserializedMabContainer.containerType = ProtectableContainerType.fromString(reader.getString()); + } else if ("canReRegister".equals(fieldName)) { + deserializedMabContainer.canReRegister = reader.getNullable(JsonReader::getBoolean); + } else if ("containerId".equals(fieldName)) { + deserializedMabContainer.containerId = reader.getNullable(JsonReader::getLong); + } else if ("protectedItemCount".equals(fieldName)) { + deserializedMabContainer.protectedItemCount = reader.getNullable(JsonReader::getLong); + } else if ("agentVersion".equals(fieldName)) { + deserializedMabContainer.agentVersion = reader.getString(); + } else if ("extendedInfo".equals(fieldName)) { + deserializedMabContainer.extendedInfo = MabContainerExtendedInfo.fromJson(reader); + } else if ("mabContainerHealthDetails".equals(fieldName)) { + List mabContainerHealthDetails + = reader.readArray(reader1 -> MabContainerHealthDetails.fromJson(reader1)); + deserializedMabContainer.mabContainerHealthDetails = mabContainerHealthDetails; + } else if ("containerHealthState".equals(fieldName)) { + deserializedMabContainer.containerHealthState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMabContainer; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerExtendedInfo.java index 41741927a3897..2123fa54770c5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerExtendedInfo.java @@ -5,43 +5,44 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Additional information of the container. */ @Fluent -public final class MabContainerExtendedInfo { +public final class MabContainerExtendedInfo implements JsonSerializable { /* * Time stamp when this container was refreshed. */ - @JsonProperty(value = "lastRefreshedAt") private OffsetDateTime lastRefreshedAt; /* * Type of backup items associated with this container. */ - @JsonProperty(value = "backupItemType") private BackupItemType backupItemType; /* * List of backup items associated with this container. */ - @JsonProperty(value = "backupItems") private List backupItems; /* * Backup policy associated with this container. */ - @JsonProperty(value = "policyName") private String policyName; /* * Latest backup status of this container. */ - @JsonProperty(value = "lastBackupStatus") private String lastBackupStatus; /** @@ -157,4 +158,56 @@ public MabContainerExtendedInfo withLastBackupStatus(String lastBackupStatus) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastRefreshedAt", + this.lastRefreshedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastRefreshedAt)); + jsonWriter.writeStringField("backupItemType", + this.backupItemType == null ? null : this.backupItemType.toString()); + jsonWriter.writeArrayField("backupItems", this.backupItems, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("policyName", this.policyName); + jsonWriter.writeStringField("lastBackupStatus", this.lastBackupStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabContainerExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabContainerExtendedInfo if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MabContainerExtendedInfo. + */ + public static MabContainerExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabContainerExtendedInfo deserializedMabContainerExtendedInfo = new MabContainerExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastRefreshedAt".equals(fieldName)) { + deserializedMabContainerExtendedInfo.lastRefreshedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("backupItemType".equals(fieldName)) { + deserializedMabContainerExtendedInfo.backupItemType = BackupItemType.fromString(reader.getString()); + } else if ("backupItems".equals(fieldName)) { + List backupItems = reader.readArray(reader1 -> reader1.getString()); + deserializedMabContainerExtendedInfo.backupItems = backupItems; + } else if ("policyName".equals(fieldName)) { + deserializedMabContainerExtendedInfo.policyName = reader.getString(); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedMabContainerExtendedInfo.lastBackupStatus = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMabContainerExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerHealthDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerHealthDetails.java index 7dc7850bc4560..61afec198d4c6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerHealthDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabContainerHealthDetails.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * MAB workload-specific Health Details. */ @Fluent -public final class MabContainerHealthDetails { +public final class MabContainerHealthDetails implements JsonSerializable { /* * Health Code */ - @JsonProperty(value = "code") private Integer code; /* * Health Title */ - @JsonProperty(value = "title") private String title; /* * Health Message */ - @JsonProperty(value = "message") private String message; /* * Health Recommended Actions */ - @JsonProperty(value = "recommendations") private List recommendations; /** @@ -130,4 +130,51 @@ public MabContainerHealthDetails withRecommendations(List recommendation */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("code", this.code); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeArrayField("recommendations", this.recommendations, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabContainerHealthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabContainerHealthDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MabContainerHealthDetails. + */ + public static MabContainerHealthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabContainerHealthDetails deserializedMabContainerHealthDetails = new MabContainerHealthDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedMabContainerHealthDetails.code = reader.getNullable(JsonReader::getInt); + } else if ("title".equals(fieldName)) { + deserializedMabContainerHealthDetails.title = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedMabContainerHealthDetails.message = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedMabContainerHealthDetails.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedMabContainerHealthDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabErrorInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabErrorInfo.java index 63f9b59effca9..ef626d204c057 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabErrorInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabErrorInfo.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * MAB workload-specific error information. */ @Immutable -public final class MabErrorInfo { +public final class MabErrorInfo implements JsonSerializable { /* * Localized error string. */ - @JsonProperty(value = "errorString", access = JsonProperty.Access.WRITE_ONLY) private String errorString; /* * List of localized recommendations. */ - @JsonProperty(value = "recommendations", access = JsonProperty.Access.WRITE_ONLY) private List recommendations; /** @@ -56,4 +58,42 @@ public List recommendations() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabErrorInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabErrorInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MabErrorInfo. + */ + public static MabErrorInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabErrorInfo deserializedMabErrorInfo = new MabErrorInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorString".equals(fieldName)) { + deserializedMabErrorInfo.errorString = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedMabErrorInfo.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedMabErrorInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItem.java index e870516bbe5b6..d112971a9f7be 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItem.java @@ -5,73 +5,75 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * MAB workload-specific backup item. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = MabFileFolderProtectedItem.class, - visible = true) -@JsonTypeName("MabFileFolderProtectedItem") @Fluent public final class MabFileFolderProtectedItem extends ProtectedItem { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) private String protectedItemType = "MabFileFolderProtectedItem"; /* * Friendly name of this backup item. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Name of the computer associated with this backup item. */ - @JsonProperty(value = "computerName") private String computerName; /* * Status of last backup operation. */ - @JsonProperty(value = "lastBackupStatus") private String lastBackupStatus; /* * Timestamp of the last backup operation on this backup item. */ - @JsonProperty(value = "lastBackupTime") private OffsetDateTime lastBackupTime; /* * Protected, ProtectionStopped, IRPending or ProtectionError */ - @JsonProperty(value = "protectionState") private String protectionState; /* * Sync time for deferred deletion in UTC */ - @JsonProperty(value = "deferredDeleteSyncTimeInUTC") private Long deferredDeleteSyncTimeInUtc; /* * Additional information with this backup item. */ - @JsonProperty(value = "extendedInfo") private MabFileFolderProtectedItemExtendedInfo extendedInfo; + /* + * ID of the vault which protects this item + */ + private String vaultId; + + /* + * Type of workload this item represents. + */ + private DataSourceTypeAutoGenerated3 workloadType; + + /* + * Type of backup management for the backed up item. + */ + private BackupManagementType backupManagementType; + /** * Creates an instance of MabFileFolderProtectedItem class. */ @@ -228,6 +230,36 @@ public MabFileFolderProtectedItem withExtendedInfo(MabFileFolderProtectedItemExt return this; } + /** + * Get the vaultId property: ID of the vault which protects this item. + * + * @return the vaultId value. + */ + @Override + public String vaultId() { + return this.vaultId; + } + + /** + * Get the workloadType property: Type of workload this item represents. + * + * @return the workloadType value. + */ + @Override + public DataSourceTypeAutoGenerated3 workloadType() { + return this.workloadType; + } + + /** + * Get the backupManagementType property: Type of backup management for the backed up item. + * + * @return the backupManagementType value. + */ + @Override + public BackupManagementType backupManagementType() { + return this.backupManagementType; + } + /** * {@inheritDoc} */ @@ -370,9 +402,135 @@ public MabFileFolderProtectedItem withSoftDeleteRetentionPeriod(Integer softDele */ @Override public void validate() { - super.validate(); if (extendedInfo() != null) { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerName", containerName()); + jsonWriter.writeStringField("sourceResourceId", sourceResourceId()); + jsonWriter.writeStringField("policyId", policyId()); + jsonWriter.writeStringField("lastRecoveryPoint", + lastRecoveryPoint() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(lastRecoveryPoint())); + jsonWriter.writeStringField("backupSetName", backupSetName()); + jsonWriter.writeStringField("createMode", createMode() == null ? null : createMode().toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + deferredDeleteTimeInUtc() == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(deferredDeleteTimeInUtc())); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", isScheduledForDeferredDelete()); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", deferredDeleteTimeRemaining()); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", isDeferredDeleteScheduleUpcoming()); + jsonWriter.writeBooleanField("isRehydrate", isRehydrate()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("policyName", policyName()); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", softDeleteRetentionPeriod()); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("computerName", this.computerName); + jsonWriter.writeStringField("lastBackupStatus", this.lastBackupStatus); + jsonWriter.writeStringField("lastBackupTime", + this.lastBackupTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastBackupTime)); + jsonWriter.writeStringField("protectionState", this.protectionState); + jsonWriter.writeNumberField("deferredDeleteSyncTimeInUTC", this.deferredDeleteSyncTimeInUtc); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabFileFolderProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabFileFolderProtectedItem if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MabFileFolderProtectedItem. + */ + public static MabFileFolderProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabFileFolderProtectedItem deserializedMabFileFolderProtectedItem = new MabFileFolderProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withContainerName(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withSourceResourceId(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withPolicyId(reader.getString()); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withLastRecoveryPoint(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("backupSetName".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withBackupSetName(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withCreateMode(CreateMode.fromString(reader.getString())); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withDeferredDeleteTimeInUtc(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedMabFileFolderProtectedItem + .withIsScheduledForDeferredDelete(reader.getNullable(JsonReader::getBoolean)); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withDeferredDeleteTimeRemaining(reader.getString()); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedMabFileFolderProtectedItem + .withIsDeferredDeleteScheduleUpcoming(reader.getNullable(JsonReader::getBoolean)); + } else if ("isRehydrate".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withIsRehydrate(reader.getNullable(JsonReader::getBoolean)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedMabFileFolderProtectedItem + .withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedMabFileFolderProtectedItem + .withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("policyName".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.withPolicyName(reader.getString()); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedMabFileFolderProtectedItem + .withSoftDeleteRetentionPeriod(reader.getNullable(JsonReader::getInt)); + } else if ("vaultId".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.vaultId = reader.getString(); + } else if ("protectedItemType".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.protectedItemType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.friendlyName = reader.getString(); + } else if ("computerName".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.computerName = reader.getString(); + } else if ("lastBackupStatus".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.lastBackupStatus = reader.getString(); + } else if ("lastBackupTime".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.lastBackupTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("protectionState".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.protectionState = reader.getString(); + } else if ("deferredDeleteSyncTimeInUTC".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.deferredDeleteSyncTimeInUtc + = reader.getNullable(JsonReader::getLong); + } else if ("extendedInfo".equals(fieldName)) { + deserializedMabFileFolderProtectedItem.extendedInfo + = MabFileFolderProtectedItemExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMabFileFolderProtectedItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItemExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItemExtendedInfo.java index 717ece4e23166..c34fca85577fd 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItemExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabFileFolderProtectedItemExtendedInfo.java @@ -5,30 +5,34 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Additional information on the backed up item. */ @Fluent -public final class MabFileFolderProtectedItemExtendedInfo { +public final class MabFileFolderProtectedItemExtendedInfo + implements JsonSerializable { /* * Last time when the agent data synced to service. */ - @JsonProperty(value = "lastRefreshedAt") private OffsetDateTime lastRefreshedAt; /* * The oldest backup copy available. */ - @JsonProperty(value = "oldestRecoveryPoint") private OffsetDateTime oldestRecoveryPoint; /* * Number of backup copies associated with the backup item. */ - @JsonProperty(value = "recoveryPointCount") private Integer recoveryPointCount; /** @@ -104,4 +108,54 @@ public MabFileFolderProtectedItemExtendedInfo withRecoveryPointCount(Integer rec */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastRefreshedAt", + this.lastRefreshedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastRefreshedAt)); + jsonWriter.writeStringField("oldestRecoveryPoint", + this.oldestRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.oldestRecoveryPoint)); + jsonWriter.writeNumberField("recoveryPointCount", this.recoveryPointCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabFileFolderProtectedItemExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabFileFolderProtectedItemExtendedInfo if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MabFileFolderProtectedItemExtendedInfo. + */ + public static MabFileFolderProtectedItemExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabFileFolderProtectedItemExtendedInfo deserializedMabFileFolderProtectedItemExtendedInfo + = new MabFileFolderProtectedItemExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastRefreshedAt".equals(fieldName)) { + deserializedMabFileFolderProtectedItemExtendedInfo.lastRefreshedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("oldestRecoveryPoint".equals(fieldName)) { + deserializedMabFileFolderProtectedItemExtendedInfo.oldestRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("recoveryPointCount".equals(fieldName)) { + deserializedMabFileFolderProtectedItemExtendedInfo.recoveryPointCount + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedMabFileFolderProtectedItemExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJob.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJob.java index 56c529da87c5b..36589e9319101 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJob.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJob.java @@ -5,68 +5,60 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * MAB workload-specific job. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = MabJob.class, visible = true) -@JsonTypeName("MabJob") @Fluent public final class MabJob extends Job { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) private String jobType = "MabJob"; /* * Time taken by job to run. */ - @JsonProperty(value = "duration") private Duration duration; /* * The state/actions applicable on jobs like cancel/retry. */ - @JsonProperty(value = "actionsInfo") private List actionsInfo; /* * Name of server protecting the DS. */ - @JsonProperty(value = "mabServerName") private String mabServerName; /* * Server type of MAB container. */ - @JsonProperty(value = "mabServerType") private MabServerType mabServerType; /* * Workload type of backup item. */ - @JsonProperty(value = "workloadType") private WorkloadType workloadType; /* * The errors. */ - @JsonProperty(value = "errorDetails") private List errorDetails; /* * Additional information on the job. */ - @JsonProperty(value = "extendedInfo") private MabJobExtendedInfo extendedInfo; /** @@ -296,7 +288,6 @@ public MabJob withActivityId(String activityId) { */ @Override public void validate() { - super.validate(); if (errorDetails() != null) { errorDetails().forEach(e -> e.validate()); } @@ -304,4 +295,92 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityFriendlyName", entityFriendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("operation", operation()); + jsonWriter.writeStringField("status", status()); + jsonWriter.writeStringField("startTime", + startTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(startTime())); + jsonWriter.writeStringField("endTime", + endTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(endTime())); + jsonWriter.writeStringField("activityId", activityId()); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeArrayField("actionsInfo", this.actionsInfo, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("mabServerName", this.mabServerName); + jsonWriter.writeStringField("mabServerType", this.mabServerType == null ? null : this.mabServerType.toString()); + jsonWriter.writeStringField("workloadType", this.workloadType == null ? null : this.workloadType.toString()); + jsonWriter.writeArrayField("errorDetails", this.errorDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabJob if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the MabJob. + */ + public static MabJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabJob deserializedMabJob = new MabJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityFriendlyName".equals(fieldName)) { + deserializedMabJob.withEntityFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedMabJob.withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("operation".equals(fieldName)) { + deserializedMabJob.withOperation(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedMabJob.withStatus(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedMabJob.withStartTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("endTime".equals(fieldName)) { + deserializedMabJob.withEndTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("activityId".equals(fieldName)) { + deserializedMabJob.withActivityId(reader.getString()); + } else if ("jobType".equals(fieldName)) { + deserializedMabJob.jobType = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedMabJob.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("actionsInfo".equals(fieldName)) { + List actionsInfo + = reader.readArray(reader1 -> JobSupportedAction.fromString(reader1.getString())); + deserializedMabJob.actionsInfo = actionsInfo; + } else if ("mabServerName".equals(fieldName)) { + deserializedMabJob.mabServerName = reader.getString(); + } else if ("mabServerType".equals(fieldName)) { + deserializedMabJob.mabServerType = MabServerType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedMabJob.workloadType = WorkloadType.fromString(reader.getString()); + } else if ("errorDetails".equals(fieldName)) { + List errorDetails = reader.readArray(reader1 -> MabErrorInfo.fromJson(reader1)); + deserializedMabJob.errorDetails = errorDetails; + } else if ("extendedInfo".equals(fieldName)) { + deserializedMabJob.extendedInfo = MabJobExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMabJob; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobExtendedInfo.java index ddcac92ee9abb..8a0c3b7b3a689 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobExtendedInfo.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -14,24 +17,20 @@ * Additional information for the MAB workload-specific job. */ @Fluent -public final class MabJobExtendedInfo { +public final class MabJobExtendedInfo implements JsonSerializable { /* * List of tasks for this job. */ - @JsonProperty(value = "tasksList") private List tasksList; /* * The job properties. */ - @JsonProperty(value = "propertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map propertyBag; /* * Non localized error message specific to this job. */ - @JsonProperty(value = "dynamicErrorMessage") private String dynamicErrorMessage; /** @@ -110,4 +109,49 @@ public void validate() { tasksList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tasksList", this.tasksList, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("propertyBag", this.propertyBag, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("dynamicErrorMessage", this.dynamicErrorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabJobExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabJobExtendedInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MabJobExtendedInfo. + */ + public static MabJobExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabJobExtendedInfo deserializedMabJobExtendedInfo = new MabJobExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tasksList".equals(fieldName)) { + List tasksList + = reader.readArray(reader1 -> MabJobTaskDetails.fromJson(reader1)); + deserializedMabJobExtendedInfo.tasksList = tasksList; + } else if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedMabJobExtendedInfo.propertyBag = propertyBag; + } else if ("dynamicErrorMessage".equals(fieldName)) { + deserializedMabJobExtendedInfo.dynamicErrorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMabJobExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobTaskDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobTaskDetails.java index c8518d7b05527..ed7eeac3ded20 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobTaskDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabJobTaskDetails.java @@ -5,43 +5,44 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * MAB workload-specific job task details. */ @Fluent -public final class MabJobTaskDetails { +public final class MabJobTaskDetails implements JsonSerializable { /* * The task display name. */ - @JsonProperty(value = "taskId") private String taskId; /* * The start time. */ - @JsonProperty(value = "startTime") private OffsetDateTime startTime; /* * The end time. */ - @JsonProperty(value = "endTime") private OffsetDateTime endTime; /* * Time elapsed for task. */ - @JsonProperty(value = "duration") private Duration duration; /* * The status. */ - @JsonProperty(value = "status") private String status; /** @@ -157,4 +158,57 @@ public MabJobTaskDetails withStatus(String status) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("taskId", this.taskId); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabJobTaskDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabJobTaskDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MabJobTaskDetails. + */ + public static MabJobTaskDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabJobTaskDetails deserializedMabJobTaskDetails = new MabJobTaskDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taskId".equals(fieldName)) { + deserializedMabJobTaskDetails.taskId = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedMabJobTaskDetails.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedMabJobTaskDetails.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("duration".equals(fieldName)) { + deserializedMabJobTaskDetails.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("status".equals(fieldName)) { + deserializedMabJobTaskDetails.status = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMabJobTaskDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabProtectionPolicy.java index ca866b8a2060a..cc580ab504c60 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabProtectionPolicy.java @@ -5,40 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Mab container-specific backup policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupManagementType", - defaultImpl = MabProtectionPolicy.class, - visible = true) -@JsonTypeName("MAB") @Fluent public final class MabProtectionPolicy extends ProtectionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "backupManagementType", required = true) private String backupManagementType = "MAB"; /* * Backup schedule of backup policy. */ - @JsonProperty(value = "schedulePolicy") private SchedulePolicy schedulePolicy; /* * Retention policy details. */ - @JsonProperty(value = "retentionPolicy") private RetentionPolicy retentionPolicy; /** @@ -123,7 +114,6 @@ public MabProtectionPolicy withResourceGuardOperationRequests(List resou */ @Override public void validate() { - super.validate(); if (schedulePolicy() != null) { schedulePolicy().validate(); } @@ -131,4 +121,54 @@ public void validate() { retentionPolicy().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("protectedItemsCount", protectedItemsCount()); + jsonWriter.writeArrayField("resourceGuardOperationRequests", resourceGuardOperationRequests(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeJsonField("schedulePolicy", this.schedulePolicy); + jsonWriter.writeJsonField("retentionPolicy", this.retentionPolicy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MabProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MabProtectionPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MabProtectionPolicy. + */ + public static MabProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MabProtectionPolicy deserializedMabProtectionPolicy = new MabProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectedItemsCount".equals(fieldName)) { + deserializedMabProtectionPolicy.withProtectedItemsCount(reader.getNullable(JsonReader::getInt)); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedMabProtectionPolicy.withResourceGuardOperationRequests(resourceGuardOperationRequests); + } else if ("backupManagementType".equals(fieldName)) { + deserializedMabProtectionPolicy.backupManagementType = reader.getString(); + } else if ("schedulePolicy".equals(fieldName)) { + deserializedMabProtectionPolicy.schedulePolicy = SchedulePolicy.fromJson(reader); + } else if ("retentionPolicy".equals(fieldName)) { + deserializedMabProtectionPolicy.retentionPolicy = RetentionPolicy.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMabProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabServerType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabServerType.java index 029009d7d6c27..a4355bf9cbec8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabServerType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MabServerType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -102,7 +101,6 @@ public MabServerType() { * @param name a name to look for. * @return the corresponding MabServerType. */ - @JsonCreator public static MabServerType fromString(String name) { return fromString(name, MabServerType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthOfYear.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthOfYear.java index 4205761ec47a3..77559f93249db 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthOfYear.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthOfYear.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Defines values for MonthOfYear. */ @@ -91,7 +88,6 @@ public enum MonthOfYear { * @param value the serialized value to parse. * @return the parsed MonthOfYear object, or null if unable to parse. */ - @JsonCreator public static MonthOfYear fromString(String value) { if (value == null) { return null; @@ -108,7 +104,6 @@ public static MonthOfYear fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthlyRetentionSchedule.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthlyRetentionSchedule.java index a176916f1fc9c..deffb9620f2a5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthlyRetentionSchedule.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MonthlyRetentionSchedule.java @@ -5,43 +5,44 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Monthly retention schedule. */ @Fluent -public final class MonthlyRetentionSchedule { +public final class MonthlyRetentionSchedule implements JsonSerializable { /* * Retention schedule format type for monthly retention policy. */ - @JsonProperty(value = "retentionScheduleFormatType") private RetentionScheduleFormat retentionScheduleFormatType; /* * Daily retention format for monthly retention policy. */ - @JsonProperty(value = "retentionScheduleDaily") private DailyRetentionFormat retentionScheduleDaily; /* * Weekly retention format for monthly retention policy. */ - @JsonProperty(value = "retentionScheduleWeekly") private WeeklyRetentionFormat retentionScheduleWeekly; /* * Retention times of retention policy. */ - @JsonProperty(value = "retentionTimes") private List retentionTimes; /* * Retention duration of retention Policy. */ - @JsonProperty(value = "retentionDuration") private RetentionDuration retentionDuration; /** @@ -167,4 +168,58 @@ public void validate() { retentionDuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("retentionScheduleFormatType", + this.retentionScheduleFormatType == null ? null : this.retentionScheduleFormatType.toString()); + jsonWriter.writeJsonField("retentionScheduleDaily", this.retentionScheduleDaily); + jsonWriter.writeJsonField("retentionScheduleWeekly", this.retentionScheduleWeekly); + jsonWriter.writeArrayField("retentionTimes", this.retentionTimes, (writer, element) -> writer + .writeString(element == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(element))); + jsonWriter.writeJsonField("retentionDuration", this.retentionDuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MonthlyRetentionSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MonthlyRetentionSchedule if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MonthlyRetentionSchedule. + */ + public static MonthlyRetentionSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MonthlyRetentionSchedule deserializedMonthlyRetentionSchedule = new MonthlyRetentionSchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionScheduleFormatType".equals(fieldName)) { + deserializedMonthlyRetentionSchedule.retentionScheduleFormatType + = RetentionScheduleFormat.fromString(reader.getString()); + } else if ("retentionScheduleDaily".equals(fieldName)) { + deserializedMonthlyRetentionSchedule.retentionScheduleDaily = DailyRetentionFormat.fromJson(reader); + } else if ("retentionScheduleWeekly".equals(fieldName)) { + deserializedMonthlyRetentionSchedule.retentionScheduleWeekly + = WeeklyRetentionFormat.fromJson(reader); + } else if ("retentionTimes".equals(fieldName)) { + List retentionTimes = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + deserializedMonthlyRetentionSchedule.retentionTimes = retentionTimes; + } else if ("retentionDuration".equals(fieldName)) { + deserializedMonthlyRetentionSchedule.retentionDuration = RetentionDuration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMonthlyRetentionSchedule; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MoveRPAcrossTiersRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MoveRPAcrossTiersRequest.java index de1af387062a7..0b308fe5646bc 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MoveRPAcrossTiersRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/MoveRPAcrossTiersRequest.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The MoveRPAcrossTiersRequest model. */ @Fluent -public final class MoveRPAcrossTiersRequest { +public final class MoveRPAcrossTiersRequest implements JsonSerializable { /* * Gets the class type. */ - @JsonProperty(value = "objectType") private String objectType; /* * Source tier from where RP needs to be moved */ - @JsonProperty(value = "sourceTierType") private RecoveryPointTierType sourceTierType; /* * Target tier where RP needs to be moved */ - @JsonProperty(value = "targetTierType") private RecoveryPointTierType targetTierType; /** @@ -103,4 +104,50 @@ public MoveRPAcrossTiersRequest withTargetTierType(RecoveryPointTierType targetT */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("sourceTierType", + this.sourceTierType == null ? null : this.sourceTierType.toString()); + jsonWriter.writeStringField("targetTierType", + this.targetTierType == null ? null : this.targetTierType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MoveRPAcrossTiersRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MoveRPAcrossTiersRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MoveRPAcrossTiersRequest. + */ + public static MoveRPAcrossTiersRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MoveRPAcrossTiersRequest deserializedMoveRPAcrossTiersRequest = new MoveRPAcrossTiersRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedMoveRPAcrossTiersRequest.objectType = reader.getString(); + } else if ("sourceTierType".equals(fieldName)) { + deserializedMoveRPAcrossTiersRequest.sourceTierType + = RecoveryPointTierType.fromString(reader.getString()); + } else if ("targetTierType".equals(fieldName)) { + deserializedMoveRPAcrossTiersRequest.targetTierType + = RecoveryPointTierType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMoveRPAcrossTiersRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/NameInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/NameInfo.java index 005b246183325..805b4a1eb5a89 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/NameInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/NameInfo.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The name of usage. */ @Fluent -public final class NameInfo { +public final class NameInfo implements JsonSerializable { /* * Value of usage. */ - @JsonProperty(value = "value") private String value; /* * Localized value of usage. */ - @JsonProperty(value = "localizedValue") private String localizedValue; /** @@ -77,4 +79,43 @@ public NameInfo withLocalizedValue(String localizedValue) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("localizedValue", this.localizedValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameInfo if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the NameInfo. + */ + public static NameInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameInfo deserializedNameInfo = new NameInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedNameInfo.value = reader.getString(); + } else if ("localizedValue".equals(fieldName)) { + deserializedNameInfo.localizedValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNameInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfo.java index 69576594be76b..b8e87ea32eeee 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfo.java @@ -5,34 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Operation result info. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = OperationResultInfo.class, - visible = true) -@JsonTypeName("OperationResultInfo") @Fluent public final class OperationResultInfo extends OperationResultInfoBase { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "OperationResultInfo"; /* * List of jobs created by this operation. */ - @JsonProperty(value = "jobList") private List jobList; /** @@ -79,6 +71,45 @@ public OperationResultInfo withJobList(List jobList) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeArrayField("jobList", this.jobList, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationResultInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationResultInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationResultInfo. + */ + public static OperationResultInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationResultInfo deserializedOperationResultInfo = new OperationResultInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedOperationResultInfo.objectType = reader.getString(); + } else if ("jobList".equals(fieldName)) { + List jobList = reader.readArray(reader1 -> reader1.getString()); + deserializedOperationResultInfo.jobList = jobList; + } else { + reader.skipChildren(); + } + } + + return deserializedOperationResultInfo; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfoBase.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfoBase.java index 2ed194d55d201..3cab1a5d74932 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfoBase.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationResultInfoBase.java @@ -5,38 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for operation result info. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = OperationResultInfoBase.class, - visible = true) -@JsonTypeName("OperationResultInfoBase") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "ExportJobsOperationResultInfo", value = ExportJobsOperationResultInfo.class), - @JsonSubTypes.Type(name = "OperationResultInfo", value = OperationResultInfo.class) }) @Immutable -public class OperationResultInfoBase { +public class OperationResultInfoBase implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "OperationResultInfoBase"; /** * Creates an instance of OperationResultInfoBase class. */ public OperationResultInfoBase() { - this.objectType = "OperationResultInfoBase"; } /** @@ -56,4 +45,67 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationResultInfoBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationResultInfoBase if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationResultInfoBase. + */ + public static OperationResultInfoBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("ExportJobsOperationResultInfo".equals(discriminatorValue)) { + return ExportJobsOperationResultInfo.fromJson(readerToUse.reset()); + } else if ("OperationResultInfo".equals(discriminatorValue)) { + return OperationResultInfo.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static OperationResultInfoBase fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationResultInfoBase deserializedOperationResultInfoBase = new OperationResultInfoBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedOperationResultInfoBase.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationResultInfoBase; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusError.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusError.java index 69bda41a47f57..09e7a8bdab444 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusError.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusError.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Error information associated with operation status call. */ @Fluent -public final class OperationStatusError { +public final class OperationStatusError implements JsonSerializable { /* * Error code of the operation failure. */ - @JsonProperty(value = "code") private String code; /* * Error message displayed if the operation failure. */ - @JsonProperty(value = "message") private String message; /** @@ -77,4 +79,43 @@ public OperationStatusError withMessage(String message) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusError if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusError. + */ + public static OperationStatusError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusError deserializedOperationStatusError = new OperationStatusError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedOperationStatusError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedOperationStatusError.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusError; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusExtendedInfo.java index 5aee3d47e3da2..e250aa47601c4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusExtendedInfo.java @@ -5,44 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for additional information of operation status. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = OperationStatusExtendedInfo.class, - visible = true) -@JsonTypeName("OperationStatusExtendedInfo") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "OperationStatusJobExtendedInfo", value = OperationStatusJobExtendedInfo.class), - @JsonSubTypes.Type(name = "OperationStatusJobsExtendedInfo", value = OperationStatusJobsExtendedInfo.class), - @JsonSubTypes.Type( - name = "OperationStatusProvisionILRExtendedInfo", - value = OperationStatusProvisionIlrExtendedInfo.class), - @JsonSubTypes.Type( - name = "OperationStatusValidateOperationExtendedInfo", - value = OperationStatusValidateOperationExtendedInfo.class) }) @Immutable -public class OperationStatusExtendedInfo { +public class OperationStatusExtendedInfo implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "OperationStatusExtendedInfo"; /** * Creates an instance of OperationStatusExtendedInfo class. */ public OperationStatusExtendedInfo() { - this.objectType = "OperationStatusExtendedInfo"; } /** @@ -62,4 +45,71 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusExtendedInfo if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusExtendedInfo. + */ + public static OperationStatusExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("OperationStatusJobExtendedInfo".equals(discriminatorValue)) { + return OperationStatusJobExtendedInfo.fromJson(readerToUse.reset()); + } else if ("OperationStatusJobsExtendedInfo".equals(discriminatorValue)) { + return OperationStatusJobsExtendedInfo.fromJson(readerToUse.reset()); + } else if ("OperationStatusProvisionILRExtendedInfo".equals(discriminatorValue)) { + return OperationStatusProvisionIlrExtendedInfo.fromJson(readerToUse.reset()); + } else if ("OperationStatusValidateOperationExtendedInfo".equals(discriminatorValue)) { + return OperationStatusValidateOperationExtendedInfo.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static OperationStatusExtendedInfo fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusExtendedInfo deserializedOperationStatusExtendedInfo = new OperationStatusExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedOperationStatusExtendedInfo.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobExtendedInfo.java index c0ea8669b7809..2bb6ef5d33a90 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobExtendedInfo.java @@ -5,33 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Operation status job extended info. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = OperationStatusJobExtendedInfo.class, - visible = true) -@JsonTypeName("OperationStatusJobExtendedInfo") @Fluent public final class OperationStatusJobExtendedInfo extends OperationStatusExtendedInfo { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "OperationStatusJobExtendedInfo"; /* * ID of the job created for this protected item. */ - @JsonProperty(value = "jobId") private String jobId; /** @@ -78,6 +70,45 @@ public OperationStatusJobExtendedInfo withJobId(String jobId) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("jobId", this.jobId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusJobExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusJobExtendedInfo if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusJobExtendedInfo. + */ + public static OperationStatusJobExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusJobExtendedInfo deserializedOperationStatusJobExtendedInfo + = new OperationStatusJobExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedOperationStatusJobExtendedInfo.objectType = reader.getString(); + } else if ("jobId".equals(fieldName)) { + deserializedOperationStatusJobExtendedInfo.jobId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusJobExtendedInfo; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobsExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobsExtendedInfo.java index d35ae923534fd..9fd0ffce46a5e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobsExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusJobsExtendedInfo.java @@ -5,43 +5,32 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; /** * Operation status extended info for list of jobs. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = OperationStatusJobsExtendedInfo.class, - visible = true) -@JsonTypeName("OperationStatusJobsExtendedInfo") @Fluent public final class OperationStatusJobsExtendedInfo extends OperationStatusExtendedInfo { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "OperationStatusJobsExtendedInfo"; /* * IDs of the jobs created for the protected item. */ - @JsonProperty(value = "jobIds") private List jobIds; /* * Stores all the failed jobs along with the corresponding error codes. */ - @JsonProperty(value = "failedJobsError") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map failedJobsError; /** @@ -108,6 +97,51 @@ public OperationStatusJobsExtendedInfo withFailedJobsError(Map f */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeArrayField("jobIds", this.jobIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("failedJobsError", this.failedJobsError, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusJobsExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusJobsExtendedInfo if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusJobsExtendedInfo. + */ + public static OperationStatusJobsExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusJobsExtendedInfo deserializedOperationStatusJobsExtendedInfo + = new OperationStatusJobsExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedOperationStatusJobsExtendedInfo.objectType = reader.getString(); + } else if ("jobIds".equals(fieldName)) { + List jobIds = reader.readArray(reader1 -> reader1.getString()); + deserializedOperationStatusJobsExtendedInfo.jobIds = jobIds; + } else if ("failedJobsError".equals(fieldName)) { + Map failedJobsError = reader.readMap(reader1 -> reader1.getString()); + deserializedOperationStatusJobsExtendedInfo.failedJobsError = failedJobsError; + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusJobsExtendedInfo; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusProvisionIlrExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusProvisionIlrExtendedInfo.java index 5d13d8a111e7a..d5a4ff8bac59d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusProvisionIlrExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusProvisionIlrExtendedInfo.java @@ -5,33 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Operation status extended info for ILR provision action. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = OperationStatusProvisionIlrExtendedInfo.class, - visible = true) -@JsonTypeName("OperationStatusProvisionILRExtendedInfo") @Fluent public final class OperationStatusProvisionIlrExtendedInfo extends OperationStatusExtendedInfo { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "OperationStatusProvisionILRExtendedInfo"; /* * Target details for file / folder restore. */ - @JsonProperty(value = "recoveryTarget") private InstantItemRecoveryTarget recoveryTarget; /** @@ -78,9 +70,49 @@ public OperationStatusProvisionIlrExtendedInfo withRecoveryTarget(InstantItemRec */ @Override public void validate() { - super.validate(); if (recoveryTarget() != null) { recoveryTarget().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("recoveryTarget", this.recoveryTarget); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusProvisionIlrExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusProvisionIlrExtendedInfo if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusProvisionIlrExtendedInfo. + */ + public static OperationStatusProvisionIlrExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusProvisionIlrExtendedInfo deserializedOperationStatusProvisionIlrExtendedInfo + = new OperationStatusProvisionIlrExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedOperationStatusProvisionIlrExtendedInfo.objectType = reader.getString(); + } else if ("recoveryTarget".equals(fieldName)) { + deserializedOperationStatusProvisionIlrExtendedInfo.recoveryTarget + = InstantItemRecoveryTarget.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusProvisionIlrExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValidateOperationExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValidateOperationExtendedInfo.java index 985a25884358d..6cb38a174eaa0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValidateOperationExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValidateOperationExtendedInfo.java @@ -5,33 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Operation status extended info for ValidateOperation action. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = OperationStatusValidateOperationExtendedInfo.class, - visible = true) -@JsonTypeName("OperationStatusValidateOperationExtendedInfo") @Fluent public final class OperationStatusValidateOperationExtendedInfo extends OperationStatusExtendedInfo { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "OperationStatusValidateOperationExtendedInfo"; /* * Gets the validation operation response */ - @JsonProperty(value = "validateOperationResponse") private ValidateOperationResponse validateOperationResponse; /** @@ -79,9 +71,49 @@ public ValidateOperationResponse validateOperationResponse() { */ @Override public void validate() { - super.validate(); if (validateOperationResponse() != null) { validateOperationResponse().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("validateOperationResponse", this.validateOperationResponse); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusValidateOperationExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusValidateOperationExtendedInfo if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusValidateOperationExtendedInfo. + */ + public static OperationStatusValidateOperationExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusValidateOperationExtendedInfo deserializedOperationStatusValidateOperationExtendedInfo + = new OperationStatusValidateOperationExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedOperationStatusValidateOperationExtendedInfo.objectType = reader.getString(); + } else if ("validateOperationResponse".equals(fieldName)) { + deserializedOperationStatusValidateOperationExtendedInfo.validateOperationResponse + = ValidateOperationResponse.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusValidateOperationExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValues.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValues.java index 7a72249d36d20..f9d9bcac91f1f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValues.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationStatusValues.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public OperationStatusValues() { * @param name a name to look for. * @return the corresponding OperationStatusValues. */ - @JsonCreator public static OperationStatusValues fromString(String name) { return fromString(name, OperationStatusValues.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationType.java index 9ee38014494f7..aaf2afe4e71a1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public OperationType() { * @param name a name to look for. * @return the corresponding OperationType. */ - @JsonCreator public static OperationType fromString(String name) { return fromString(name, OperationType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationWorkerResponse.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationWorkerResponse.java index 2762761d54796..04ab94b7fde59 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationWorkerResponse.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OperationWorkerResponse.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -14,18 +17,15 @@ * This is the base class for operation result responses. */ @Fluent -public class OperationWorkerResponse { +public class OperationWorkerResponse implements JsonSerializable { /* * HTTP Status Code of the operation. */ - @JsonProperty(value = "statusCode") private HttpStatusCode statusCode; /* * HTTP headers associated with this operation. */ - @JsonProperty(value = "headers") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map> headers; /** @@ -81,4 +81,46 @@ public OperationWorkerResponse withHeaders(Map> headers) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("statusCode", this.statusCode == null ? null : this.statusCode.toString()); + jsonWriter.writeMapField("headers", this.headers, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationWorkerResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationWorkerResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationWorkerResponse. + */ + public static OperationWorkerResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationWorkerResponse deserializedOperationWorkerResponse = new OperationWorkerResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("statusCode".equals(fieldName)) { + deserializedOperationWorkerResponse.statusCode = HttpStatusCode.fromString(reader.getString()); + } else if ("headers".equals(fieldName)) { + Map> headers + = reader.readMap(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedOperationWorkerResponse.headers = headers; + } else { + reader.skipChildren(); + } + } + + return deserializedOperationWorkerResponse; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OverwriteOptions.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OverwriteOptions.java index e6b3151260aa3..b11ba9d980880 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OverwriteOptions.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/OverwriteOptions.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public OverwriteOptions() { * @param name a name to look for. * @return the corresponding OverwriteOptions. */ - @JsonCreator public static OverwriteOptions fromString(String name) { return fromString(name, OverwriteOptions.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PatchRecoveryPointInput.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PatchRecoveryPointInput.java new file mode 100644 index 0000000000000..713c7618ec4d1 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PatchRecoveryPointInput.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Recovery Point Contract for Update Recovery Point API. + */ +@Fluent +public final class PatchRecoveryPointInput implements JsonSerializable { + /* + * Properties of Recovery Point + */ + private PatchRecoveryPointPropertiesInput recoveryPointProperties; + + /** + * Creates an instance of PatchRecoveryPointInput class. + */ + public PatchRecoveryPointInput() { + } + + /** + * Get the recoveryPointProperties property: Properties of Recovery Point. + * + * @return the recoveryPointProperties value. + */ + public PatchRecoveryPointPropertiesInput recoveryPointProperties() { + return this.recoveryPointProperties; + } + + /** + * Set the recoveryPointProperties property: Properties of Recovery Point. + * + * @param recoveryPointProperties the recoveryPointProperties value to set. + * @return the PatchRecoveryPointInput object itself. + */ + public PatchRecoveryPointInput + withRecoveryPointProperties(PatchRecoveryPointPropertiesInput recoveryPointProperties) { + this.recoveryPointProperties = recoveryPointProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recoveryPointProperties() != null) { + recoveryPointProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("recoveryPointProperties", this.recoveryPointProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchRecoveryPointInput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchRecoveryPointInput if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PatchRecoveryPointInput. + */ + public static PatchRecoveryPointInput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchRecoveryPointInput deserializedPatchRecoveryPointInput = new PatchRecoveryPointInput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recoveryPointProperties".equals(fieldName)) { + deserializedPatchRecoveryPointInput.recoveryPointProperties + = PatchRecoveryPointPropertiesInput.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPatchRecoveryPointInput; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PatchRecoveryPointPropertiesInput.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PatchRecoveryPointPropertiesInput.java new file mode 100644 index 0000000000000..110fa71e01409 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PatchRecoveryPointPropertiesInput.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Recovery Point Properties Contract for Update Recovery Point API. + */ +@Fluent +public final class PatchRecoveryPointPropertiesInput implements JsonSerializable { + /* + * Expiry time of Recovery Point in UTC. + */ + private OffsetDateTime expiryTime; + + /** + * Creates an instance of PatchRecoveryPointPropertiesInput class. + */ + public PatchRecoveryPointPropertiesInput() { + } + + /** + * Get the expiryTime property: Expiry time of Recovery Point in UTC. + * + * @return the expiryTime value. + */ + public OffsetDateTime expiryTime() { + return this.expiryTime; + } + + /** + * Set the expiryTime property: Expiry time of Recovery Point in UTC. + * + * @param expiryTime the expiryTime value to set. + * @return the PatchRecoveryPointPropertiesInput object itself. + */ + public PatchRecoveryPointPropertiesInput withExpiryTime(OffsetDateTime expiryTime) { + this.expiryTime = expiryTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("expiryTime", + this.expiryTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiryTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchRecoveryPointPropertiesInput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchRecoveryPointPropertiesInput if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PatchRecoveryPointPropertiesInput. + */ + public static PatchRecoveryPointPropertiesInput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchRecoveryPointPropertiesInput deserializedPatchRecoveryPointPropertiesInput + = new PatchRecoveryPointPropertiesInput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("expiryTime".equals(fieldName)) { + deserializedPatchRecoveryPointPropertiesInput.expiryTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedPatchRecoveryPointPropertiesInput; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PointInTimeRange.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PointInTimeRange.java index a9783a5db0085..b2ba4471b97fe 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PointInTimeRange.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PointInTimeRange.java @@ -5,24 +5,28 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Provides details for log ranges. */ @Fluent -public final class PointInTimeRange { +public final class PointInTimeRange implements JsonSerializable { /* * Start time of the time range for log recovery. */ - @JsonProperty(value = "startTime") private OffsetDateTime startTime; /* * End time of the time range for log recovery. */ - @JsonProperty(value = "endTime") private OffsetDateTime endTime; /** @@ -78,4 +82,47 @@ public PointInTimeRange withEndTime(OffsetDateTime endTime) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PointInTimeRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PointInTimeRange if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PointInTimeRange. + */ + public static PointInTimeRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PointInTimeRange deserializedPointInTimeRange = new PointInTimeRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedPointInTimeRange.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedPointInTimeRange.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedPointInTimeRange; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PolicyType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PolicyType.java index a6cb545d57dce..8a28c146af4c1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PolicyType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PolicyType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -67,7 +66,6 @@ public PolicyType() { * @param name a name to look for. * @return the corresponding PolicyType. */ - @JsonCreator public static PolicyType fromString(String name) { return fromString(name, PolicyType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreBackupValidation.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreBackupValidation.java index d7fb1ce62ef8f..aa454a28d0232 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreBackupValidation.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreBackupValidation.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Pre-backup validation for Azure VM Workload provider. */ @Fluent -public final class PreBackupValidation { +public final class PreBackupValidation implements JsonSerializable { /* * Status of protectable item, i.e. InProgress,Succeeded,Failed */ - @JsonProperty(value = "status") private InquiryStatus status; /* * Error code of protectable item */ - @JsonProperty(value = "code") private String code; /* * Message corresponding to the error code for the protectable item */ - @JsonProperty(value = "message") private String message; /** @@ -103,4 +104,46 @@ public PreBackupValidation withMessage(String message) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreBackupValidation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreBackupValidation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PreBackupValidation. + */ + public static PreBackupValidation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreBackupValidation deserializedPreBackupValidation = new PreBackupValidation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPreBackupValidation.status = InquiryStatus.fromString(reader.getString()); + } else if ("code".equals(fieldName)) { + deserializedPreBackupValidation.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedPreBackupValidation.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPreBackupValidation; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreValidateEnableBackupRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreValidateEnableBackupRequest.java index 8221784f2f785..83c8e17f430b5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreValidateEnableBackupRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PreValidateEnableBackupRequest.java @@ -5,7 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Contract to validate if backup can be enabled on the given resource in a given vault and given configuration. @@ -15,29 +19,25 @@ * 3. Any VM related configuration passed in properties. */ @Fluent -public final class PreValidateEnableBackupRequest { +public final class PreValidateEnableBackupRequest implements JsonSerializable { /* * ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc */ - @JsonProperty(value = "resourceType") - private DataSourceType resourceType; + private DataSourceTypeAutoGenerated resourceType; /* * ARM Virtual Machine Id */ - @JsonProperty(value = "resourceId") private String resourceId; /* * ARM id of the Recovery Services Vault */ - @JsonProperty(value = "vaultId") private String vaultId; /* * Configuration of VM if any needs to be validated like OS type etc */ - @JsonProperty(value = "properties") private String properties; /** @@ -51,7 +51,7 @@ public PreValidateEnableBackupRequest() { * * @return the resourceType value. */ - public DataSourceType resourceType() { + public DataSourceTypeAutoGenerated resourceType() { return this.resourceType; } @@ -61,7 +61,7 @@ public DataSourceType resourceType() { * @param resourceType the resourceType value to set. * @return the PreValidateEnableBackupRequest object itself. */ - public PreValidateEnableBackupRequest withResourceType(DataSourceType resourceType) { + public PreValidateEnableBackupRequest withResourceType(DataSourceTypeAutoGenerated resourceType) { this.resourceType = resourceType; return this; } @@ -133,4 +133,51 @@ public PreValidateEnableBackupRequest withProperties(String properties) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceType", this.resourceType == null ? null : this.resourceType.toString()); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("vaultId", this.vaultId); + jsonWriter.writeStringField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreValidateEnableBackupRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreValidateEnableBackupRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PreValidateEnableBackupRequest. + */ + public static PreValidateEnableBackupRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreValidateEnableBackupRequest deserializedPreValidateEnableBackupRequest + = new PreValidateEnableBackupRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceType".equals(fieldName)) { + deserializedPreValidateEnableBackupRequest.resourceType + = DataSourceTypeAutoGenerated.fromString(reader.getString()); + } else if ("resourceId".equals(fieldName)) { + deserializedPreValidateEnableBackupRequest.resourceId = reader.getString(); + } else if ("vaultId".equals(fieldName)) { + deserializedPreValidateEnableBackupRequest.vaultId = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPreValidateEnableBackupRequest.properties = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPreValidateEnableBackupRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveRequest.java index 155ed8a12008a..ee2ec36aedc53 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveRequest.java @@ -6,43 +6,42 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Prepare DataMove Request. */ @Fluent -public final class PrepareDataMoveRequest { +public final class PrepareDataMoveRequest implements JsonSerializable { /* * ARM Id of target vault */ - @JsonProperty(value = "targetResourceId", required = true) private String targetResourceId; /* * Target Region */ - @JsonProperty(value = "targetRegion", required = true) private String targetRegion; /* * DataMove Level */ - @JsonProperty(value = "dataMoveLevel", required = true) private DataMoveLevel dataMoveLevel; /* * Source Container ArmIds * This needs to be populated only if DataMoveLevel is set to container */ - @JsonProperty(value = "sourceContainerArmIds") private List sourceContainerArmIds; /* * Ignore the artifacts which are already moved. */ - @JsonProperty(value = "ignoreMoved") private Boolean ignoreMoved; /** @@ -177,4 +176,55 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(PrepareDataMoveRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetResourceId", this.targetResourceId); + jsonWriter.writeStringField("targetRegion", this.targetRegion); + jsonWriter.writeStringField("dataMoveLevel", this.dataMoveLevel == null ? null : this.dataMoveLevel.toString()); + jsonWriter.writeArrayField("sourceContainerArmIds", this.sourceContainerArmIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("ignoreMoved", this.ignoreMoved); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrepareDataMoveRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrepareDataMoveRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrepareDataMoveRequest. + */ + public static PrepareDataMoveRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrepareDataMoveRequest deserializedPrepareDataMoveRequest = new PrepareDataMoveRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetResourceId".equals(fieldName)) { + deserializedPrepareDataMoveRequest.targetResourceId = reader.getString(); + } else if ("targetRegion".equals(fieldName)) { + deserializedPrepareDataMoveRequest.targetRegion = reader.getString(); + } else if ("dataMoveLevel".equals(fieldName)) { + deserializedPrepareDataMoveRequest.dataMoveLevel = DataMoveLevel.fromString(reader.getString()); + } else if ("sourceContainerArmIds".equals(fieldName)) { + List sourceContainerArmIds = reader.readArray(reader1 -> reader1.getString()); + deserializedPrepareDataMoveRequest.sourceContainerArmIds = sourceContainerArmIds; + } else if ("ignoreMoved".equals(fieldName)) { + deserializedPrepareDataMoveRequest.ignoreMoved = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedPrepareDataMoveRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveResponse.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveResponse.java index bf3e9962c9530..c89539ba174ea 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveResponse.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrepareDataMoveResponse.java @@ -5,43 +5,32 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.VaultStorageConfigOperationResultResponseInner; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; import java.util.Map; /** * Prepare DataMove Response. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = PrepareDataMoveResponse.class, - visible = true) -@JsonTypeName("PrepareDataMoveResponse") @Fluent public final class PrepareDataMoveResponse extends VaultStorageConfigOperationResultResponseInner { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "PrepareDataMoveResponse"; /* * Co-relationId for move operation */ - @JsonProperty(value = "correlationId") private String correlationId; /* * Source Vault Properties */ - @JsonProperty(value = "sourceVaultProperties") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map sourceVaultProperties; /** @@ -108,6 +97,49 @@ public PrepareDataMoveResponse withSourceVaultProperties(Map sou */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeStringField("correlationId", this.correlationId); + jsonWriter.writeMapField("sourceVaultProperties", this.sourceVaultProperties, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrepareDataMoveResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrepareDataMoveResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrepareDataMoveResponse. + */ + public static PrepareDataMoveResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrepareDataMoveResponse deserializedPrepareDataMoveResponse = new PrepareDataMoveResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedPrepareDataMoveResponse.objectType = reader.getString(); + } else if ("correlationId".equals(fieldName)) { + deserializedPrepareDataMoveResponse.correlationId = reader.getString(); + } else if ("sourceVaultProperties".equals(fieldName)) { + Map sourceVaultProperties = reader.readMap(reader1 -> reader1.getString()); + deserializedPrepareDataMoveResponse.sourceVaultProperties = sourceVaultProperties; + } else { + reader.skipChildren(); + } + } + + return deserializedPrepareDataMoveResponse; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpoint.java index abbbd26422a64..a91ce2f112630 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpoint.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Private Endpoint network resource that is linked to the Private Endpoint connection. */ @Fluent -public final class PrivateEndpoint { +public final class PrivateEndpoint implements JsonSerializable { /* * Gets or sets id */ - @JsonProperty(value = "id") private String id; /** @@ -51,4 +54,40 @@ public PrivateEndpoint withId(String id) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpoint. + */ + public static PrivateEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpoint deserializedPrivateEndpoint = new PrivateEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpoint.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpoint; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnection.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnection.java index 79a8d4abdb7e8..3bdbd9101a546 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnection.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnection.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Private Endpoint Connection Response Properties. */ @Fluent -public final class PrivateEndpointConnection { +public final class PrivateEndpointConnection implements JsonSerializable { /* * Gets or sets provisioning state of the private endpoint connection */ - @JsonProperty(value = "provisioningState") private ProvisioningState provisioningState; /* * Gets or sets private endpoint associated with the private endpoint connection */ - @JsonProperty(value = "privateEndpoint") private PrivateEndpoint privateEndpoint; /* * Group Ids for the Private Endpoint */ - @JsonProperty(value = "groupIds") private List groupIds; /* * Gets or sets private link service connection state */ - @JsonProperty(value = "privateLinkServiceConnectionState") private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; /** @@ -137,4 +137,55 @@ public void validate() { privateLinkServiceConnectionState().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + jsonWriter.writeArrayField("groupIds", this.groupIds, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnection if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointConnection. + */ + public static PrivateEndpointConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnection deserializedPrivateEndpointConnection = new PrivateEndpointConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnection.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnection.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("groupIds".equals(fieldName)) { + List groupIds + = reader.readArray(reader1 -> VaultSubResourceType.fromString(reader1.getString())); + deserializedPrivateEndpointConnection.groupIds = groupIds; + } else if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnection.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnection; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnectionStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnectionStatus.java index eab5389263a52..3112a097b82ca 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnectionStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateEndpointConnectionStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public PrivateEndpointConnectionStatus() { * @param name a name to look for. * @return the corresponding PrivateEndpointConnectionStatus. */ - @JsonCreator public static PrivateEndpointConnectionStatus fromString(String name) { return fromString(name, PrivateEndpointConnectionStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateLinkServiceConnectionState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateLinkServiceConnectionState.java index 2c337b3f1acd2..fee9386686aa0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateLinkServiceConnectionState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/PrivateLinkServiceConnectionState.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Private Link Service Connection State. */ @Fluent -public final class PrivateLinkServiceConnectionState { +public final class PrivateLinkServiceConnectionState implements JsonSerializable { /* * Gets or sets the status */ - @JsonProperty(value = "status") private PrivateEndpointConnectionStatus status; /* * Gets or sets description */ - @JsonProperty(value = "description") private String description; /* * Gets or sets actions required */ - @JsonProperty(value = "actionsRequired") private String actionRequired; /** @@ -103,4 +104,48 @@ public PrivateLinkServiceConnectionState withActionRequired(String actionRequire */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("actionsRequired", this.actionRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionState if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkServiceConnectionState. + */ + public static PrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionState deserializedPrivateLinkServiceConnectionState + = new PrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.status + = PrivateEndpointConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.actionRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionState; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainer.java index ebdb15ad00e42..cc0fcf886cf49 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainer.java @@ -5,64 +5,49 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Protectable Container Class. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectableContainerType", - defaultImpl = ProtectableContainer.class, - visible = true) -@JsonTypeName("ProtectableContainer") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "StorageContainer", value = AzureStorageProtectableContainer.class), - @JsonSubTypes.Type(name = "VMAppContainer", value = AzureVMAppContainerProtectableContainer.class) }) @Fluent -public class ProtectableContainer { +public class ProtectableContainer implements JsonSerializable { /* * 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 */ - @JsonTypeId - @JsonProperty(value = "protectableContainerType", required = true) - private ProtectableContainerType protectableContainerType; + private ProtectableContainerType protectableContainerType + = ProtectableContainerType.fromString("ProtectableContainer"); /* * Friendly name of the container. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Type of backup management for the container. */ - @JsonProperty(value = "backupManagementType") private BackupManagementType backupManagementType; /* * Status of health of the container. */ - @JsonProperty(value = "healthStatus") private String healthStatus; /* * Fabric Id of the container such as ARM Id. */ - @JsonProperty(value = "containerId") private String containerId; /** * Creates an instance of ProtectableContainer class. */ public ProtectableContainer() { - this.protectableContainerType = ProtectableContainerType.fromString("ProtectableContainer"); } /** @@ -163,4 +148,83 @@ public ProtectableContainer withContainerId(String containerId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("protectableContainerType", + this.protectableContainerType == null ? null : this.protectableContainerType.toString()); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("backupManagementType", + this.backupManagementType == null ? null : this.backupManagementType.toString()); + jsonWriter.writeStringField("healthStatus", this.healthStatus); + jsonWriter.writeStringField("containerId", this.containerId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectableContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectableContainer if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectableContainer. + */ + public static ProtectableContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectableContainerType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("StorageContainer".equals(discriminatorValue)) { + return AzureStorageProtectableContainer.fromJson(readerToUse.reset()); + } else if ("VMAppContainer".equals(discriminatorValue)) { + return AzureVMAppContainerProtectableContainer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ProtectableContainer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectableContainer deserializedProtectableContainer = new ProtectableContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectableContainerType".equals(fieldName)) { + deserializedProtectableContainer.protectableContainerType + = ProtectableContainerType.fromString(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedProtectableContainer.friendlyName = reader.getString(); + } else if ("backupManagementType".equals(fieldName)) { + deserializedProtectableContainer.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("healthStatus".equals(fieldName)) { + deserializedProtectableContainer.healthStatus = reader.getString(); + } else if ("containerId".equals(fieldName)) { + deserializedProtectableContainer.containerId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectableContainer; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerResourceList.java index 8f1d9d574ebdc..ac48119678a17 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectableContainerResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class ProtectableContainerResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,50 @@ public ProtectableContainerResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectableContainerResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectableContainerResourceList if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectableContainerResourceList. + */ + public static ProtectableContainerResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectableContainerResourceList deserializedProtectableContainerResourceList + = new ProtectableContainerResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedProtectableContainerResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProtectableContainerResourceInner.fromJson(reader1)); + deserializedProtectableContainerResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedProtectableContainerResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerType.java index 0f34e89f0e419..5c65412f40f2b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectableContainerType.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Type of the container. The value of this property for * 1. Compute Azure VM is Microsoft.Compute/virtualMachines @@ -118,7 +115,6 @@ public enum ProtectableContainerType { * @param value the serialized value to parse. * @return the parsed ProtectableContainerType object, or null if unable to parse. */ - @JsonCreator public static ProtectableContainerType fromString(String value) { if (value == null) { return null; @@ -135,7 +131,6 @@ public static ProtectableContainerType fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItem.java index b268abb3932b9..8d3902ac9d1ab 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItem.java @@ -5,153 +5,120 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Base class for backup items. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectedItemType", - defaultImpl = ProtectedItem.class, - visible = true) -@JsonTypeName("ProtectedItem") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureFileShareProtectedItem", value = AzureFileshareProtectedItem.class), - @JsonSubTypes.Type(name = "AzureIaaSVMProtectedItem", value = AzureIaaSvmProtectedItem.class), - @JsonSubTypes.Type(name = "Microsoft.Sql/servers/databases", value = AzureSqlProtectedItem.class), - @JsonSubTypes.Type(name = "AzureVmWorkloadProtectedItem", value = AzureVmWorkloadProtectedItem.class), - @JsonSubTypes.Type(name = "DPMProtectedItem", value = DpmProtectedItem.class), - @JsonSubTypes.Type(name = "GenericProtectedItem", value = GenericProtectedItem.class), - @JsonSubTypes.Type(name = "MabFileFolderProtectedItem", value = MabFileFolderProtectedItem.class) }) @Fluent -public class ProtectedItem { +public class ProtectedItem implements JsonSerializable { /* * backup item type. */ - @JsonTypeId - @JsonProperty(value = "protectedItemType", required = true) - private String protectedItemType; + private String protectedItemType = "ProtectedItem"; /* * Type of backup management for the backed up item. */ - @JsonProperty(value = "backupManagementType", access = JsonProperty.Access.WRITE_ONLY) private BackupManagementType backupManagementType; /* * Type of workload this item represents. */ - @JsonProperty(value = "workloadType", access = JsonProperty.Access.WRITE_ONLY) - private DataSourceType workloadType; + private DataSourceTypeAutoGenerated3 workloadType; /* * Unique name of container */ - @JsonProperty(value = "containerName") private String containerName; /* * ARM ID of the resource to be backed up. */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /* * ID of the backup policy with which this item is backed up. */ - @JsonProperty(value = "policyId") private String policyId; /* * Timestamp when the last (latest) backup copy was created for this backup item. */ - @JsonProperty(value = "lastRecoveryPoint") private OffsetDateTime lastRecoveryPoint; /* * Name of the backup set the backup item belongs to */ - @JsonProperty(value = "backupSetName") private String backupSetName; /* * Create mode to indicate recovery of existing soft deleted data source or creation of new data source. */ - @JsonProperty(value = "createMode") private CreateMode createMode; /* * Time for deferred deletion in UTC */ - @JsonProperty(value = "deferredDeleteTimeInUTC") private OffsetDateTime deferredDeleteTimeInUtc; /* * Flag to identify whether the DS is scheduled for deferred delete */ - @JsonProperty(value = "isScheduledForDeferredDelete") private Boolean isScheduledForDeferredDelete; /* * Time remaining before the DS marked for deferred delete is permanently deleted */ - @JsonProperty(value = "deferredDeleteTimeRemaining") private String deferredDeleteTimeRemaining; /* * Flag to identify whether the deferred deleted DS is to be purged soon */ - @JsonProperty(value = "isDeferredDeleteScheduleUpcoming") private Boolean isDeferredDeleteScheduleUpcoming; /* * Flag to identify that deferred deleted DS is to be moved into Pause state */ - @JsonProperty(value = "isRehydrate") private Boolean isRehydrate; /* * ResourceGuardOperationRequests on which LAC check will be performed */ - @JsonProperty(value = "resourceGuardOperationRequests") private List resourceGuardOperationRequests; /* * Flag to identify whether datasource is protected in archive */ - @JsonProperty(value = "isArchiveEnabled") private Boolean isArchiveEnabled; /* * Name of the policy used for protection */ - @JsonProperty(value = "policyName") private String policyName; /* * Soft delete retention period in days */ - @JsonProperty(value = "softDeleteRetentionPeriodInDays") private Integer softDeleteRetentionPeriod; /* * ID of the vault which protects this item */ - @JsonProperty(value = "vaultId", access = JsonProperty.Access.WRITE_ONLY) private String vaultId; /** * Creates an instance of ProtectedItem class. */ public ProtectedItem() { - this.protectedItemType = "ProtectedItem"; } /** @@ -172,15 +139,37 @@ public BackupManagementType backupManagementType() { return this.backupManagementType; } + /** + * Set the backupManagementType property: Type of backup management for the backed up item. + * + * @param backupManagementType the backupManagementType value to set. + * @return the ProtectedItem object itself. + */ + ProtectedItem withBackupManagementType(BackupManagementType backupManagementType) { + this.backupManagementType = backupManagementType; + return this; + } + /** * Get the workloadType property: Type of workload this item represents. * * @return the workloadType value. */ - public DataSourceType workloadType() { + public DataSourceTypeAutoGenerated3 workloadType() { return this.workloadType; } + /** + * Set the workloadType property: Type of workload this item represents. + * + * @param workloadType the workloadType value to set. + * @return the ProtectedItem object itself. + */ + ProtectedItem withWorkloadType(DataSourceTypeAutoGenerated3 workloadType) { + this.workloadType = workloadType; + return this; + } + /** * Get the containerName property: Unique name of container. * @@ -500,6 +489,17 @@ public String vaultId() { return this.vaultId; } + /** + * Set the vaultId property: ID of the vault which protects this item. + * + * @param vaultId the vaultId value to set. + * @return the ProtectedItem object itself. + */ + ProtectedItem withVaultId(String vaultId) { + this.vaultId = vaultId; + return this; + } + /** * Validates the instance. * @@ -507,4 +507,157 @@ public String vaultId() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("protectedItemType", this.protectedItemType); + jsonWriter.writeStringField("containerName", this.containerName); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("policyId", this.policyId); + jsonWriter.writeStringField("lastRecoveryPoint", + this.lastRecoveryPoint == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastRecoveryPoint)); + jsonWriter.writeStringField("backupSetName", this.backupSetName); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeStringField("deferredDeleteTimeInUTC", + this.deferredDeleteTimeInUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.deferredDeleteTimeInUtc)); + jsonWriter.writeBooleanField("isScheduledForDeferredDelete", this.isScheduledForDeferredDelete); + jsonWriter.writeStringField("deferredDeleteTimeRemaining", this.deferredDeleteTimeRemaining); + jsonWriter.writeBooleanField("isDeferredDeleteScheduleUpcoming", this.isDeferredDeleteScheduleUpcoming); + jsonWriter.writeBooleanField("isRehydrate", this.isRehydrate); + jsonWriter.writeArrayField("resourceGuardOperationRequests", this.resourceGuardOperationRequests, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isArchiveEnabled", this.isArchiveEnabled); + jsonWriter.writeStringField("policyName", this.policyName); + jsonWriter.writeNumberField("softDeleteRetentionPeriodInDays", this.softDeleteRetentionPeriod); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectedItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectedItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectedItem. + */ + public static ProtectedItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectedItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureFileShareProtectedItem".equals(discriminatorValue)) { + return AzureFileshareProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureIaaSVMProtectedItem".equals(discriminatorValue)) { + return AzureIaaSvmProtectedItem.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("Microsoft.ClassicCompute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSClassicComputeVMProtectedItem.fromJson(readerToUse.reset()); + } else if ("Microsoft.Compute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSComputeVMProtectedItem.fromJson(readerToUse.reset()); + } else if ("Microsoft.Sql/servers/databases".equals(discriminatorValue)) { + return AzureSqlProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadProtectedItem".equals(discriminatorValue)) { + return AzureVmWorkloadProtectedItem.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureVmWorkloadSAPAseDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadOracleDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadOracleDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadAnyDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadAnyDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadSAPHanaDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadSAPHanaDBInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDBInstanceProtectedItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadSQLDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSqlDatabaseProtectedItem.fromJson(readerToUse.reset()); + } else if ("DPMProtectedItem".equals(discriminatorValue)) { + return DpmProtectedItem.fromJson(readerToUse.reset()); + } else if ("GenericProtectedItem".equals(discriminatorValue)) { + return GenericProtectedItem.fromJson(readerToUse.reset()); + } else if ("MabFileFolderProtectedItem".equals(discriminatorValue)) { + return MabFileFolderProtectedItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ProtectedItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectedItem deserializedProtectedItem = new ProtectedItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectedItemType".equals(fieldName)) { + deserializedProtectedItem.protectedItemType = reader.getString(); + } else if ("backupManagementType".equals(fieldName)) { + deserializedProtectedItem.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("workloadType".equals(fieldName)) { + deserializedProtectedItem.workloadType + = DataSourceTypeAutoGenerated3.fromString(reader.getString()); + } else if ("containerName".equals(fieldName)) { + deserializedProtectedItem.containerName = reader.getString(); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedProtectedItem.sourceResourceId = reader.getString(); + } else if ("policyId".equals(fieldName)) { + deserializedProtectedItem.policyId = reader.getString(); + } else if ("lastRecoveryPoint".equals(fieldName)) { + deserializedProtectedItem.lastRecoveryPoint = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("backupSetName".equals(fieldName)) { + deserializedProtectedItem.backupSetName = reader.getString(); + } else if ("createMode".equals(fieldName)) { + deserializedProtectedItem.createMode = CreateMode.fromString(reader.getString()); + } else if ("deferredDeleteTimeInUTC".equals(fieldName)) { + deserializedProtectedItem.deferredDeleteTimeInUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("isScheduledForDeferredDelete".equals(fieldName)) { + deserializedProtectedItem.isScheduledForDeferredDelete = reader.getNullable(JsonReader::getBoolean); + } else if ("deferredDeleteTimeRemaining".equals(fieldName)) { + deserializedProtectedItem.deferredDeleteTimeRemaining = reader.getString(); + } else if ("isDeferredDeleteScheduleUpcoming".equals(fieldName)) { + deserializedProtectedItem.isDeferredDeleteScheduleUpcoming + = reader.getNullable(JsonReader::getBoolean); + } else if ("isRehydrate".equals(fieldName)) { + deserializedProtectedItem.isRehydrate = reader.getNullable(JsonReader::getBoolean); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedProtectedItem.resourceGuardOperationRequests = resourceGuardOperationRequests; + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedProtectedItem.isArchiveEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("policyName".equals(fieldName)) { + deserializedProtectedItem.policyName = reader.getString(); + } else if ("softDeleteRetentionPeriodInDays".equals(fieldName)) { + deserializedProtectedItem.softDeleteRetentionPeriod = reader.getNullable(JsonReader::getInt); + } else if ("vaultId".equals(fieldName)) { + deserializedProtectedItem.vaultId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectedItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemHealthStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemHealthStatus.java index dbbb5676d4780..f595ef0ff161c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemHealthStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemHealthStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public ProtectedItemHealthStatus() { * @param name a name to look for. * @return the corresponding ProtectedItemHealthStatus. */ - @JsonCreator public static ProtectedItemHealthStatus fromString(String name) { return fromString(name, ProtectedItemHealthStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemResourceList.java index 7d7ddc258c94a..a49e92dfb134d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectedItemResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class ProtectedItemResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,49 @@ public ProtectedItemResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectedItemResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectedItemResourceList if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectedItemResourceList. + */ + public static ProtectedItemResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectedItemResourceList deserializedProtectedItemResourceList = new ProtectedItemResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedProtectedItemResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProtectedItemResourceInner.fromJson(reader1)); + deserializedProtectedItemResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedProtectedItemResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemState.java index eb20c657db994..7b4fa49a2a856 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectedItemState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -62,7 +61,6 @@ public ProtectedItemState() { * @param name a name to look for. * @return the corresponding ProtectedItemState. */ - @JsonCreator public static ProtectedItemState fromString(String name) { return fromString(name, ProtectedItemState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainer.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainer.java index ade1a45502e59..c2537e069c68d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainer.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainer.java @@ -5,76 +5,55 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for container with backup items. Containers with specific workloads are derived from this class. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "containerType", - defaultImpl = ProtectionContainer.class, - visible = true) -@JsonTypeName("ProtectionContainer") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "DPMContainer", value = DpmContainer.class), - @JsonSubTypes.Type(name = "IaasVMContainer", value = IaaSvmContainer.class), - @JsonSubTypes.Type(name = "AzureWorkloadContainer", value = AzureWorkloadContainer.class), - @JsonSubTypes.Type(name = "AzureSqlContainer", value = AzureSqlContainer.class), - @JsonSubTypes.Type(name = "StorageContainer", value = AzureStorageContainer.class), - @JsonSubTypes.Type(name = "GenericContainer", value = GenericContainer.class), - @JsonSubTypes.Type(name = "Windows", value = MabContainer.class) }) @Fluent -public class ProtectionContainer { +public class ProtectionContainer implements JsonSerializable { /* - * Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2. + * 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 */ - @JsonTypeId - @JsonProperty(value = "containerType", required = true) - private ProtectableContainerType containerType; + private ProtectableContainerType containerType = ProtectableContainerType.fromString("ProtectionContainer"); /* * Friendly name of the container. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * Type of backup management for the container. */ - @JsonProperty(value = "backupManagementType") private BackupManagementType backupManagementType; /* * Status of registration of the container with the Recovery Services Vault. */ - @JsonProperty(value = "registrationStatus") private String registrationStatus; /* * Status of health of the container. */ - @JsonProperty(value = "healthStatus") private String healthStatus; /* * Type of the protectable object associated with this container */ - @JsonProperty(value = "protectableObjectType") private String protectableObjectType; /** * Creates an instance of ProtectionContainer class. */ public ProtectionContainer() { - this.containerType = ProtectableContainerType.fromString("ProtectionContainer"); } /** @@ -197,4 +176,105 @@ public ProtectionContainer withProtectableObjectType(String protectableObjectTyp */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerType", this.containerType == null ? null : this.containerType.toString()); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("backupManagementType", + this.backupManagementType == null ? null : this.backupManagementType.toString()); + jsonWriter.writeStringField("registrationStatus", this.registrationStatus); + jsonWriter.writeStringField("healthStatus", this.healthStatus); + jsonWriter.writeStringField("protectableObjectType", this.protectableObjectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionContainer if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectionContainer. + */ + public static ProtectionContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("containerType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("DPMContainer".equals(discriminatorValue)) { + return DpmContainer.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureBackupServerContainer".equals(discriminatorValue)) { + return AzureBackupServerContainer.fromJson(readerToUse.reset()); + } else if ("IaasVMContainer".equals(discriminatorValue)) { + return IaaSvmContainer.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("Microsoft.ClassicCompute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSClassicComputeVMContainer.fromJson(readerToUse.reset()); + } else if ("Microsoft.Compute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSComputeVMContainer.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadContainer".equals(discriminatorValue)) { + return AzureWorkloadContainer.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("SQLAGWorkLoadContainer".equals(discriminatorValue)) { + return AzureSqlagWorkloadContainerProtectionContainer.fromJson(readerToUse.reset()); + } else if ("VMAppContainer".equals(discriminatorValue)) { + return AzureVMAppContainerProtectionContainer.fromJson(readerToUse.reset()); + } else if ("AzureSqlContainer".equals(discriminatorValue)) { + return AzureSqlContainer.fromJson(readerToUse.reset()); + } else if ("StorageContainer".equals(discriminatorValue)) { + return AzureStorageContainer.fromJson(readerToUse.reset()); + } else if ("GenericContainer".equals(discriminatorValue)) { + return GenericContainer.fromJson(readerToUse.reset()); + } else if ("Windows".equals(discriminatorValue)) { + return MabContainer.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ProtectionContainer fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionContainer deserializedProtectionContainer = new ProtectionContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("containerType".equals(fieldName)) { + deserializedProtectionContainer.containerType + = ProtectableContainerType.fromString(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedProtectionContainer.friendlyName = reader.getString(); + } else if ("backupManagementType".equals(fieldName)) { + deserializedProtectionContainer.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("registrationStatus".equals(fieldName)) { + deserializedProtectionContainer.registrationStatus = reader.getString(); + } else if ("healthStatus".equals(fieldName)) { + deserializedProtectionContainer.healthStatus = reader.getString(); + } else if ("protectableObjectType".equals(fieldName)) { + deserializedProtectionContainer.protectableObjectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionContainer; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainerResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainerResourceList.java index 7ff9af0f9c4e3..9a506f66e6cd7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainerResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionContainerResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionContainerResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class ProtectionContainerResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,50 @@ public ProtectionContainerResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionContainerResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionContainerResourceList if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectionContainerResourceList. + */ + public static ProtectionContainerResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionContainerResourceList deserializedProtectionContainerResourceList + = new ProtectionContainerResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedProtectionContainerResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProtectionContainerResourceInner.fromJson(reader1)); + deserializedProtectionContainerResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionContainerResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntent.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntent.java index aa9d9ca3759a5..1f72fbf317226 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntent.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntent.java @@ -5,71 +5,51 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for backup ProtectionIntent. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "protectionIntentItemType", - defaultImpl = ProtectionIntent.class, - visible = true) -@JsonTypeName("ProtectionIntent") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "RecoveryServiceVaultItem", value = AzureRecoveryServiceVaultProtectionIntent.class), - @JsonSubTypes.Type(name = "AzureResourceItem", value = AzureResourceProtectionIntent.class), - @JsonSubTypes.Type( - name = "AzureWorkloadContainerAutoProtectionIntent", - value = AzureWorkloadContainerAutoProtectionIntent.class) }) @Fluent -public class ProtectionIntent { +public class ProtectionIntent implements JsonSerializable { /* * backup protectionIntent type. */ - @JsonTypeId - @JsonProperty(value = "protectionIntentItemType", required = true) - private ProtectionIntentItemType protectionIntentItemType; + private ProtectionIntentItemType protectionIntentItemType = ProtectionIntentItemType.fromString("ProtectionIntent"); /* * Type of backup management for the backed up item. */ - @JsonProperty(value = "backupManagementType") private BackupManagementType backupManagementType; /* * ARM ID of the resource to be backed up. */ - @JsonProperty(value = "sourceResourceId") private String sourceResourceId; /* * ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId */ - @JsonProperty(value = "itemId") private String itemId; /* * ID of the backup policy with which this item is backed up. */ - @JsonProperty(value = "policyId") private String policyId; /* * Backup state of this backup item. */ - @JsonProperty(value = "protectionState") private ProtectionStatus protectionState; /** * Creates an instance of ProtectionIntent class. */ public ProtectionIntent() { - this.protectionIntentItemType = ProtectionIntentItemType.fromString("ProtectionIntent"); } /** @@ -188,4 +168,93 @@ public ProtectionIntent withProtectionState(ProtectionStatus protectionState) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("protectionIntentItemType", + this.protectionIntentItemType == null ? null : this.protectionIntentItemType.toString()); + jsonWriter.writeStringField("backupManagementType", + this.backupManagementType == null ? null : this.backupManagementType.toString()); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("itemId", this.itemId); + jsonWriter.writeStringField("policyId", this.policyId); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionIntent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionIntent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectionIntent. + */ + public static ProtectionIntent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectionIntentItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("RecoveryServiceVaultItem".equals(discriminatorValue)) { + return AzureRecoveryServiceVaultProtectionIntent.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadAutoProtectionIntent".equals(discriminatorValue)) { + return AzureWorkloadAutoProtectionIntent.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLAutoProtectionIntent".equals(discriminatorValue)) { + return AzureWorkloadSqlAutoProtectionIntent.fromJson(readerToUse.reset()); + } else if ("AzureResourceItem".equals(discriminatorValue)) { + return AzureResourceProtectionIntent.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadContainerAutoProtectionIntent".equals(discriminatorValue)) { + return AzureWorkloadContainerAutoProtectionIntent.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ProtectionIntent fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionIntent deserializedProtectionIntent = new ProtectionIntent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectionIntentItemType".equals(fieldName)) { + deserializedProtectionIntent.protectionIntentItemType + = ProtectionIntentItemType.fromString(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedProtectionIntent.backupManagementType + = BackupManagementType.fromString(reader.getString()); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedProtectionIntent.sourceResourceId = reader.getString(); + } else if ("itemId".equals(fieldName)) { + deserializedProtectionIntent.itemId = reader.getString(); + } else if ("policyId".equals(fieldName)) { + deserializedProtectionIntent.policyId = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedProtectionIntent.protectionState = ProtectionStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionIntent; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentItemType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentItemType.java index 0852e5400cb85..8eca483685399 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentItemType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentItemType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -60,7 +59,6 @@ public ProtectionIntentItemType() { * @param name a name to look for. * @return the corresponding ProtectionIntentItemType. */ - @JsonCreator public static ProtectionIntentItemType fromString(String name) { return fromString(name, ProtectionIntentItemType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentResourceList.java index ee1b97b150acb..fa2d818e435d7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionIntentResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionIntentResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class ProtectionIntentResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,49 @@ public ProtectionIntentResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionIntentResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionIntentResourceList if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectionIntentResourceList. + */ + public static ProtectionIntentResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionIntentResourceList deserializedProtectionIntentResourceList = new ProtectionIntentResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedProtectionIntentResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProtectionIntentResourceInner.fromJson(reader1)); + deserializedProtectionIntentResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionIntentResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicy.java index e9a89fa4a9bca..6964bf54410b0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicy.java @@ -5,55 +5,38 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Base class for backup policy. Workload-specific backup policies are derived from this class. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "backupManagementType", - defaultImpl = ProtectionPolicy.class, - visible = true) -@JsonTypeName("ProtectionPolicy") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureWorkload", value = AzureVmWorkloadProtectionPolicy.class), - @JsonSubTypes.Type(name = "AzureStorage", value = AzureFileShareProtectionPolicy.class), - @JsonSubTypes.Type(name = "AzureIaasVM", value = AzureIaaSvmProtectionPolicy.class), - @JsonSubTypes.Type(name = "AzureSql", value = AzureSqlProtectionPolicy.class), - @JsonSubTypes.Type(name = "GenericProtectionPolicy", value = GenericProtectionPolicy.class), - @JsonSubTypes.Type(name = "MAB", value = MabProtectionPolicy.class) }) @Fluent -public class ProtectionPolicy { +public class ProtectionPolicy implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "backupManagementType", required = true) - private String backupManagementType; + private String backupManagementType = "ProtectionPolicy"; /* * Number of items associated with this policy. */ - @JsonProperty(value = "protectedItemsCount") private Integer protectedItemsCount; /* * ResourceGuard Operation Requests */ - @JsonProperty(value = "resourceGuardOperationRequests") private List resourceGuardOperationRequests; /** * Creates an instance of ProtectionPolicy class. */ public ProtectionPolicy() { - this.backupManagementType = "ProtectionPolicy"; } /** @@ -113,4 +96,83 @@ public ProtectionPolicy withResourceGuardOperationRequests(List resource */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeNumberField("protectedItemsCount", this.protectedItemsCount); + jsonWriter.writeArrayField("resourceGuardOperationRequests", this.resourceGuardOperationRequests, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectionPolicy. + */ + public static ProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("backupManagementType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureWorkload".equals(discriminatorValue)) { + return AzureVmWorkloadProtectionPolicy.fromJson(readerToUse.reset()); + } else if ("AzureStorage".equals(discriminatorValue)) { + return AzureFileShareProtectionPolicy.fromJson(readerToUse.reset()); + } else if ("AzureIaasVM".equals(discriminatorValue)) { + return AzureIaaSvmProtectionPolicy.fromJson(readerToUse.reset()); + } else if ("AzureSql".equals(discriminatorValue)) { + return AzureSqlProtectionPolicy.fromJson(readerToUse.reset()); + } else if ("GenericProtectionPolicy".equals(discriminatorValue)) { + return GenericProtectionPolicy.fromJson(readerToUse.reset()); + } else if ("MAB".equals(discriminatorValue)) { + return MabProtectionPolicy.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ProtectionPolicy fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionPolicy deserializedProtectionPolicy = new ProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupManagementType".equals(fieldName)) { + deserializedProtectionPolicy.backupManagementType = reader.getString(); + } else if ("protectedItemsCount".equals(fieldName)) { + deserializedProtectionPolicy.protectedItemsCount = reader.getNullable(JsonReader::getInt); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedProtectionPolicy.resourceGuardOperationRequests = resourceGuardOperationRequests; + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicyResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicyResourceList.java index 37aaa642afd91..a672d0d055269 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicyResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionPolicyResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionPolicyResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class ProtectionPolicyResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,49 @@ public ProtectionPolicyResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionPolicyResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionPolicyResourceList if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProtectionPolicyResourceList. + */ + public static ProtectionPolicyResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionPolicyResourceList deserializedProtectionPolicyResourceList = new ProtectionPolicyResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedProtectionPolicyResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProtectionPolicyResourceInner.fromJson(reader1)); + deserializedProtectionPolicyResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionPolicyResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionState.java index 3d5c388b374c1..5de6a9996c53e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -62,7 +61,6 @@ public ProtectionState() { * @param name a name to look for. * @return the corresponding ProtectionState. */ - @JsonCreator public static ProtectionState fromString(String name) { return fromString(name, ProtectionState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionStatus.java index 21a5cad31c386..f292c0523664b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProtectionStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public ProtectionStatus() { * @param name a name to look for. * @return the corresponding ProtectionStatus. */ - @JsonCreator public static ProtectionStatus fromString(String name) { return fromString(name, ProtectionStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProvisioningState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProvisioningState.java index 0e6e1a9658f4d..13915b38c12a7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProvisioningState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public ProvisioningState() { * @param name a name to look for. * @return the corresponding ProvisioningState. */ - @JsonCreator public static ProvisioningState fromString(String name) { return fromString(name, ProvisioningState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryMode.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryMode.java index 7938763b1add9..804c6dfc00c26 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryMode.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryMode.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -57,7 +56,6 @@ public RecoveryMode() { * @param name a name to look for. * @return the corresponding RecoveryMode. */ - @JsonCreator public static RecoveryMode fromString(String name) { return fromString(name, RecoveryMode.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoint.java index 364a629a9f05a..c994252bb0a3f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoint.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoint.java @@ -5,36 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for backup copies. Workload-specific backup copies are derived from this class. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "objectType", defaultImpl = RecoveryPoint.class, visible = true) -@JsonTypeName("RecoveryPoint") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureFileShareRecoveryPoint", value = AzureFileShareRecoveryPoint.class), - @JsonSubTypes.Type(name = "AzureWorkloadRecoveryPoint", value = AzureWorkloadRecoveryPoint.class), - @JsonSubTypes.Type(name = "GenericRecoveryPoint", value = GenericRecoveryPoint.class), - @JsonSubTypes.Type(name = "IaasVMRecoveryPoint", value = IaasVMRecoveryPoint.class) }) @Immutable -public class RecoveryPoint { +public class RecoveryPoint implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "RecoveryPoint"; /** * Creates an instance of RecoveryPoint class. */ public RecoveryPoint() { - this.objectType = "RecoveryPoint"; } /** @@ -54,4 +45,93 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPoint. + */ + public static RecoveryPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureFileShareRecoveryPoint".equals(discriminatorValue)) { + return AzureFileShareRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadRecoveryPoint.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadPointInTimeRecoveryPoint.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAseRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapAseRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOracleRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadOracleRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabaseRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabaseRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSapHanaRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSQLRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSqlRecoveryPoint.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLPointInTimeRecoveryPoint".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("GenericRecoveryPoint".equals(discriminatorValue)) { + return GenericRecoveryPoint.fromJson(readerToUse.reset()); + } else if ("IaasVMRecoveryPoint".equals(discriminatorValue)) { + return IaasVMRecoveryPoint.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static RecoveryPoint fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPoint deserializedRecoveryPoint = new RecoveryPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedRecoveryPoint.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPoint; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointDiskConfiguration.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointDiskConfiguration.java index 9a61b97f60b17..caddfde11edea 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointDiskConfiguration.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointDiskConfiguration.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Disk configuration. */ @Fluent -public final class RecoveryPointDiskConfiguration { +public final class RecoveryPointDiskConfiguration implements JsonSerializable { /* * Number of disks included in backup */ - @JsonProperty(value = "numberOfDisksIncludedInBackup") private Integer numberOfDisksIncludedInBackup; /* * Number of disks attached to the VM */ - @JsonProperty(value = "numberOfDisksAttachedToVm") private Integer numberOfDisksAttachedToVm; /* * Information of disks included in backup */ - @JsonProperty(value = "includedDiskList") private List includedDiskList; /* * Information of disks excluded from backup */ - @JsonProperty(value = "excludedDiskList") private List excludedDiskList; /** @@ -136,4 +136,58 @@ public void validate() { excludedDiskList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("numberOfDisksIncludedInBackup", this.numberOfDisksIncludedInBackup); + jsonWriter.writeNumberField("numberOfDisksAttachedToVm", this.numberOfDisksAttachedToVm); + jsonWriter.writeArrayField("includedDiskList", this.includedDiskList, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("excludedDiskList", this.excludedDiskList, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointDiskConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointDiskConfiguration if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPointDiskConfiguration. + */ + public static RecoveryPointDiskConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointDiskConfiguration deserializedRecoveryPointDiskConfiguration + = new RecoveryPointDiskConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("numberOfDisksIncludedInBackup".equals(fieldName)) { + deserializedRecoveryPointDiskConfiguration.numberOfDisksIncludedInBackup + = reader.getNullable(JsonReader::getInt); + } else if ("numberOfDisksAttachedToVm".equals(fieldName)) { + deserializedRecoveryPointDiskConfiguration.numberOfDisksAttachedToVm + = reader.getNullable(JsonReader::getInt); + } else if ("includedDiskList".equals(fieldName)) { + List includedDiskList + = reader.readArray(reader1 -> DiskInformation.fromJson(reader1)); + deserializedRecoveryPointDiskConfiguration.includedDiskList = includedDiskList; + } else if ("excludedDiskList".equals(fieldName)) { + List excludedDiskList + = reader.readArray(reader1 -> DiskInformation.fromJson(reader1)); + deserializedRecoveryPointDiskConfiguration.excludedDiskList = excludedDiskList; + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointDiskConfiguration; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointMoveReadinessInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointMoveReadinessInfo.java index ca2366b7fab56..6a34c5d5ff0dd 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointMoveReadinessInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointMoveReadinessInfo.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The RecoveryPointMoveReadinessInfo model. */ @Fluent -public final class RecoveryPointMoveReadinessInfo { +public final class RecoveryPointMoveReadinessInfo implements JsonSerializable { /* * The isReadyForMove property. */ - @JsonProperty(value = "isReadyForMove") private Boolean isReadyForMove; /* * The additionalInfo property. */ - @JsonProperty(value = "additionalInfo") private String additionalInfo; /** @@ -77,4 +79,45 @@ public RecoveryPointMoveReadinessInfo withAdditionalInfo(String additionalInfo) */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isReadyForMove", this.isReadyForMove); + jsonWriter.writeStringField("additionalInfo", this.additionalInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointMoveReadinessInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointMoveReadinessInfo if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPointMoveReadinessInfo. + */ + public static RecoveryPointMoveReadinessInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointMoveReadinessInfo deserializedRecoveryPointMoveReadinessInfo + = new RecoveryPointMoveReadinessInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isReadyForMove".equals(fieldName)) { + deserializedRecoveryPointMoveReadinessInfo.isReadyForMove + = reader.getNullable(JsonReader::getBoolean); + } else if ("additionalInfo".equals(fieldName)) { + deserializedRecoveryPointMoveReadinessInfo.additionalInfo = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointMoveReadinessInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointProperties.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointProperties.java index 7007c6415dbc1..06a6d4051f3db 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointProperties.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointProperties.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties of Recovery Point. */ @Fluent -public final class RecoveryPointProperties { +public final class RecoveryPointProperties implements JsonSerializable { /* * Expiry time of Recovery Point in UTC. */ - @JsonProperty(value = "expiryTime") private String expiryTime; /* * Rule name tagged on Recovery Point that governs life cycle */ - @JsonProperty(value = "ruleName") private String ruleName; /* * Bool to indicate whether RP is in soft delete state or not */ - @JsonProperty(value = "isSoftDeleted") private Boolean isSoftDeleted; /** @@ -103,4 +104,46 @@ public RecoveryPointProperties withIsSoftDeleted(Boolean isSoftDeleted) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("expiryTime", this.expiryTime); + jsonWriter.writeStringField("ruleName", this.ruleName); + jsonWriter.writeBooleanField("isSoftDeleted", this.isSoftDeleted); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPointProperties. + */ + public static RecoveryPointProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointProperties deserializedRecoveryPointProperties = new RecoveryPointProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("expiryTime".equals(fieldName)) { + deserializedRecoveryPointProperties.expiryTime = reader.getString(); + } else if ("ruleName".equals(fieldName)) { + deserializedRecoveryPointProperties.ruleName = reader.getString(); + } else if ("isSoftDeleted".equals(fieldName)) { + deserializedRecoveryPointProperties.isSoftDeleted = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointProperties; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointRehydrationInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointRehydrationInfo.java index 7529b9b17d3ef..9151a4ee3f510 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointRehydrationInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointRehydrationInfo.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * RP Rehydration Info. */ @Fluent -public final class RecoveryPointRehydrationInfo { +public final class RecoveryPointRehydrationInfo implements JsonSerializable { /* * How long the rehydrated RP should be kept * Should be ISO8601 Duration format e.g. "P7D" */ - @JsonProperty(value = "rehydrationRetentionDuration") private String rehydrationRetentionDuration; /* * Rehydration Priority */ - @JsonProperty(value = "rehydrationPriority") private RehydrationPriority rehydrationPriority; /** @@ -80,4 +82,45 @@ public RecoveryPointRehydrationInfo withRehydrationPriority(RehydrationPriority */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("rehydrationRetentionDuration", this.rehydrationRetentionDuration); + jsonWriter.writeStringField("rehydrationPriority", + this.rehydrationPriority == null ? null : this.rehydrationPriority.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointRehydrationInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointRehydrationInfo if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPointRehydrationInfo. + */ + public static RecoveryPointRehydrationInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointRehydrationInfo deserializedRecoveryPointRehydrationInfo = new RecoveryPointRehydrationInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rehydrationRetentionDuration".equals(fieldName)) { + deserializedRecoveryPointRehydrationInfo.rehydrationRetentionDuration = reader.getString(); + } else if ("rehydrationPriority".equals(fieldName)) { + deserializedRecoveryPointRehydrationInfo.rehydrationPriority + = RehydrationPriority.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointRehydrationInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointResourceList.java index 4946d360db23a..bfc35a1c04bf4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.RecoveryPointResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class RecoveryPointResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,49 @@ public RecoveryPointResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointResourceList if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPointResourceList. + */ + public static RecoveryPointResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointResourceList deserializedRecoveryPointResourceList = new RecoveryPointResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedRecoveryPointResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RecoveryPointResourceInner.fromJson(reader1)); + deserializedRecoveryPointResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformation.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformation.java index 328c8ddbc8986..cefb731db33a6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformation.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformation.java @@ -5,32 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** * Recovery point tier information. */ @Fluent -public class RecoveryPointTierInformation { +public class RecoveryPointTierInformation implements JsonSerializable { /* * Recovery point tier type. */ - @JsonProperty(value = "type") private RecoveryPointTierType type; /* * Recovery point tier status. */ - @JsonProperty(value = "status") private RecoveryPointTierStatus status; /* * Recovery point tier status. */ - @JsonProperty(value = "extendedInfo") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map extendedInfo; /** @@ -106,4 +105,49 @@ public RecoveryPointTierInformation withExtendedInfo(Map extende */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeMapField("extendedInfo", this.extendedInfo, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointTierInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointTierInformation if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPointTierInformation. + */ + public static RecoveryPointTierInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointTierInformation deserializedRecoveryPointTierInformation = new RecoveryPointTierInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedRecoveryPointTierInformation.type + = RecoveryPointTierType.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedRecoveryPointTierInformation.status + = RecoveryPointTierStatus.fromString(reader.getString()); + } else if ("extendedInfo".equals(fieldName)) { + Map extendedInfo = reader.readMap(reader1 -> reader1.getString()); + deserializedRecoveryPointTierInformation.extendedInfo = extendedInfo; + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointTierInformation; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformationV2.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformationV2.java index c892ea66493f8..d80f9e112bb4b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformationV2.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierInformationV2.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** @@ -52,6 +56,51 @@ public RecoveryPointTierInformationV2 withExtendedInfo(Map exten */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeStringField("status", status() == null ? null : status().toString()); + jsonWriter.writeMapField("extendedInfo", extendedInfo(), (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoveryPointTierInformationV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoveryPointTierInformationV2 if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoveryPointTierInformationV2. + */ + public static RecoveryPointTierInformationV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoveryPointTierInformationV2 deserializedRecoveryPointTierInformationV2 + = new RecoveryPointTierInformationV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedRecoveryPointTierInformationV2 + .withType(RecoveryPointTierType.fromString(reader.getString())); + } else if ("status".equals(fieldName)) { + deserializedRecoveryPointTierInformationV2 + .withStatus(RecoveryPointTierStatus.fromString(reader.getString())); + } else if ("extendedInfo".equals(fieldName)) { + Map extendedInfo = reader.readMap(reader1 -> reader1.getString()); + deserializedRecoveryPointTierInformationV2.withExtendedInfo(extendedInfo); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoveryPointTierInformationV2; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierStatus.java index 9effbc5d7cabb..4b65796db8d0f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierStatus.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Recovery point tier status. */ @@ -51,7 +48,6 @@ public enum RecoveryPointTierStatus { * @param value the serialized value to parse. * @return the parsed RecoveryPointTierStatus object, or null if unable to parse. */ - @JsonCreator public static RecoveryPointTierStatus fromString(String value) { if (value == null) { return null; @@ -68,7 +64,6 @@ public static RecoveryPointTierStatus fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierType.java index 779432220cfd7..5c38ce9f7c448 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPointTierType.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Recovery point tier type. */ @@ -46,7 +43,6 @@ public enum RecoveryPointTierType { * @param value the serialized value to parse. * @return the parsed RecoveryPointTierType object, or null if unable to parse. */ - @JsonCreator public static RecoveryPointTierType fromString(String value) { if (value == null) { return null; @@ -63,7 +59,6 @@ public static RecoveryPointTierType fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoints.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoints.java index 7632ac56f3b7e..df170c569788a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoints.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryPoints.java @@ -84,4 +84,42 @@ Response getWithResponse(String vaultName, String resourc */ RecoveryPointResource get(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId); + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies along with {@link Response}. + */ + Response updateWithResponse(String resourceGroupName, String vaultName, String fabricName, + String containerName, String protectedItemName, String recoveryPointId, UpdateRecoveryPointRequest parameters, + Context context); + + /** + * UpdateRecoveryPoint to update recovery point for given RecoveryPointID. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the recovery services vault. + * @param fabricName Fabric name associated with backed up item. + * @param containerName Container name associated with backed up item. + * @param protectedItemName Backed up item name whose backup data needs to be fetched. + * @param recoveryPointId RecoveryPointID represents the backed up data to be fetched. + * @param parameters Request body for operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return base class for backup copies. + */ + RecoveryPointResource update(String resourceGroupName, String vaultName, String fabricName, String containerName, + String protectedItemName, String recoveryPointId, UpdateRecoveryPointRequest parameters); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryType.java index b689acfda29b4..4f5a2a9aa5bc2 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RecoveryType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public RecoveryType() { * @param name a name to look for. * @return the corresponding RecoveryType. */ - @JsonCreator public static RecoveryType fromString(String name) { return fromString(name, RecoveryType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RehydrationPriority.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RehydrationPriority.java index 1eb0f316b280f..7d5450d1c5db0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RehydrationPriority.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RehydrationPriority.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public RehydrationPriority() { * @param name a name to look for. * @return the corresponding RehydrationPriority. */ - @JsonCreator public static RehydrationPriority fromString(String name) { return fromString(name, RehydrationPriority.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardOperationDetail.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardOperationDetail.java index 60a425bf3ffc7..af7cf150bde9a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardOperationDetail.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardOperationDetail.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ResourceGuardOperationDetail model. */ @Fluent -public final class ResourceGuardOperationDetail { +public final class ResourceGuardOperationDetail implements JsonSerializable { /* * The vaultCriticalOperation property. */ - @JsonProperty(value = "vaultCriticalOperation") private String vaultCriticalOperation; /* * The defaultResourceRequest property. */ - @JsonProperty(value = "defaultResourceRequest") private String defaultResourceRequest; /** @@ -77,4 +79,43 @@ public ResourceGuardOperationDetail withDefaultResourceRequest(String defaultRes */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("vaultCriticalOperation", this.vaultCriticalOperation); + jsonWriter.writeStringField("defaultResourceRequest", this.defaultResourceRequest); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceGuardOperationDetail from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceGuardOperationDetail if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceGuardOperationDetail. + */ + public static ResourceGuardOperationDetail fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceGuardOperationDetail deserializedResourceGuardOperationDetail = new ResourceGuardOperationDetail(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vaultCriticalOperation".equals(fieldName)) { + deserializedResourceGuardOperationDetail.vaultCriticalOperation = reader.getString(); + } else if ("defaultResourceRequest".equals(fieldName)) { + deserializedResourceGuardOperationDetail.defaultResourceRequest = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceGuardOperationDetail; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBase.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBase.java index b8a992787aba8..7a05fd9a2e200 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBase.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBase.java @@ -6,36 +6,36 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * The ResourceGuardProxyBase model. */ @Fluent -public final class ResourceGuardProxyBase { +public final class ResourceGuardProxyBase implements JsonSerializable { /* * The resourceGuardResourceId property. */ - @JsonProperty(value = "resourceGuardResourceId", required = true) private String resourceGuardResourceId; /* * The resourceGuardOperationDetails property. */ - @JsonProperty(value = "resourceGuardOperationDetails") private List resourceGuardOperationDetails; /* * The lastUpdatedTime property. */ - @JsonProperty(value = "lastUpdatedTime") private String lastUpdatedTime; /* * The description property. */ - @JsonProperty(value = "description") private String description; /** @@ -142,4 +142,53 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(ResourceGuardProxyBase.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceGuardResourceId", this.resourceGuardResourceId); + jsonWriter.writeArrayField("resourceGuardOperationDetails", this.resourceGuardOperationDetails, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("lastUpdatedTime", this.lastUpdatedTime); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceGuardProxyBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceGuardProxyBase if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceGuardProxyBase. + */ + public static ResourceGuardProxyBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceGuardProxyBase deserializedResourceGuardProxyBase = new ResourceGuardProxyBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardResourceId".equals(fieldName)) { + deserializedResourceGuardProxyBase.resourceGuardResourceId = reader.getString(); + } else if ("resourceGuardOperationDetails".equals(fieldName)) { + List resourceGuardOperationDetails + = reader.readArray(reader1 -> ResourceGuardOperationDetail.fromJson(reader1)); + deserializedResourceGuardProxyBase.resourceGuardOperationDetails = resourceGuardOperationDetails; + } else if ("lastUpdatedTime".equals(fieldName)) { + deserializedResourceGuardProxyBase.lastUpdatedTime = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedResourceGuardProxyBase.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceGuardProxyBase; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBaseResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBaseResourceList.java index e5004e1b04f17..6adef0198323f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBaseResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceGuardProxyBaseResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ResourceGuardProxyBaseResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class ResourceGuardProxyBaseResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,50 @@ public ResourceGuardProxyBaseResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceGuardProxyBaseResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceGuardProxyBaseResourceList if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceGuardProxyBaseResourceList. + */ + public static ResourceGuardProxyBaseResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceGuardProxyBaseResourceList deserializedResourceGuardProxyBaseResourceList + = new ResourceGuardProxyBaseResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedResourceGuardProxyBaseResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ResourceGuardProxyBaseResourceInner.fromJson(reader1)); + deserializedResourceGuardProxyBaseResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedResourceGuardProxyBaseResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthDetails.java index 7da7b2270a5b2..688e9e18f2087 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthDetails.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Health Details for backup items. */ @Immutable -public class ResourceHealthDetails { +public class ResourceHealthDetails implements JsonSerializable { /* * Health Code */ - @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) private Integer code; /* * Health Title */ - @JsonProperty(value = "title", access = JsonProperty.Access.WRITE_ONLY) private String title; /* * Health Message */ - @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) private String message; /* * Health Recommended Actions */ - @JsonProperty(value = "recommendations", access = JsonProperty.Access.WRITE_ONLY) private List recommendations; /** @@ -52,6 +52,17 @@ public Integer code() { return this.code; } + /** + * Set the code property: Health Code. + * + * @param code the code value to set. + * @return the ResourceHealthDetails object itself. + */ + ResourceHealthDetails withCode(Integer code) { + this.code = code; + return this; + } + /** * Get the title property: Health Title. * @@ -61,6 +72,17 @@ public String title() { return this.title; } + /** + * Set the title property: Health Title. + * + * @param title the title value to set. + * @return the ResourceHealthDetails object itself. + */ + ResourceHealthDetails withTitle(String title) { + this.title = title; + return this; + } + /** * Get the message property: Health Message. * @@ -70,6 +92,17 @@ public String message() { return this.message; } + /** + * Set the message property: Health Message. + * + * @param message the message value to set. + * @return the ResourceHealthDetails object itself. + */ + ResourceHealthDetails withMessage(String message) { + this.message = message; + return this; + } + /** * Get the recommendations property: Health Recommended Actions. * @@ -79,6 +112,17 @@ public List recommendations() { return this.recommendations; } + /** + * Set the recommendations property: Health Recommended Actions. + * + * @param recommendations the recommendations value to set. + * @return the ResourceHealthDetails object itself. + */ + ResourceHealthDetails withRecommendations(List recommendations) { + this.recommendations = recommendations; + return this; + } + /** * Validates the instance. * @@ -86,4 +130,46 @@ public List recommendations() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceHealthDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceHealthDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceHealthDetails. + */ + public static ResourceHealthDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceHealthDetails deserializedResourceHealthDetails = new ResourceHealthDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedResourceHealthDetails.code = reader.getNullable(JsonReader::getInt); + } else if ("title".equals(fieldName)) { + deserializedResourceHealthDetails.title = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedResourceHealthDetails.message = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedResourceHealthDetails.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedResourceHealthDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthStatus.java index 319f062056153..9b61343a654f1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceHealthStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -57,7 +56,6 @@ public ResourceHealthStatus() { * @param name a name to look for. * @return the corresponding ResourceHealthStatus. */ - @JsonCreator public static ResourceHealthStatus fromString(String name) { return fromString(name, ResourceHealthStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceList.java index 7bfd6dc128c2f..fd54121303af9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ResourceList.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base for all lists of resources. */ @Fluent -public class ResourceList { +public class ResourceList implements JsonSerializable { /* * The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -53,4 +56,40 @@ public ResourceList withNextLink(String nextLink) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceList. + */ + public static ResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceList deserializedResourceList = new ResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedResourceList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreFileSpecs.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreFileSpecs.java index cf7b3ef1e9b92..627c8e513d331 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreFileSpecs.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreFileSpecs.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Restore file specs like file path, type and target folder path info. */ @Fluent -public final class RestoreFileSpecs { +public final class RestoreFileSpecs implements JsonSerializable { /* * Source File/Folder path */ - @JsonProperty(value = "path") private String path; /* * Indicates what the Path variable stands for */ - @JsonProperty(value = "fileSpecType") private String fileSpecType; /* * Destination folder path in target FileShare */ - @JsonProperty(value = "targetFolderPath") private String targetFolderPath; /** @@ -103,4 +104,46 @@ public RestoreFileSpecs withTargetFolderPath(String targetFolderPath) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + jsonWriter.writeStringField("fileSpecType", this.fileSpecType); + jsonWriter.writeStringField("targetFolderPath", this.targetFolderPath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreFileSpecs from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreFileSpecs if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RestoreFileSpecs. + */ + public static RestoreFileSpecs fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreFileSpecs deserializedRestoreFileSpecs = new RestoreFileSpecs(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedRestoreFileSpecs.path = reader.getString(); + } else if ("fileSpecType".equals(fieldName)) { + deserializedRestoreFileSpecs.fileSpecType = reader.getString(); + } else if ("targetFolderPath".equals(fieldName)) { + deserializedRestoreFileSpecs.targetFolderPath = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreFileSpecs; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestorePointType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestorePointType.java index 980b887a89baa..8a78314a4492d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestorePointType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestorePointType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -62,7 +61,6 @@ public RestorePointType() { * @param name a name to look for. * @return the corresponding RestorePointType. */ - @JsonCreator public static RestorePointType fromString(String name) { return fromString(name, RestorePointType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequest.java index 2ee449b185bd1..a6492448611f6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequest.java @@ -5,42 +5,33 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Base class for restore request. Workload-specific restore requests are derived from this class. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "objectType", defaultImpl = RestoreRequest.class, visible = true) -@JsonTypeName("RestoreRequest") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureFileShareRestoreRequest", value = AzureFileShareRestoreRequest.class), - @JsonSubTypes.Type(name = "AzureWorkloadRestoreRequest", value = AzureWorkloadRestoreRequest.class), - @JsonSubTypes.Type(name = "IaasVMRestoreRequest", value = IaasVMRestoreRequest.class) }) @Fluent -public class RestoreRequest { +public class RestoreRequest implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "RestoreRequest"; /* * ResourceGuardOperationRequests on which LAC check will be performed */ - @JsonProperty(value = "resourceGuardOperationRequests") private List resourceGuardOperationRequests; /** * Creates an instance of RestoreRequest class. */ public RestoreRequest() { - this.objectType = "RestoreRequest"; } /** @@ -82,4 +73,121 @@ public RestoreRequest withResourceGuardOperationRequests(List resourceGu */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeArrayField("resourceGuardOperationRequests", this.resourceGuardOperationRequests, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RestoreRequest. + */ + public static RestoreRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureFileShareRestoreRequest".equals(discriminatorValue)) { + return AzureFileShareRestoreRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadPointInTimeRestoreRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRestoreRequest + .fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPHanaRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapHanaRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAseRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAseRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSAPAsePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAsePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSAPAseRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSapAseRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOracleRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadOracleRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadOraclePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadOracleRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadOracleRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabaseRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabaseRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRestoreRequest + .fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest" + .equals(discriminatorValue)) { + return AzureWorkloadAnyDatabasePointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadAnyDatabaseRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSQLRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLPointInTimeRestoreRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("AzureWorkloadSQLRestoreWithRehydrateRequest".equals(discriminatorValue)) { + return AzureWorkloadSqlRestoreWithRehydrateRequest.fromJson(readerToUse.reset()); + } else if ("IaasVMRestoreRequest".equals(discriminatorValue)) { + return IaasVMRestoreRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("IaasVMRestoreWithRehydrationRequest".equals(discriminatorValue)) { + return IaasVMRestoreWithRehydrationRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static RestoreRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreRequest deserializedRestoreRequest = new RestoreRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedRestoreRequest.objectType = reader.getString(); + } else if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedRestoreRequest.resourceGuardOperationRequests = resourceGuardOperationRequests; + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestResource.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestResource.java index 1b065ae3741ed..8d1a354bf3ea9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestResource.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestResource.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** @@ -17,15 +20,28 @@ public final class RestoreRequestResource extends Resource { /* * RestoreRequestResource properties */ - @JsonProperty(value = "properties") private RestoreRequest properties; /* * Optional ETag. */ - @JsonProperty(value = "eTag") private String etag; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of RestoreRequestResource class. */ @@ -72,6 +88,36 @@ public RestoreRequestResource withEtag(String etag) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -100,4 +146,57 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("eTag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreRequestResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreRequestResource if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestoreRequestResource. + */ + public static RestoreRequestResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreRequestResource deserializedRestoreRequestResource = new RestoreRequestResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestoreRequestResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestoreRequestResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestoreRequestResource.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedRestoreRequestResource.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedRestoreRequestResource.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedRestoreRequestResource.properties = RestoreRequest.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedRestoreRequestResource.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreRequestResource; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestType.java index 9d230eadb7c1c..212437a41c7df 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RestoreRequestType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public RestoreRequestType() { * @param name a name to look for. * @return the corresponding RestoreRequestType. */ - @JsonCreator public static RestoreRequestType fromString(String name) { return fromString(name, RestoreRequestType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDuration.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDuration.java index c2e840a249a9b..a4ca37b36062c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDuration.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDuration.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Retention duration. */ @Fluent -public final class RetentionDuration { +public final class RetentionDuration implements JsonSerializable { /* * 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. */ - @JsonProperty(value = "count") private Integer count; /* * Retention duration type of retention policy. */ - @JsonProperty(value = "durationType") private RetentionDurationType durationType; /** @@ -82,4 +84,43 @@ public RetentionDuration withDurationType(RetentionDurationType durationType) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("count", this.count); + jsonWriter.writeStringField("durationType", this.durationType == null ? null : this.durationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RetentionDuration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RetentionDuration if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RetentionDuration. + */ + public static RetentionDuration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RetentionDuration deserializedRetentionDuration = new RetentionDuration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedRetentionDuration.count = reader.getNullable(JsonReader::getInt); + } else if ("durationType".equals(fieldName)) { + deserializedRetentionDuration.durationType = RetentionDurationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRetentionDuration; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDurationType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDurationType.java index e5ea51de83c53..6a5c791112b92 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDurationType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionDurationType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public RetentionDurationType() { * @param name a name to look for. * @return the corresponding RetentionDurationType. */ - @JsonCreator public static RetentionDurationType fromString(String name) { return fromString(name, RetentionDurationType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionPolicy.java index 8ab0f7cc7224c..011decc6a0d84 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionPolicy.java @@ -5,38 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for retention policy. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "retentionPolicyType", - defaultImpl = RetentionPolicy.class, - visible = true) -@JsonTypeName("RetentionPolicy") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "LongTermRetentionPolicy", value = LongTermRetentionPolicy.class), - @JsonSubTypes.Type(name = "SimpleRetentionPolicy", value = SimpleRetentionPolicy.class) }) @Immutable -public class RetentionPolicy { +public class RetentionPolicy implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "retentionPolicyType", required = true) - private String retentionPolicyType; + private String retentionPolicyType = "RetentionPolicy"; /** * Creates an instance of RetentionPolicy class. */ public RetentionPolicy() { - this.retentionPolicyType = "RetentionPolicy"; } /** @@ -56,4 +45,67 @@ public String retentionPolicyType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("retentionPolicyType", this.retentionPolicyType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RetentionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RetentionPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RetentionPolicy. + */ + public static RetentionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("retentionPolicyType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("LongTermRetentionPolicy".equals(discriminatorValue)) { + return LongTermRetentionPolicy.fromJson(readerToUse.reset()); + } else if ("SimpleRetentionPolicy".equals(discriminatorValue)) { + return SimpleRetentionPolicy.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static RetentionPolicy fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RetentionPolicy deserializedRetentionPolicy = new RetentionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionPolicyType".equals(fieldName)) { + deserializedRetentionPolicy.retentionPolicyType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRetentionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionScheduleFormat.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionScheduleFormat.java index 6ed43e83885e9..c69e5fc628478 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionScheduleFormat.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/RetentionScheduleFormat.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public RetentionScheduleFormat() { * @param name a name to look for. * @return the corresponding RetentionScheduleFormat. */ - @JsonCreator public static RetentionScheduleFormat fromString(String name) { return fromString(name, RetentionScheduleFormat.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SchedulePolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SchedulePolicy.java index 371302ea6b079..d2a531f9696dd 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SchedulePolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SchedulePolicy.java @@ -5,40 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for backup schedule. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "schedulePolicyType", - defaultImpl = SchedulePolicy.class, - visible = true) -@JsonTypeName("SchedulePolicy") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "LogSchedulePolicy", value = LogSchedulePolicy.class), - @JsonSubTypes.Type(name = "LongTermSchedulePolicy", value = LongTermSchedulePolicy.class), - @JsonSubTypes.Type(name = "SimpleSchedulePolicy", value = SimpleSchedulePolicy.class), - @JsonSubTypes.Type(name = "SimpleSchedulePolicyV2", value = SimpleSchedulePolicyV2.class) }) @Immutable -public class SchedulePolicy { +public class SchedulePolicy implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "schedulePolicyType", required = true) - private String schedulePolicyType; + private String schedulePolicyType = "SchedulePolicy"; /** * Creates an instance of SchedulePolicy class. */ public SchedulePolicy() { - this.schedulePolicyType = "SchedulePolicy"; } /** @@ -58,4 +45,71 @@ public String schedulePolicyType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schedulePolicyType", this.schedulePolicyType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchedulePolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchedulePolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SchedulePolicy. + */ + public static SchedulePolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("schedulePolicyType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("LogSchedulePolicy".equals(discriminatorValue)) { + return LogSchedulePolicy.fromJson(readerToUse.reset()); + } else if ("LongTermSchedulePolicy".equals(discriminatorValue)) { + return LongTermSchedulePolicy.fromJson(readerToUse.reset()); + } else if ("SimpleSchedulePolicy".equals(discriminatorValue)) { + return SimpleSchedulePolicy.fromJson(readerToUse.reset()); + } else if ("SimpleSchedulePolicyV2".equals(discriminatorValue)) { + return SimpleSchedulePolicyV2.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static SchedulePolicy fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchedulePolicy deserializedSchedulePolicy = new SchedulePolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedulePolicyType".equals(fieldName)) { + deserializedSchedulePolicy.schedulePolicyType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSchedulePolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ScheduleRunType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ScheduleRunType.java index 07620eb619475..7752682140e59 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ScheduleRunType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ScheduleRunType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public ScheduleRunType() { * @param name a name to look for. * @return the corresponding ScheduleRunType. */ - @JsonCreator public static ScheduleRunType fromString(String name) { return fromString(name, ScheduleRunType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecuredVMDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecuredVMDetails.java index 1ab36c1a36c96..08475a6ef94b6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecuredVMDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecuredVMDetails.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Restore request parameters for Secured VMs. */ @Fluent -public final class SecuredVMDetails { +public final class SecuredVMDetails implements JsonSerializable { /* * Gets or Sets Disk Encryption Set Id for Secured VM OS Disk */ - @JsonProperty(value = "securedVMOsDiskEncryptionSetId") private String securedVmosDiskEncryptionSetId; /** @@ -51,4 +54,40 @@ public SecuredVMDetails withSecuredVmosDiskEncryptionSetId(String securedVmosDis */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("securedVMOsDiskEncryptionSetId", this.securedVmosDiskEncryptionSetId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuredVMDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuredVMDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SecuredVMDetails. + */ + public static SecuredVMDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuredVMDetails deserializedSecuredVMDetails = new SecuredVMDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("securedVMOsDiskEncryptionSetId".equals(fieldName)) { + deserializedSecuredVMDetails.securedVmosDiskEncryptionSetId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuredVMDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecurityPinBase.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecurityPinBase.java index 6292557a24f54..ce0b154981fc7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecurityPinBase.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SecurityPinBase.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Base class for get security pin request body. */ @Fluent -public final class SecurityPinBase { +public final class SecurityPinBase implements JsonSerializable { /* * ResourceGuard Operation Requests */ - @JsonProperty(value = "resourceGuardOperationRequests") private List resourceGuardOperationRequests; /** @@ -52,4 +55,42 @@ public SecurityPinBase withResourceGuardOperationRequests(List resourceG */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", this.resourceGuardOperationRequests, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityPinBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityPinBase if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SecurityPinBase. + */ + public static SecurityPinBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityPinBase deserializedSecurityPinBase = new SecurityPinBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityPinBase.resourceGuardOperationRequests = resourceGuardOperationRequests; + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityPinBase; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Settings.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Settings.java index 944819625d666..dc17382a844e4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Settings.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/Settings.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Common settings field for backup management. */ @Fluent -public final class Settings { +public final class Settings implements JsonSerializable { /* * TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". */ - @JsonProperty(value = "timeZone") private String timeZone; /* * SQL compression flag */ - @JsonProperty(value = "issqlcompression") private Boolean issqlcompression; /* * Workload compression flag. This has been added so that 'isSqlCompression' * will be deprecated once clients upgrade to consider this flag. */ - @JsonProperty(value = "isCompression") private Boolean isCompression; /** @@ -106,4 +107,46 @@ public Settings withIsCompression(Boolean isCompression) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeBooleanField("issqlcompression", this.issqlcompression); + jsonWriter.writeBooleanField("isCompression", this.isCompression); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Settings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Settings if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Settings. + */ + public static Settings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Settings deserializedSettings = new Settings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timeZone".equals(fieldName)) { + deserializedSettings.timeZone = reader.getString(); + } else if ("issqlcompression".equals(fieldName)) { + deserializedSettings.issqlcompression = reader.getNullable(JsonReader::getBoolean); + } else if ("isCompression".equals(fieldName)) { + deserializedSettings.isCompression = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSettings; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleRetentionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleRetentionPolicy.java index 76fcb9cf9ee40..eb5dfe2cc7ee4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleRetentionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleRetentionPolicy.java @@ -5,33 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Simple policy retention. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "retentionPolicyType", - defaultImpl = SimpleRetentionPolicy.class, - visible = true) -@JsonTypeName("SimpleRetentionPolicy") @Fluent public final class SimpleRetentionPolicy extends RetentionPolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "retentionPolicyType", required = true) private String retentionPolicyType = "SimpleRetentionPolicy"; /* * Retention duration of the protection policy. */ - @JsonProperty(value = "retentionDuration") private RetentionDuration retentionDuration; /** @@ -78,9 +70,47 @@ public SimpleRetentionPolicy withRetentionDuration(RetentionDuration retentionDu */ @Override public void validate() { - super.validate(); if (retentionDuration() != null) { retentionDuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("retentionPolicyType", this.retentionPolicyType); + jsonWriter.writeJsonField("retentionDuration", this.retentionDuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimpleRetentionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimpleRetentionPolicy if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SimpleRetentionPolicy. + */ + public static SimpleRetentionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SimpleRetentionPolicy deserializedSimpleRetentionPolicy = new SimpleRetentionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionPolicyType".equals(fieldName)) { + deserializedSimpleRetentionPolicy.retentionPolicyType = reader.getString(); + } else if ("retentionDuration".equals(fieldName)) { + deserializedSimpleRetentionPolicy.retentionDuration = RetentionDuration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSimpleRetentionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicy.java index cb0022813f9be..8def25777cbb5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicy.java @@ -5,59 +5,49 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Simple policy schedule. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "schedulePolicyType", - defaultImpl = SimpleSchedulePolicy.class, - visible = true) -@JsonTypeName("SimpleSchedulePolicy") @Fluent public final class SimpleSchedulePolicy extends SchedulePolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "schedulePolicyType", required = true) private String schedulePolicyType = "SimpleSchedulePolicy"; /* * Frequency of the schedule operation of this policy. */ - @JsonProperty(value = "scheduleRunFrequency") private ScheduleRunType scheduleRunFrequency; /* * List of days of week this schedule has to be run. */ - @JsonProperty(value = "scheduleRunDays") private List scheduleRunDays; /* * List of times of day this schedule has to be run. */ - @JsonProperty(value = "scheduleRunTimes") private List scheduleRunTimes; /* * Hourly Schedule of this Policy */ - @JsonProperty(value = "hourlySchedule") private HourlySchedule hourlySchedule; /* * At every number weeks this schedule has to be run. */ - @JsonProperty(value = "scheduleWeeklyFrequency") private Integer scheduleWeeklyFrequency; /** @@ -184,9 +174,67 @@ public SimpleSchedulePolicy withScheduleWeeklyFrequency(Integer scheduleWeeklyFr */ @Override public void validate() { - super.validate(); if (hourlySchedule() != null) { hourlySchedule().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schedulePolicyType", this.schedulePolicyType); + jsonWriter.writeStringField("scheduleRunFrequency", + this.scheduleRunFrequency == null ? null : this.scheduleRunFrequency.toString()); + jsonWriter.writeArrayField("scheduleRunDays", this.scheduleRunDays, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("scheduleRunTimes", this.scheduleRunTimes, (writer, element) -> writer + .writeString(element == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(element))); + jsonWriter.writeJsonField("hourlySchedule", this.hourlySchedule); + jsonWriter.writeNumberField("scheduleWeeklyFrequency", this.scheduleWeeklyFrequency); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimpleSchedulePolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimpleSchedulePolicy if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SimpleSchedulePolicy. + */ + public static SimpleSchedulePolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SimpleSchedulePolicy deserializedSimpleSchedulePolicy = new SimpleSchedulePolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedulePolicyType".equals(fieldName)) { + deserializedSimpleSchedulePolicy.schedulePolicyType = reader.getString(); + } else if ("scheduleRunFrequency".equals(fieldName)) { + deserializedSimpleSchedulePolicy.scheduleRunFrequency + = ScheduleRunType.fromString(reader.getString()); + } else if ("scheduleRunDays".equals(fieldName)) { + List scheduleRunDays + = reader.readArray(reader1 -> DayOfWeek.fromString(reader1.getString())); + deserializedSimpleSchedulePolicy.scheduleRunDays = scheduleRunDays; + } else if ("scheduleRunTimes".equals(fieldName)) { + List scheduleRunTimes = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + deserializedSimpleSchedulePolicy.scheduleRunTimes = scheduleRunTimes; + } else if ("hourlySchedule".equals(fieldName)) { + deserializedSimpleSchedulePolicy.hourlySchedule = HourlySchedule.fromJson(reader); + } else if ("scheduleWeeklyFrequency".equals(fieldName)) { + deserializedSimpleSchedulePolicy.scheduleWeeklyFrequency = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSimpleSchedulePolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicyV2.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicyV2.java index e44573ad675e0..23b500ee56444 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicyV2.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SimpleSchedulePolicyV2.java @@ -5,51 +5,40 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The V2 policy schedule for IaaS that supports hourly backups. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "schedulePolicyType", - defaultImpl = SimpleSchedulePolicyV2.class, - visible = true) -@JsonTypeName("SimpleSchedulePolicyV2") @Fluent public final class SimpleSchedulePolicyV2 extends SchedulePolicy { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "schedulePolicyType", required = true) private String schedulePolicyType = "SimpleSchedulePolicyV2"; /* * Frequency of the schedule operation of this policy. */ - @JsonProperty(value = "scheduleRunFrequency") private ScheduleRunType scheduleRunFrequency; /* * hourly schedule of this policy */ - @JsonProperty(value = "hourlySchedule") private HourlySchedule hourlySchedule; /* * Daily schedule of this policy */ - @JsonProperty(value = "dailySchedule") private DailySchedule dailySchedule; /* * Weekly schedule of this policy */ - @JsonProperty(value = "weeklySchedule") private WeeklySchedule weeklySchedule; /** @@ -156,7 +145,6 @@ public SimpleSchedulePolicyV2 withWeeklySchedule(WeeklySchedule weeklySchedule) */ @Override public void validate() { - super.validate(); if (hourlySchedule() != null) { hourlySchedule().validate(); } @@ -167,4 +155,54 @@ public void validate() { weeklySchedule().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schedulePolicyType", this.schedulePolicyType); + jsonWriter.writeStringField("scheduleRunFrequency", + this.scheduleRunFrequency == null ? null : this.scheduleRunFrequency.toString()); + jsonWriter.writeJsonField("hourlySchedule", this.hourlySchedule); + jsonWriter.writeJsonField("dailySchedule", this.dailySchedule); + jsonWriter.writeJsonField("weeklySchedule", this.weeklySchedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimpleSchedulePolicyV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimpleSchedulePolicyV2 if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SimpleSchedulePolicyV2. + */ + public static SimpleSchedulePolicyV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SimpleSchedulePolicyV2 deserializedSimpleSchedulePolicyV2 = new SimpleSchedulePolicyV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedulePolicyType".equals(fieldName)) { + deserializedSimpleSchedulePolicyV2.schedulePolicyType = reader.getString(); + } else if ("scheduleRunFrequency".equals(fieldName)) { + deserializedSimpleSchedulePolicyV2.scheduleRunFrequency + = ScheduleRunType.fromString(reader.getString()); + } else if ("hourlySchedule".equals(fieldName)) { + deserializedSimpleSchedulePolicyV2.hourlySchedule = HourlySchedule.fromJson(reader); + } else if ("dailySchedule".equals(fieldName)) { + deserializedSimpleSchedulePolicyV2.dailySchedule = DailySchedule.fromJson(reader); + } else if ("weeklySchedule".equals(fieldName)) { + deserializedSimpleSchedulePolicyV2.weeklySchedule = WeeklySchedule.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSimpleSchedulePolicyV2; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotBackupAdditionalDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotBackupAdditionalDetails.java index 5e469f024dce9..d3726ac4dbf46 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotBackupAdditionalDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotBackupAdditionalDetails.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Snapshot Backup related fields for WorkloadType SaPHanaSystem. */ @Fluent -public final class SnapshotBackupAdditionalDetails { +public final class SnapshotBackupAdditionalDetails implements JsonSerializable { /* * The instantRpRetentionRangeInDays property. */ - @JsonProperty(value = "instantRpRetentionRangeInDays") private Integer instantRpRetentionRangeInDays; /* * The instantRPDetails property. */ - @JsonProperty(value = "instantRPDetails") private String instantRPDetails; /* * User assigned managed identity details */ - @JsonProperty(value = "userAssignedManagedIdentityDetails") private UserAssignedManagedIdentityDetails userAssignedManagedIdentityDetails; /** @@ -107,4 +108,49 @@ public void validate() { userAssignedManagedIdentityDetails().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("instantRpRetentionRangeInDays", this.instantRpRetentionRangeInDays); + jsonWriter.writeStringField("instantRPDetails", this.instantRPDetails); + jsonWriter.writeJsonField("userAssignedManagedIdentityDetails", this.userAssignedManagedIdentityDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SnapshotBackupAdditionalDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SnapshotBackupAdditionalDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SnapshotBackupAdditionalDetails. + */ + public static SnapshotBackupAdditionalDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SnapshotBackupAdditionalDetails deserializedSnapshotBackupAdditionalDetails + = new SnapshotBackupAdditionalDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instantRpRetentionRangeInDays".equals(fieldName)) { + deserializedSnapshotBackupAdditionalDetails.instantRpRetentionRangeInDays + = reader.getNullable(JsonReader::getInt); + } else if ("instantRPDetails".equals(fieldName)) { + deserializedSnapshotBackupAdditionalDetails.instantRPDetails = reader.getString(); + } else if ("userAssignedManagedIdentityDetails".equals(fieldName)) { + deserializedSnapshotBackupAdditionalDetails.userAssignedManagedIdentityDetails + = UserAssignedManagedIdentityDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSnapshotBackupAdditionalDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotRestoreParameters.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotRestoreParameters.java index d9381fc69cda3..d7908ba514c56 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotRestoreParameters.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SnapshotRestoreParameters.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Encapsulates information regarding snapshot recovery for SAP Hana. */ @Fluent -public final class SnapshotRestoreParameters { +public final class SnapshotRestoreParameters implements JsonSerializable { /* * The skipAttachAndMount property. */ - @JsonProperty(value = "skipAttachAndMount") private Boolean skipAttachAndMount; /* * The logPointInTimeForDBRecovery property. */ - @JsonProperty(value = "logPointInTimeForDBRecovery") private String logPointInTimeForDBRecovery; /** @@ -77,4 +79,44 @@ public SnapshotRestoreParameters withLogPointInTimeForDBRecovery(String logPoint */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("skipAttachAndMount", this.skipAttachAndMount); + jsonWriter.writeStringField("logPointInTimeForDBRecovery", this.logPointInTimeForDBRecovery); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SnapshotRestoreParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SnapshotRestoreParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SnapshotRestoreParameters. + */ + public static SnapshotRestoreParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SnapshotRestoreParameters deserializedSnapshotRestoreParameters = new SnapshotRestoreParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("skipAttachAndMount".equals(fieldName)) { + deserializedSnapshotRestoreParameters.skipAttachAndMount + = reader.getNullable(JsonReader::getBoolean); + } else if ("logPointInTimeForDBRecovery".equals(fieldName)) { + deserializedSnapshotRestoreParameters.logPointInTimeForDBRecovery = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSnapshotRestoreParameters; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SoftDeleteFeatureState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SoftDeleteFeatureState.java index 74f6902f627fb..cdc49ee540288 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SoftDeleteFeatureState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SoftDeleteFeatureState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public SoftDeleteFeatureState() { * @param name a name to look for. * @return the corresponding SoftDeleteFeatureState. */ - @JsonCreator public static SoftDeleteFeatureState fromString(String name) { return fromString(name, SoftDeleteFeatureState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectory.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectory.java index 471106ef4a591..7de5259d64755 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectory.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectory.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * SQLDataDirectory info. */ @Fluent -public final class SqlDataDirectory { +public final class SqlDataDirectory implements JsonSerializable { /* * Type of data directory mapping */ - @JsonProperty(value = "type") private SqlDataDirectoryType type; /* * File path */ - @JsonProperty(value = "path") private String path; /* * Logical name of the file */ - @JsonProperty(value = "logicalName") private String logicalName; /** @@ -103,4 +104,46 @@ public SqlDataDirectory withLogicalName(String logicalName) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("path", this.path); + jsonWriter.writeStringField("logicalName", this.logicalName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDataDirectory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDataDirectory if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlDataDirectory. + */ + public static SqlDataDirectory fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDataDirectory deserializedSqlDataDirectory = new SqlDataDirectory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedSqlDataDirectory.type = SqlDataDirectoryType.fromString(reader.getString()); + } else if ("path".equals(fieldName)) { + deserializedSqlDataDirectory.path = reader.getString(); + } else if ("logicalName".equals(fieldName)) { + deserializedSqlDataDirectory.logicalName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDataDirectory; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryMapping.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryMapping.java index 495170bfe7525..2320e3df473d6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryMapping.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryMapping.java @@ -5,35 +5,35 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Encapsulates information regarding data directory. */ @Fluent -public final class SqlDataDirectoryMapping { +public final class SqlDataDirectoryMapping implements JsonSerializable { /* * Type of data directory mapping */ - @JsonProperty(value = "mappingType") private SqlDataDirectoryType mappingType; /* * Restore source logical name path */ - @JsonProperty(value = "sourceLogicalName") private String sourceLogicalName; /* * Restore source path */ - @JsonProperty(value = "sourcePath") private String sourcePath; /* * Target path */ - @JsonProperty(value = "targetPath") private String targetPath; /** @@ -129,4 +129,50 @@ public SqlDataDirectoryMapping withTargetPath(String targetPath) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mappingType", this.mappingType == null ? null : this.mappingType.toString()); + jsonWriter.writeStringField("sourceLogicalName", this.sourceLogicalName); + jsonWriter.writeStringField("sourcePath", this.sourcePath); + jsonWriter.writeStringField("targetPath", this.targetPath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlDataDirectoryMapping from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlDataDirectoryMapping if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlDataDirectoryMapping. + */ + public static SqlDataDirectoryMapping fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlDataDirectoryMapping deserializedSqlDataDirectoryMapping = new SqlDataDirectoryMapping(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mappingType".equals(fieldName)) { + deserializedSqlDataDirectoryMapping.mappingType + = SqlDataDirectoryType.fromString(reader.getString()); + } else if ("sourceLogicalName".equals(fieldName)) { + deserializedSqlDataDirectoryMapping.sourceLogicalName = reader.getString(); + } else if ("sourcePath".equals(fieldName)) { + deserializedSqlDataDirectoryMapping.sourcePath = reader.getString(); + } else if ("targetPath".equals(fieldName)) { + deserializedSqlDataDirectoryMapping.targetPath = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlDataDirectoryMapping; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryType.java index 1c60fb115ce70..2fb7ef5f4cf9f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SqlDataDirectoryType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public SqlDataDirectoryType() { * @param name a name to look for. * @return the corresponding SqlDataDirectoryType. */ - @JsonCreator public static SqlDataDirectoryType fromString(String name) { return fromString(name, SqlDataDirectoryType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageType.java index 13e9b59e95259..bcc0d5817181a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public StorageType() { * @param name a name to look for. * @return the corresponding StorageType. */ - @JsonCreator public static StorageType fromString(String name) { return fromString(name, StorageType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageTypeState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageTypeState.java index 2537617acada4..3c4d027564b86 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageTypeState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/StorageTypeState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public StorageTypeState() { * @param name a name to look for. * @return the corresponding StorageTypeState. */ - @JsonCreator public static StorageTypeState fromString(String name) { return fromString(name, StorageTypeState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SubProtectionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SubProtectionPolicy.java index 4c05efef51d80..f621abaacbf57 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SubProtectionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SubProtectionPolicy.java @@ -5,31 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** * Sub-protection policy which includes schedule and retention. */ @Fluent -public final class SubProtectionPolicy { +public final class SubProtectionPolicy implements JsonSerializable { /* * Type of backup policy type */ - @JsonProperty(value = "policyType") private PolicyType policyType; /* * Backup schedule specified as part of backup policy. */ - @JsonProperty(value = "schedulePolicy") private SchedulePolicy schedulePolicy; /* * Retention policy with the details on backup copy retention ranges. */ - @JsonProperty(value = "retentionPolicy") private RetentionPolicy retentionPolicy; /* @@ -37,14 +37,11 @@ public final class SubProtectionPolicy { * Key is Target Tier, defined in RecoveryPointTierType enum. * Tiering policy specifies the criteria to move RP to the target tier. */ - @JsonProperty(value = "tieringPolicy") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tieringPolicy; /* * Snapshot Backup related fields for WorkloadType SaPHanaSystem */ - @JsonProperty(value = "snapshotBackupAdditionalDetails") private SnapshotBackupAdditionalDetails snapshotBackupAdditionalDetails; /** @@ -181,4 +178,55 @@ public void validate() { snapshotBackupAdditionalDetails().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("policyType", this.policyType == null ? null : this.policyType.toString()); + jsonWriter.writeJsonField("schedulePolicy", this.schedulePolicy); + jsonWriter.writeJsonField("retentionPolicy", this.retentionPolicy); + jsonWriter.writeMapField("tieringPolicy", this.tieringPolicy, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("snapshotBackupAdditionalDetails", this.snapshotBackupAdditionalDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubProtectionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubProtectionPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SubProtectionPolicy. + */ + public static SubProtectionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubProtectionPolicy deserializedSubProtectionPolicy = new SubProtectionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("policyType".equals(fieldName)) { + deserializedSubProtectionPolicy.policyType = PolicyType.fromString(reader.getString()); + } else if ("schedulePolicy".equals(fieldName)) { + deserializedSubProtectionPolicy.schedulePolicy = SchedulePolicy.fromJson(reader); + } else if ("retentionPolicy".equals(fieldName)) { + deserializedSubProtectionPolicy.retentionPolicy = RetentionPolicy.fromJson(reader); + } else if ("tieringPolicy".equals(fieldName)) { + Map tieringPolicy + = reader.readMap(reader1 -> TieringPolicy.fromJson(reader1)); + deserializedSubProtectionPolicy.tieringPolicy = tieringPolicy; + } else if ("snapshotBackupAdditionalDetails".equals(fieldName)) { + deserializedSubProtectionPolicy.snapshotBackupAdditionalDetails + = SnapshotBackupAdditionalDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSubProtectionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SupportStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SupportStatus.java index 62864d0bd6a6f..1a9a472373e46 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SupportStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/SupportStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public SupportStatus() { * @param name a name to look for. * @return the corresponding SupportStatus. */ - @JsonCreator public static SupportStatus fromString(String name) { return fromString(name, SupportStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetAfsRestoreInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetAfsRestoreInfo.java index 047b1d976d75a..e891510ad478d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetAfsRestoreInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetAfsRestoreInfo.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Target Azure File Share Info. */ @Fluent -public final class TargetAfsRestoreInfo { +public final class TargetAfsRestoreInfo implements JsonSerializable { /* * File share name */ - @JsonProperty(value = "name") private String name; /* * Target file share resource ARM ID */ - @JsonProperty(value = "targetResourceId") private String targetResourceId; /** @@ -77,4 +79,43 @@ public TargetAfsRestoreInfo withTargetResourceId(String targetResourceId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("targetResourceId", this.targetResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetAfsRestoreInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetAfsRestoreInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetAfsRestoreInfo. + */ + public static TargetAfsRestoreInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetAfsRestoreInfo deserializedTargetAfsRestoreInfo = new TargetAfsRestoreInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedTargetAfsRestoreInfo.name = reader.getString(); + } else if ("targetResourceId".equals(fieldName)) { + deserializedTargetAfsRestoreInfo.targetResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetAfsRestoreInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessOption.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessOption.java index db125e6d24af9..f3656f7377f3b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessOption.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessOption.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Network access settings to be used for restored disks. */ @@ -41,7 +38,6 @@ public enum TargetDiskNetworkAccessOption { * @param value the serialized value to parse. * @return the parsed TargetDiskNetworkAccessOption object, or null if unable to parse. */ - @JsonCreator public static TargetDiskNetworkAccessOption fromString(String value) { if (value == null) { return null; @@ -58,7 +54,6 @@ public static TargetDiskNetworkAccessOption fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessSettings.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessSettings.java index 8a6261262e814..fd32a1bca0295 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessSettings.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetDiskNetworkAccessSettings.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Specifies target network access settings for disks of VM to be restored. */ @Fluent -public final class TargetDiskNetworkAccessSettings { +public final class TargetDiskNetworkAccessSettings implements JsonSerializable { /* * Network access settings to be used for restored disks */ - @JsonProperty(value = "targetDiskNetworkAccessOption") private TargetDiskNetworkAccessOption targetDiskNetworkAccessOption; /* - * Gets or sets the ARM resource ID of the target disk access to be used when TargetDiskNetworkAccessOption is set to TargetDiskNetworkAccessOption.UseNew + * Gets or sets the ARM resource ID of the target disk access to be used when TargetDiskNetworkAccessOption is set + * to TargetDiskNetworkAccessOption.UseNew */ - @JsonProperty(value = "targetDiskAccessId") private String targetDiskAccessId; /** @@ -80,4 +83,46 @@ public TargetDiskNetworkAccessSettings withTargetDiskAccessId(String targetDiskA */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetDiskNetworkAccessOption", + this.targetDiskNetworkAccessOption == null ? null : this.targetDiskNetworkAccessOption.toString()); + jsonWriter.writeStringField("targetDiskAccessId", this.targetDiskAccessId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetDiskNetworkAccessSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetDiskNetworkAccessSettings if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetDiskNetworkAccessSettings. + */ + public static TargetDiskNetworkAccessSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetDiskNetworkAccessSettings deserializedTargetDiskNetworkAccessSettings + = new TargetDiskNetworkAccessSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetDiskNetworkAccessOption".equals(fieldName)) { + deserializedTargetDiskNetworkAccessSettings.targetDiskNetworkAccessOption + = TargetDiskNetworkAccessOption.fromString(reader.getString()); + } else if ("targetDiskAccessId".equals(fieldName)) { + deserializedTargetDiskNetworkAccessSettings.targetDiskAccessId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetDiskNetworkAccessSettings; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetRestoreInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetRestoreInfo.java index 6c6f711eb109d..359e3bfd5e451 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetRestoreInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TargetRestoreInfo.java @@ -5,35 +5,35 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Details about target workload during restore operation. */ @Fluent -public final class TargetRestoreInfo { +public final class TargetRestoreInfo implements JsonSerializable { /* * Can Overwrite if Target DataBase already exists */ - @JsonProperty(value = "overwriteOption") private OverwriteOptions overwriteOption; /* * Resource Id name of the container in which Target DataBase resides */ - @JsonProperty(value = "containerId") private String containerId; /* * Database name InstanceName/DataBaseName for SQL or System/DbName for SAP Hana */ - @JsonProperty(value = "databaseName") private String databaseName; /* * Target directory location for restore as files. */ - @JsonProperty(value = "targetDirectoryForFileRestore") private String targetDirectoryForFileRestore; /** @@ -129,4 +129,50 @@ public TargetRestoreInfo withTargetDirectoryForFileRestore(String targetDirector */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("overwriteOption", + this.overwriteOption == null ? null : this.overwriteOption.toString()); + jsonWriter.writeStringField("containerId", this.containerId); + jsonWriter.writeStringField("databaseName", this.databaseName); + jsonWriter.writeStringField("targetDirectoryForFileRestore", this.targetDirectoryForFileRestore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetRestoreInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetRestoreInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetRestoreInfo. + */ + public static TargetRestoreInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetRestoreInfo deserializedTargetRestoreInfo = new TargetRestoreInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("overwriteOption".equals(fieldName)) { + deserializedTargetRestoreInfo.overwriteOption = OverwriteOptions.fromString(reader.getString()); + } else if ("containerId".equals(fieldName)) { + deserializedTargetRestoreInfo.containerId = reader.getString(); + } else if ("databaseName".equals(fieldName)) { + deserializedTargetRestoreInfo.databaseName = reader.getString(); + } else if ("targetDirectoryForFileRestore".equals(fieldName)) { + deserializedTargetRestoreInfo.targetDirectoryForFileRestore = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetRestoreInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostRehydrationInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostRehydrationInfo.java index a2d6663b3bbcd..d8aa908f0cf74 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostRehydrationInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostRehydrationInfo.java @@ -5,40 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.TieringCostInfoInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Response parameters for tiering cost info for rehydration. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = TieringCostRehydrationInfo.class, - visible = true) -@JsonTypeName("TieringCostRehydrationInfo") @Fluent public final class TieringCostRehydrationInfo extends TieringCostInfoInner { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "TieringCostRehydrationInfo"; /* * Rehydration size in bytes */ - @JsonProperty(value = "rehydrationSizeInBytes", required = true) private long rehydrationSizeInBytes; /* * Source tier to target tier rehydration cost per GB per month */ - @JsonProperty(value = "retailRehydrationCostPerGBPerMonth", required = true) private double retailRehydrationCostPerGBPerMonth; /** @@ -108,6 +99,48 @@ public double retailRehydrationCostPerGBPerMonth() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("rehydrationSizeInBytes", this.rehydrationSizeInBytes); + jsonWriter.writeDoubleField("retailRehydrationCostPerGBPerMonth", this.retailRehydrationCostPerGBPerMonth); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TieringCostRehydrationInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TieringCostRehydrationInfo if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TieringCostRehydrationInfo. + */ + public static TieringCostRehydrationInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TieringCostRehydrationInfo deserializedTieringCostRehydrationInfo = new TieringCostRehydrationInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rehydrationSizeInBytes".equals(fieldName)) { + deserializedTieringCostRehydrationInfo.rehydrationSizeInBytes = reader.getLong(); + } else if ("retailRehydrationCostPerGBPerMonth".equals(fieldName)) { + deserializedTieringCostRehydrationInfo.retailRehydrationCostPerGBPerMonth = reader.getDouble(); + } else if ("objectType".equals(fieldName)) { + deserializedTieringCostRehydrationInfo.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTieringCostRehydrationInfo; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostSavingInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostSavingInfo.java index 34e1856a066b4..775b7f12868bf 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostSavingInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringCostSavingInfo.java @@ -5,52 +5,41 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.TieringCostInfoInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Response parameters for tiering cost info for savings. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = TieringCostSavingInfo.class, - visible = true) -@JsonTypeName("TieringCostSavingInfo") @Fluent public final class TieringCostSavingInfo extends TieringCostInfoInner { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "TieringCostSavingInfo"; /* * Source tier size reduction in bytes after moving all the recommended backup points to target tier */ - @JsonProperty(value = "sourceTierSizeReductionInBytes", required = true) private long sourceTierSizeReductionInBytes; /* * Target tier size increase in bytes after moving all the recommended backup points to target tier */ - @JsonProperty(value = "targetTierSizeIncreaseInBytes", required = true) private long targetTierSizeIncreaseInBytes; /* * Source tier retail cost per GB per month */ - @JsonProperty(value = "retailSourceTierCostPerGBPerMonth", required = true) private double retailSourceTierCostPerGBPerMonth; /* * Target tier retail cost per GB per month */ - @JsonProperty(value = "retailTargetTierCostPerGBPerMonth", required = true) private double retailTargetTierCostPerGBPerMonth; /** @@ -161,6 +150,54 @@ public TieringCostSavingInfo withRetailTargetTierCostPerGBPerMonth(double retail */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("sourceTierSizeReductionInBytes", this.sourceTierSizeReductionInBytes); + jsonWriter.writeLongField("targetTierSizeIncreaseInBytes", this.targetTierSizeIncreaseInBytes); + jsonWriter.writeDoubleField("retailSourceTierCostPerGBPerMonth", this.retailSourceTierCostPerGBPerMonth); + jsonWriter.writeDoubleField("retailTargetTierCostPerGBPerMonth", this.retailTargetTierCostPerGBPerMonth); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TieringCostSavingInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TieringCostSavingInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TieringCostSavingInfo. + */ + public static TieringCostSavingInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TieringCostSavingInfo deserializedTieringCostSavingInfo = new TieringCostSavingInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceTierSizeReductionInBytes".equals(fieldName)) { + deserializedTieringCostSavingInfo.sourceTierSizeReductionInBytes = reader.getLong(); + } else if ("targetTierSizeIncreaseInBytes".equals(fieldName)) { + deserializedTieringCostSavingInfo.targetTierSizeIncreaseInBytes = reader.getLong(); + } else if ("retailSourceTierCostPerGBPerMonth".equals(fieldName)) { + deserializedTieringCostSavingInfo.retailSourceTierCostPerGBPerMonth = reader.getDouble(); + } else if ("retailTargetTierCostPerGBPerMonth".equals(fieldName)) { + deserializedTieringCostSavingInfo.retailTargetTierCostPerGBPerMonth = reader.getDouble(); + } else if ("objectType".equals(fieldName)) { + deserializedTieringCostSavingInfo.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTieringCostSavingInfo; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringMode.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringMode.java index 5f5f84c5e74d9..34e908b8ecf3f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringMode.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringMode.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -50,7 +49,6 @@ public TieringMode() { * @param name a name to look for. * @return the corresponding TieringMode. */ - @JsonCreator public static TieringMode fromString(String name) { return fromString(name, TieringMode.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringPolicy.java index 48f501cb70b7c..3dc121f86b7f0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TieringPolicy.java @@ -5,7 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Tiering Policy for a target tier. @@ -13,28 +17,25 @@ * that tier. */ @Fluent -public final class TieringPolicy { +public final class TieringPolicy implements JsonSerializable { /* * 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 */ - @JsonProperty(value = "tieringMode") private TieringMode tieringMode; /* * Number of days/weeks/months/years to retain backups in current tier before tiering. * Used only if TieringMode is set to TierAfter */ - @JsonProperty(value = "duration") private Integer duration; /* * Retention duration type: days/weeks/months/years * Used only if TieringMode is set to TierAfter */ - @JsonProperty(value = "durationType") private RetentionDurationType durationType; /** @@ -120,4 +121,46 @@ public TieringPolicy withDurationType(RetentionDurationType durationType) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tieringMode", this.tieringMode == null ? null : this.tieringMode.toString()); + jsonWriter.writeNumberField("duration", this.duration); + jsonWriter.writeStringField("durationType", this.durationType == null ? null : this.durationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TieringPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TieringPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TieringPolicy. + */ + public static TieringPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TieringPolicy deserializedTieringPolicy = new TieringPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tieringMode".equals(fieldName)) { + deserializedTieringPolicy.tieringMode = TieringMode.fromString(reader.getString()); + } else if ("duration".equals(fieldName)) { + deserializedTieringPolicy.duration = reader.getNullable(JsonReader::getInt); + } else if ("durationType".equals(fieldName)) { + deserializedTieringPolicy.durationType = RetentionDurationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTieringPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TriggerDataMoveRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TriggerDataMoveRequest.java index af41f897f3506..f184fcbee80b8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TriggerDataMoveRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/TriggerDataMoveRequest.java @@ -6,48 +6,46 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Trigger DataMove Request. */ @Fluent -public final class TriggerDataMoveRequest { +public final class TriggerDataMoveRequest implements JsonSerializable { /* * ARM Id of source vault */ - @JsonProperty(value = "sourceResourceId", required = true) private String sourceResourceId; /* * Source Region */ - @JsonProperty(value = "sourceRegion", required = true) private String sourceRegion; /* * DataMove Level */ - @JsonProperty(value = "dataMoveLevel", required = true) private DataMoveLevel dataMoveLevel; /* * Correlation Id */ - @JsonProperty(value = "correlationId", required = true) private String correlationId; /* * Source Container ArmIds */ - @JsonProperty(value = "sourceContainerArmIds") private List sourceContainerArmIds; /* * Pause GC */ - @JsonProperty(value = "pauseGC") private Boolean pauseGC; /** @@ -205,4 +203,58 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(TriggerDataMoveRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("sourceRegion", this.sourceRegion); + jsonWriter.writeStringField("dataMoveLevel", this.dataMoveLevel == null ? null : this.dataMoveLevel.toString()); + jsonWriter.writeStringField("correlationId", this.correlationId); + jsonWriter.writeArrayField("sourceContainerArmIds", this.sourceContainerArmIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("pauseGC", this.pauseGC); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TriggerDataMoveRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TriggerDataMoveRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TriggerDataMoveRequest. + */ + public static TriggerDataMoveRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TriggerDataMoveRequest deserializedTriggerDataMoveRequest = new TriggerDataMoveRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceResourceId".equals(fieldName)) { + deserializedTriggerDataMoveRequest.sourceResourceId = reader.getString(); + } else if ("sourceRegion".equals(fieldName)) { + deserializedTriggerDataMoveRequest.sourceRegion = reader.getString(); + } else if ("dataMoveLevel".equals(fieldName)) { + deserializedTriggerDataMoveRequest.dataMoveLevel = DataMoveLevel.fromString(reader.getString()); + } else if ("correlationId".equals(fieldName)) { + deserializedTriggerDataMoveRequest.correlationId = reader.getString(); + } else if ("sourceContainerArmIds".equals(fieldName)) { + List sourceContainerArmIds = reader.readArray(reader1 -> reader1.getString()); + deserializedTriggerDataMoveRequest.sourceContainerArmIds = sourceContainerArmIds; + } else if ("pauseGC".equals(fieldName)) { + deserializedTriggerDataMoveRequest.pauseGC = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedTriggerDataMoveRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UnlockDeleteRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UnlockDeleteRequest.java index c3d5cd7be92c2..3a1b252f7fc74 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UnlockDeleteRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UnlockDeleteRequest.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Request body of unlock delete API. */ @Fluent -public final class UnlockDeleteRequest { +public final class UnlockDeleteRequest implements JsonSerializable { /* * The resourceGuardOperationRequests property. */ - @JsonProperty(value = "resourceGuardOperationRequests") private List resourceGuardOperationRequests; /* * The resourceToBeDeleted property. */ - @JsonProperty(value = "resourceToBeDeleted") private String resourceToBeDeleted; /** @@ -78,4 +80,45 @@ public UnlockDeleteRequest withResourceToBeDeleted(String resourceToBeDeleted) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGuardOperationRequests", this.resourceGuardOperationRequests, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("resourceToBeDeleted", this.resourceToBeDeleted); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnlockDeleteRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnlockDeleteRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UnlockDeleteRequest. + */ + public static UnlockDeleteRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnlockDeleteRequest deserializedUnlockDeleteRequest = new UnlockDeleteRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGuardOperationRequests".equals(fieldName)) { + List resourceGuardOperationRequests = reader.readArray(reader1 -> reader1.getString()); + deserializedUnlockDeleteRequest.resourceGuardOperationRequests = resourceGuardOperationRequests; + } else if ("resourceToBeDeleted".equals(fieldName)) { + deserializedUnlockDeleteRequest.resourceToBeDeleted = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUnlockDeleteRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UpdateRecoveryPointRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UpdateRecoveryPointRequest.java new file mode 100644 index 0000000000000..438db14d5faef --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UpdateRecoveryPointRequest.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Patch Request content to update recovery point for given RecoveryPointId. + */ +@Fluent +public final class UpdateRecoveryPointRequest implements JsonSerializable { + /* + * Resource properties. + */ + private PatchRecoveryPointInput properties; + + /** + * Creates an instance of UpdateRecoveryPointRequest class. + */ + public UpdateRecoveryPointRequest() { + } + + /** + * Get the properties property: Resource properties. + * + * @return the properties value. + */ + public PatchRecoveryPointInput properties() { + return this.properties; + } + + /** + * Set the properties property: Resource properties. + * + * @param properties the properties value to set. + * @return the UpdateRecoveryPointRequest object itself. + */ + public UpdateRecoveryPointRequest withProperties(PatchRecoveryPointInput properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateRecoveryPointRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateRecoveryPointRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateRecoveryPointRequest. + */ + public static UpdateRecoveryPointRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateRecoveryPointRequest deserializedUpdateRecoveryPointRequest = new UpdateRecoveryPointRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedUpdateRecoveryPointRequest.properties = PatchRecoveryPointInput.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateRecoveryPointRequest; + }); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UsagesUnit.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UsagesUnit.java index af14d7b715aad..a55027647ad12 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UsagesUnit.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UsagesUnit.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -57,7 +56,6 @@ public UsagesUnit() { * @param name a name to look for. * @return the corresponding UsagesUnit. */ - @JsonCreator public static UsagesUnit fromString(String name) { return fromString(name, UsagesUnit.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedIdentityProperties.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedIdentityProperties.java index 92032272d2557..2a2af1a682ef9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedIdentityProperties.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedIdentityProperties.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * User assigned managed identity properties. */ @Fluent -public final class UserAssignedIdentityProperties { +public final class UserAssignedIdentityProperties implements JsonSerializable { /* * The client ID of the assigned identity. */ - @JsonProperty(value = "clientId") private String clientId; /* * The principal ID of the assigned identity. */ - @JsonProperty(value = "principalId") private String principalId; /** @@ -77,4 +79,44 @@ public UserAssignedIdentityProperties withPrincipalId(String principalId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("clientId", this.clientId); + jsonWriter.writeStringField("principalId", this.principalId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentityProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentityProperties. + */ + public static UserAssignedIdentityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentityProperties deserializedUserAssignedIdentityProperties + = new UserAssignedIdentityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentityProperties.clientId = reader.getString(); + } else if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentityProperties.principalId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentityProperties; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedManagedIdentityDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedManagedIdentityDetails.java index a9e4d2c112ced..4e9029272b283 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedManagedIdentityDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/UserAssignedManagedIdentityDetails.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * User assigned managed identity details. */ @Fluent -public final class UserAssignedManagedIdentityDetails { +public final class UserAssignedManagedIdentityDetails implements JsonSerializable { /* * The ARM id of the assigned identity. */ - @JsonProperty(value = "identityArmId") private String identityArmId; /* * The name of the assigned identity. */ - @JsonProperty(value = "identityName") private String identityName; /* * User assigned managed identity properties */ - @JsonProperty(value = "userAssignedIdentityProperties") private UserAssignedIdentityProperties userAssignedIdentityProperties; /** @@ -107,4 +108,48 @@ public void validate() { userAssignedIdentityProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("identityArmId", this.identityArmId); + jsonWriter.writeStringField("identityName", this.identityName); + jsonWriter.writeJsonField("userAssignedIdentityProperties", this.userAssignedIdentityProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedManagedIdentityDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedManagedIdentityDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedManagedIdentityDetails. + */ + public static UserAssignedManagedIdentityDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedManagedIdentityDetails deserializedUserAssignedManagedIdentityDetails + = new UserAssignedManagedIdentityDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identityArmId".equals(fieldName)) { + deserializedUserAssignedManagedIdentityDetails.identityArmId = reader.getString(); + } else if ("identityName".equals(fieldName)) { + deserializedUserAssignedManagedIdentityDetails.identityName = reader.getString(); + } else if ("userAssignedIdentityProperties".equals(fieldName)) { + deserializedUserAssignedManagedIdentityDetails.userAssignedIdentityProperties + = UserAssignedIdentityProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedManagedIdentityDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VMWorkloadPolicyType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VMWorkloadPolicyType.java new file mode 100644 index 0000000000000..99b5bf68917cf --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VMWorkloadPolicyType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of workload for the backup management. + */ +public final class VMWorkloadPolicyType extends ExpandableStringEnum { + /** + * Static value Invalid for VMWorkloadPolicyType. + */ + public static final VMWorkloadPolicyType INVALID = fromString("Invalid"); + + /** + * Static value SnapshotV1 for VMWorkloadPolicyType. + */ + public static final VMWorkloadPolicyType SNAPSHOT_V1 = fromString("SnapshotV1"); + + /** + * Static value SnapshotV2 for VMWorkloadPolicyType. + */ + public static final VMWorkloadPolicyType SNAPSHOT_V2 = fromString("SnapshotV2"); + + /** + * Static value Streaming for VMWorkloadPolicyType. + */ + public static final VMWorkloadPolicyType STREAMING = fromString("Streaming"); + + /** + * Creates a new instance of VMWorkloadPolicyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VMWorkloadPolicyType() { + } + + /** + * Creates or finds a VMWorkloadPolicyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMWorkloadPolicyType. + */ + public static VMWorkloadPolicyType fromString(String name) { + return fromString(name, VMWorkloadPolicyType.class); + } + + /** + * Gets known VMWorkloadPolicyType values. + * + * @return known VMWorkloadPolicyType values. + */ + public static Collection values() { + return values(VMWorkloadPolicyType.class); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateIaasVMRestoreOperationRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateIaasVMRestoreOperationRequest.java index 50847eab511f9..b79c684d22e63 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateIaasVMRestoreOperationRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateIaasVMRestoreOperationRequest.java @@ -5,27 +5,20 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * AzureRestoreValidation request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = ValidateIaasVMRestoreOperationRequest.class, - visible = true) -@JsonTypeName("ValidateIaasVMRestoreOperationRequest") @Fluent public final class ValidateIaasVMRestoreOperationRequest extends ValidateRestoreOperationRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "ValidateIaasVMRestoreOperationRequest"; /** @@ -61,6 +54,49 @@ public ValidateIaasVMRestoreOperationRequest withRestoreRequest(RestoreRequest r */ @Override public void validate() { - super.validate(); + if (restoreRequest() != null) { + restoreRequest().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("restoreRequest", restoreRequest()); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ValidateIaasVMRestoreOperationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ValidateIaasVMRestoreOperationRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ValidateIaasVMRestoreOperationRequest. + */ + public static ValidateIaasVMRestoreOperationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ValidateIaasVMRestoreOperationRequest deserializedValidateIaasVMRestoreOperationRequest + = new ValidateIaasVMRestoreOperationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("restoreRequest".equals(fieldName)) { + deserializedValidateIaasVMRestoreOperationRequest + .withRestoreRequest(RestoreRequest.fromJson(reader)); + } else if ("objectType".equals(fieldName)) { + deserializedValidateIaasVMRestoreOperationRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedValidateIaasVMRestoreOperationRequest; + }); } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequest.java index 82670918f8f7b..b323efd49a809 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequest.java @@ -5,37 +5,27 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for validate operation request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = ValidateOperationRequest.class, - visible = true) -@JsonTypeName("ValidateOperationRequest") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "ValidateRestoreOperationRequest", value = ValidateRestoreOperationRequest.class) }) @Immutable -public class ValidateOperationRequest { +public class ValidateOperationRequest implements JsonSerializable { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) - private String objectType; + private String objectType = "ValidateOperationRequest"; /** * Creates an instance of ValidateOperationRequest class. */ public ValidateOperationRequest() { - this.objectType = "ValidateOperationRequest"; } /** @@ -55,4 +45,67 @@ public String objectType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ValidateOperationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ValidateOperationRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ValidateOperationRequest. + */ + public static ValidateOperationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("ValidateRestoreOperationRequest".equals(discriminatorValue)) { + return ValidateRestoreOperationRequest.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("ValidateIaasVMRestoreOperationRequest".equals(discriminatorValue)) { + return ValidateIaasVMRestoreOperationRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ValidateOperationRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ValidateOperationRequest deserializedValidateOperationRequest = new ValidateOperationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedValidateOperationRequest.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedValidateOperationRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequestResource.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequestResource.java index f324817b8d8f1..d9569eb720aa0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequestResource.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationRequestResource.java @@ -6,23 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for validate operation request. */ @Fluent -public final class ValidateOperationRequestResource { +public final class ValidateOperationRequestResource implements JsonSerializable { /* * Recovery point ID. */ - @JsonProperty(value = "id", required = true) private String id; /* * ValidateOperationRequestResource properties */ - @JsonProperty(value = "properties", required = true) private ValidateOperationRequest properties; /** @@ -92,4 +94,45 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(ValidateOperationRequestResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ValidateOperationRequestResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ValidateOperationRequestResource if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ValidateOperationRequestResource. + */ + public static ValidateOperationRequestResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ValidateOperationRequestResource deserializedValidateOperationRequestResource + = new ValidateOperationRequestResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedValidateOperationRequestResource.id = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedValidateOperationRequestResource.properties = ValidateOperationRequest.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedValidateOperationRequestResource; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationResponse.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationResponse.java index 00751630b1ff4..b2aef590deffb 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationResponse.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateOperationResponse.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Base class for validate operation response. */ @Fluent -public final class ValidateOperationResponse { +public final class ValidateOperationResponse implements JsonSerializable { /* * Gets the validation result */ - @JsonProperty(value = "validationResults") private List validationResults; /** @@ -55,4 +58,42 @@ public void validate() { validationResults().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("validationResults", this.validationResults, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ValidateOperationResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ValidateOperationResponse if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ValidateOperationResponse. + */ + public static ValidateOperationResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ValidateOperationResponse deserializedValidateOperationResponse = new ValidateOperationResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("validationResults".equals(fieldName)) { + List validationResults = reader.readArray(reader1 -> ErrorDetail.fromJson(reader1)); + deserializedValidateOperationResponse.validationResults = validationResults; + } else { + reader.skipChildren(); + } + } + + return deserializedValidateOperationResponse; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateRestoreOperationRequest.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateRestoreOperationRequest.java index 4b326996a8cd0..942c45750ee3b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateRestoreOperationRequest.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidateRestoreOperationRequest.java @@ -5,38 +5,25 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * AzureRestoreValidation request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "objectType", - defaultImpl = ValidateRestoreOperationRequest.class, - visible = true) -@JsonTypeName("ValidateRestoreOperationRequest") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "ValidateIaasVMRestoreOperationRequest", - value = ValidateIaasVMRestoreOperationRequest.class) }) @Fluent public class ValidateRestoreOperationRequest extends ValidateOperationRequest { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "objectType", required = true) private String objectType = "ValidateRestoreOperationRequest"; /* * Sets restore request to be validated */ - @JsonProperty(value = "restoreRequest") private RestoreRequest restoreRequest; /** @@ -83,9 +70,73 @@ public ValidateRestoreOperationRequest withRestoreRequest(RestoreRequest restore */ @Override public void validate() { - super.validate(); if (restoreRequest() != null) { restoreRequest().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("objectType", this.objectType); + jsonWriter.writeJsonField("restoreRequest", this.restoreRequest); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ValidateRestoreOperationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ValidateRestoreOperationRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ValidateRestoreOperationRequest. + */ + public static ValidateRestoreOperationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("objectType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("ValidateIaasVMRestoreOperationRequest".equals(discriminatorValue)) { + return ValidateIaasVMRestoreOperationRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ValidateRestoreOperationRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ValidateRestoreOperationRequest deserializedValidateRestoreOperationRequest + = new ValidateRestoreOperationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("objectType".equals(fieldName)) { + deserializedValidateRestoreOperationRequest.objectType = reader.getString(); + } else if ("restoreRequest".equals(fieldName)) { + deserializedValidateRestoreOperationRequest.restoreRequest = RestoreRequest.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedValidateRestoreOperationRequest; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidationStatus.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidationStatus.java index 4fb619837f6d4..53caf131c890f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidationStatus.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/ValidationStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public ValidationStatus() { * @param name a name to look for. * @return the corresponding ValidationStatus. */ - @JsonCreator public static ValidationStatus fromString(String name) { return fromString(name, ValidationStatus.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJob.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJob.java index 9cdd935001b9e..545e0d3d66f09 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJob.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJob.java @@ -5,50 +5,45 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Vault level Job. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "jobType", defaultImpl = VaultJob.class, visible = true) -@JsonTypeName("VaultJob") @Fluent public final class VaultJob extends Job { /* - * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. + * This property will be used as the discriminator for deciding the specific types in the polymorphic chain of + * types. */ - @JsonTypeId - @JsonProperty(value = "jobType", required = true) private String jobType = "VaultJob"; /* * Time elapsed during the execution of this job. */ - @JsonProperty(value = "duration") private Duration duration; /* * Gets or sets the state/actions applicable on this job like cancel/retry. */ - @JsonProperty(value = "actionsInfo") private List actionsInfo; /* * Error details on execution of this job. */ - @JsonProperty(value = "errorDetails") private List errorDetails; /* * Additional information about the job. */ - @JsonProperty(value = "extendedInfo") private VaultJobExtendedInfo extendedInfo; /** @@ -218,7 +213,6 @@ public VaultJob withActivityId(String activityId) { */ @Override public void validate() { - super.validate(); if (errorDetails() != null) { errorDetails().forEach(e -> e.validate()); } @@ -226,4 +220,84 @@ public void validate() { extendedInfo().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityFriendlyName", entityFriendlyName()); + jsonWriter.writeStringField("backupManagementType", + backupManagementType() == null ? null : backupManagementType().toString()); + jsonWriter.writeStringField("operation", operation()); + jsonWriter.writeStringField("status", status()); + jsonWriter.writeStringField("startTime", + startTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(startTime())); + jsonWriter.writeStringField("endTime", + endTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(endTime())); + jsonWriter.writeStringField("activityId", activityId()); + jsonWriter.writeStringField("jobType", this.jobType); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeArrayField("actionsInfo", this.actionsInfo, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("errorDetails", this.errorDetails, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("extendedInfo", this.extendedInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultJob if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the VaultJob. + */ + public static VaultJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultJob deserializedVaultJob = new VaultJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityFriendlyName".equals(fieldName)) { + deserializedVaultJob.withEntityFriendlyName(reader.getString()); + } else if ("backupManagementType".equals(fieldName)) { + deserializedVaultJob.withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("operation".equals(fieldName)) { + deserializedVaultJob.withOperation(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedVaultJob.withStatus(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedVaultJob.withStartTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("endTime".equals(fieldName)) { + deserializedVaultJob.withEndTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("activityId".equals(fieldName)) { + deserializedVaultJob.withActivityId(reader.getString()); + } else if ("jobType".equals(fieldName)) { + deserializedVaultJob.jobType = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedVaultJob.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("actionsInfo".equals(fieldName)) { + List actionsInfo + = reader.readArray(reader1 -> JobSupportedAction.fromString(reader1.getString())); + deserializedVaultJob.actionsInfo = actionsInfo; + } else if ("errorDetails".equals(fieldName)) { + List errorDetails + = reader.readArray(reader1 -> VaultJobErrorInfo.fromJson(reader1)); + deserializedVaultJob.errorDetails = errorDetails; + } else if ("extendedInfo".equals(fieldName)) { + deserializedVaultJob.extendedInfo = VaultJobExtendedInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultJob; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobErrorInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobErrorInfo.java index 4247b85792114..cf9b41675e22d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobErrorInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobErrorInfo.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Vault Job specific error information. */ @Fluent -public final class VaultJobErrorInfo { +public final class VaultJobErrorInfo implements JsonSerializable { /* * Error code. */ - @JsonProperty(value = "errorCode") private Integer errorCode; /* * Localized error string. */ - @JsonProperty(value = "errorString") private String errorString; /* * List of localized recommendations for above error code. */ - @JsonProperty(value = "recommendations") private List recommendations; /** @@ -104,4 +105,48 @@ public VaultJobErrorInfo withRecommendations(List recommendations) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorString", this.errorString); + jsonWriter.writeArrayField("recommendations", this.recommendations, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultJobErrorInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultJobErrorInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the VaultJobErrorInfo. + */ + public static VaultJobErrorInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultJobErrorInfo deserializedVaultJobErrorInfo = new VaultJobErrorInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedVaultJobErrorInfo.errorCode = reader.getNullable(JsonReader::getInt); + } else if ("errorString".equals(fieldName)) { + deserializedVaultJobErrorInfo.errorString = reader.getString(); + } else if ("recommendations".equals(fieldName)) { + List recommendations = reader.readArray(reader1 -> reader1.getString()); + deserializedVaultJobErrorInfo.recommendations = recommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedVaultJobErrorInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobExtendedInfo.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobExtendedInfo.java index 8cdf8fad78406..fcd8f8e68c8db 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobExtendedInfo.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultJobExtendedInfo.java @@ -5,20 +5,21 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** * Vault Job for CMK - has CMK specific info. */ @Fluent -public final class VaultJobExtendedInfo { +public final class VaultJobExtendedInfo implements JsonSerializable { /* * Job properties. */ - @JsonProperty(value = "propertyBag") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map propertyBag; /** @@ -54,4 +55,41 @@ public VaultJobExtendedInfo withPropertyBag(Map propertyBag) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("propertyBag", this.propertyBag, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultJobExtendedInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultJobExtendedInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the VaultJobExtendedInfo. + */ + public static VaultJobExtendedInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultJobExtendedInfo deserializedVaultJobExtendedInfo = new VaultJobExtendedInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyBag".equals(fieldName)) { + Map propertyBag = reader.readMap(reader1 -> reader1.getString()); + deserializedVaultJobExtendedInfo.propertyBag = propertyBag; + } else { + reader.skipChildren(); + } + } + + return deserializedVaultJobExtendedInfo; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultRetentionPolicy.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultRetentionPolicy.java index 53da4ed3b6b6c..1cb65432692e6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultRetentionPolicy.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultRetentionPolicy.java @@ -6,23 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Vault retention policy for AzureFileShare. */ @Fluent -public final class VaultRetentionPolicy { +public final class VaultRetentionPolicy implements JsonSerializable { /* * Base class for retention policy. */ - @JsonProperty(value = "vaultRetention", required = true) private RetentionPolicy vaultRetention; /* * The snapshotRetentionInDays property. */ - @JsonProperty(value = "snapshotRetentionInDays", required = true) private int snapshotRetentionInDays; /** @@ -87,4 +89,44 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(VaultRetentionPolicy.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("vaultRetention", this.vaultRetention); + jsonWriter.writeIntField("snapshotRetentionInDays", this.snapshotRetentionInDays); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultRetentionPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultRetentionPolicy if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VaultRetentionPolicy. + */ + public static VaultRetentionPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultRetentionPolicy deserializedVaultRetentionPolicy = new VaultRetentionPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vaultRetention".equals(fieldName)) { + deserializedVaultRetentionPolicy.vaultRetention = RetentionPolicy.fromJson(reader); + } else if ("snapshotRetentionInDays".equals(fieldName)) { + deserializedVaultRetentionPolicy.snapshotRetentionInDays = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultRetentionPolicy; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultSubResourceType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultSubResourceType.java index 9f749a74b1058..c1df681691cbe 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultSubResourceType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/VaultSubResourceType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public VaultSubResourceType() { * @param name a name to look for. * @return the corresponding VaultSubResourceType. */ - @JsonCreator public static VaultSubResourceType fromString(String name) { return fromString(name, VaultSubResourceType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeekOfMonth.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeekOfMonth.java index 4eecf47e448b8..6bd3b74337098 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeekOfMonth.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeekOfMonth.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * Defines values for WeekOfMonth. */ @@ -56,7 +53,6 @@ public enum WeekOfMonth { * @param value the serialized value to parse. * @return the parsed WeekOfMonth object, or null if unable to parse. */ - @JsonCreator public static WeekOfMonth fromString(String value) { if (value == null) { return null; @@ -73,7 +69,6 @@ public static WeekOfMonth fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionFormat.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionFormat.java index 7efe516f4857f..0bd660cd7ae77 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionFormat.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionFormat.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Weekly retention format. */ @Fluent -public final class WeeklyRetentionFormat { +public final class WeeklyRetentionFormat implements JsonSerializable { /* * List of days of the week. */ - @JsonProperty(value = "daysOfTheWeek") private List daysOfTheWeek; /* * List of weeks of month. */ - @JsonProperty(value = "weeksOfTheMonth") private List weeksOfTheMonth; /** @@ -78,4 +80,49 @@ public WeeklyRetentionFormat withWeeksOfTheMonth(List weeksOfTheMon */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("daysOfTheWeek", this.daysOfTheWeek, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("weeksOfTheMonth", this.weeksOfTheMonth, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WeeklyRetentionFormat from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WeeklyRetentionFormat if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the WeeklyRetentionFormat. + */ + public static WeeklyRetentionFormat fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WeeklyRetentionFormat deserializedWeeklyRetentionFormat = new WeeklyRetentionFormat(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("daysOfTheWeek".equals(fieldName)) { + List daysOfTheWeek + = reader.readArray(reader1 -> DayOfWeek.fromString(reader1.getString())); + deserializedWeeklyRetentionFormat.daysOfTheWeek = daysOfTheWeek; + } else if ("weeksOfTheMonth".equals(fieldName)) { + List weeksOfTheMonth + = reader.readArray(reader1 -> WeekOfMonth.fromString(reader1.getString())); + deserializedWeeklyRetentionFormat.weeksOfTheMonth = weeksOfTheMonth; + } else { + reader.skipChildren(); + } + } + + return deserializedWeeklyRetentionFormat; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionSchedule.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionSchedule.java index 62138c51cb7c8..7b1f308a8ac72 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionSchedule.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklyRetentionSchedule.java @@ -5,31 +5,34 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Weekly retention schedule. */ @Fluent -public final class WeeklyRetentionSchedule { +public final class WeeklyRetentionSchedule implements JsonSerializable { /* * List of days of week for weekly retention policy. */ - @JsonProperty(value = "daysOfTheWeek") private List daysOfTheWeek; /* * Retention times of retention policy. */ - @JsonProperty(value = "retentionTimes") private List retentionTimes; /* * Retention duration of retention Policy. */ - @JsonProperty(value = "retentionDuration") private RetentionDuration retentionDuration; /** @@ -108,4 +111,52 @@ public void validate() { retentionDuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("daysOfTheWeek", this.daysOfTheWeek, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("retentionTimes", this.retentionTimes, (writer, element) -> writer + .writeString(element == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(element))); + jsonWriter.writeJsonField("retentionDuration", this.retentionDuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WeeklyRetentionSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WeeklyRetentionSchedule if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the WeeklyRetentionSchedule. + */ + public static WeeklyRetentionSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WeeklyRetentionSchedule deserializedWeeklyRetentionSchedule = new WeeklyRetentionSchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("daysOfTheWeek".equals(fieldName)) { + List daysOfTheWeek + = reader.readArray(reader1 -> DayOfWeek.fromString(reader1.getString())); + deserializedWeeklyRetentionSchedule.daysOfTheWeek = daysOfTheWeek; + } else if ("retentionTimes".equals(fieldName)) { + List retentionTimes = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + deserializedWeeklyRetentionSchedule.retentionTimes = retentionTimes; + } else if ("retentionDuration".equals(fieldName)) { + deserializedWeeklyRetentionSchedule.retentionDuration = RetentionDuration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWeeklyRetentionSchedule; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklySchedule.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklySchedule.java index 302f43b7735af..06043316b5cac 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklySchedule.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WeeklySchedule.java @@ -5,25 +5,29 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * The WeeklySchedule model. */ @Fluent -public final class WeeklySchedule { +public final class WeeklySchedule implements JsonSerializable { /* * The scheduleRunDays property. */ - @JsonProperty(value = "scheduleRunDays") private List scheduleRunDays; /* * List of times of day this schedule has to be run. */ - @JsonProperty(value = "scheduleRunTimes") private List scheduleRunTimes; /** @@ -79,4 +83,49 @@ public WeeklySchedule withScheduleRunTimes(List scheduleRunTimes */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("scheduleRunDays", this.scheduleRunDays, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("scheduleRunTimes", this.scheduleRunTimes, (writer, element) -> writer + .writeString(element == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(element))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WeeklySchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WeeklySchedule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the WeeklySchedule. + */ + public static WeeklySchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WeeklySchedule deserializedWeeklySchedule = new WeeklySchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("scheduleRunDays".equals(fieldName)) { + List scheduleRunDays + = reader.readArray(reader1 -> DayOfWeek.fromString(reader1.getString())); + deserializedWeeklySchedule.scheduleRunDays = scheduleRunDays; + } else if ("scheduleRunTimes".equals(fieldName)) { + List scheduleRunTimes = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + deserializedWeeklySchedule.scheduleRunTimes = scheduleRunTimes; + } else { + reader.skipChildren(); + } + } + + return deserializedWeeklySchedule; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadInquiryDetails.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadInquiryDetails.java index 3aa280dd21d64..22f4ee0c85ac3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadInquiryDetails.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadInquiryDetails.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Details of an inquired protectable item. */ @Fluent -public final class WorkloadInquiryDetails { +public final class WorkloadInquiryDetails implements JsonSerializable { /* * Type of the Workload such as SQL, Oracle etc. */ - @JsonProperty(value = "type") private String type; /* * Contains the protectable item Count inside this Container. */ - @JsonProperty(value = "itemCount") private Long itemCount; /* * Inquiry validation such as permissions and other backup validations. */ - @JsonProperty(value = "inquiryValidation") private InquiryValidation inquiryValidation; /** @@ -106,4 +107,46 @@ public void validate() { inquiryValidation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeNumberField("itemCount", this.itemCount); + jsonWriter.writeJsonField("inquiryValidation", this.inquiryValidation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadInquiryDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadInquiryDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadInquiryDetails. + */ + public static WorkloadInquiryDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadInquiryDetails deserializedWorkloadInquiryDetails = new WorkloadInquiryDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedWorkloadInquiryDetails.type = reader.getString(); + } else if ("itemCount".equals(fieldName)) { + deserializedWorkloadInquiryDetails.itemCount = reader.getNullable(JsonReader::getLong); + } else if ("inquiryValidation".equals(fieldName)) { + deserializedWorkloadInquiryDetails.inquiryValidation = InquiryValidation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadInquiryDetails; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItem.java index 7ceabb1d3848e..eef05cf6c1563 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItem.java @@ -5,60 +5,46 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Base class for backup item. Workload-specific backup items are derived from this class. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "workloadItemType", - defaultImpl = WorkloadItem.class, - visible = true) -@JsonTypeName("WorkloadItem") -@JsonSubTypes({ @JsonSubTypes.Type(name = "AzureVmWorkloadItem", value = AzureVmWorkloadItem.class) }) @Fluent -public class WorkloadItem { +public class WorkloadItem implements JsonSerializable { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "workloadItemType", required = true) - private String workloadItemType; + private String workloadItemType = "WorkloadItem"; /* * Type of backup management to backup an item. */ - @JsonProperty(value = "backupManagementType") private String backupManagementType; /* * Type of workload for the backup management */ - @JsonProperty(value = "workloadType") private String workloadType; /* * Friendly name of the backup item. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * State of the back up item. */ - @JsonProperty(value = "protectionState") private ProtectionStatus protectionState; /** * Creates an instance of WorkloadItem class. */ public WorkloadItem() { - this.workloadItemType = "WorkloadItem"; } /** @@ -157,4 +143,94 @@ public WorkloadItem withProtectionState(ProtectionStatus protectionState) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("workloadItemType", this.workloadItemType); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeStringField("workloadType", this.workloadType); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadItem. + */ + public static WorkloadItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("workloadItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureVmWorkloadItem".equals(discriminatorValue)) { + return AzureVmWorkloadItem.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("SAPAseDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SAPAseSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseSystemWorkloadItem.fromJson(readerToUse.reset()); + } else if ("OracleDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadOracleDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("AnyDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadAnyDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaSystemWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SQLDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadSqlDatabaseWorkloadItem.fromJson(readerToUse.reset()); + } else if ("SQLInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSqlInstanceWorkloadItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static WorkloadItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadItem deserializedWorkloadItem = new WorkloadItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workloadItemType".equals(fieldName)) { + deserializedWorkloadItem.workloadItemType = reader.getString(); + } else if ("backupManagementType".equals(fieldName)) { + deserializedWorkloadItem.backupManagementType = reader.getString(); + } else if ("workloadType".equals(fieldName)) { + deserializedWorkloadItem.workloadType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedWorkloadItem.friendlyName = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedWorkloadItem.protectionState = ProtectionStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemResourceList.java index 27d832a0b7870..4e397ea8e99a8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadItemResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class WorkloadItemResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,49 @@ public WorkloadItemResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadItemResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadItemResourceList if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadItemResourceList. + */ + public static WorkloadItemResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadItemResourceList deserializedWorkloadItemResourceList = new WorkloadItemResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedWorkloadItemResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkloadItemResourceInner.fromJson(reader1)); + deserializedWorkloadItemResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadItemResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemType.java index 715dd59cb6b90..fcdc8bdffd377 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadItemType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,6 +51,26 @@ public final class WorkloadItemType extends ExpandableStringEnum { /* * Type of the backup item. */ - @JsonTypeId - @JsonProperty(value = "protectableItemType", required = true) - private String protectableItemType; + private String protectableItemType = "WorkloadProtectableItem"; /* * Type of backup management to backup an item. */ - @JsonProperty(value = "backupManagementType") private String backupManagementType; /* * Type of workload for the backup management */ - @JsonProperty(value = "workloadType") private String workloadType; /* * Friendly name of the backup item. */ - @JsonProperty(value = "friendlyName") private String friendlyName; /* * State of the back up item. */ - @JsonProperty(value = "protectionState") private ProtectionStatus protectionState; /** * Creates an instance of WorkloadProtectableItem class. */ public WorkloadProtectableItem() { - this.protectableItemType = "WorkloadProtectableItem"; } /** @@ -160,4 +143,109 @@ public WorkloadProtectableItem withProtectionState(ProtectionStatus protectionSt */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("protectableItemType", this.protectableItemType); + jsonWriter.writeStringField("backupManagementType", this.backupManagementType); + jsonWriter.writeStringField("workloadType", this.workloadType); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("protectionState", + this.protectionState == null ? null : this.protectionState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadProtectableItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadProtectableItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadProtectableItem. + */ + public static WorkloadProtectableItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("protectableItemType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureFileShare".equals(discriminatorValue)) { + return AzureFileShareProtectableItem.fromJson(readerToUse.reset()); + } else if ("IaaSVMProtectableItem".equals(discriminatorValue)) { + return IaaSvmProtectableItem.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("Microsoft.ClassicCompute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSClassicComputeVMProtectableItem.fromJson(readerToUse.reset()); + } else if ("Microsoft.Compute/virtualMachines".equals(discriminatorValue)) { + return AzureIaaSComputeVMProtectableItem.fromJson(readerToUse.reset()); + } else if ("AzureVmWorkloadProtectableItem".equals(discriminatorValue)) { + return AzureVmWorkloadProtectableItem.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("SAPAseSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapAseSystemProtectableItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaSystem".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaSystemProtectableItem.fromJson(readerToUse.reset()); + } else if ("SAPHanaDBInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaDBInstance.fromJson(readerToUse.reset()); + } else if ("HanaHSRContainer".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaHsr.fromJson(readerToUse.reset()); + } else if ("OracleDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadOracleDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("AnyDatabase".equals(discriminatorValue)) { + return AzureVmWorkloadAnyDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("HanaScaleoutContainer".equals(discriminatorValue)) { + return AzureVmWorkloadSapHanaScaleoutProtectableItem.fromJson(readerToUse.reset()); + } else if ("SQLAvailabilityGroupContainer".equals(discriminatorValue)) { + return AzureVmWorkloadSqlAvailabilityGroupProtectableItem.fromJson(readerToUse.reset()); + } else if ("SQLDataBase".equals(discriminatorValue)) { + return AzureVmWorkloadSqlDatabaseProtectableItem.fromJson(readerToUse.reset()); + } else if ("SQLInstance".equals(discriminatorValue)) { + return AzureVmWorkloadSqlInstanceProtectableItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static WorkloadProtectableItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadProtectableItem deserializedWorkloadProtectableItem = new WorkloadProtectableItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protectableItemType".equals(fieldName)) { + deserializedWorkloadProtectableItem.protectableItemType = reader.getString(); + } else if ("backupManagementType".equals(fieldName)) { + deserializedWorkloadProtectableItem.backupManagementType = reader.getString(); + } else if ("workloadType".equals(fieldName)) { + deserializedWorkloadProtectableItem.workloadType = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedWorkloadProtectableItem.friendlyName = reader.getString(); + } else if ("protectionState".equals(fieldName)) { + deserializedWorkloadProtectableItem.protectionState + = ProtectionStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadProtectableItem; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItemResourceList.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItemResourceList.java index 0bf19397ae1e8..f278aafff466e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItemResourceList.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItemResourceList.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadProtectableItemResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -17,7 +20,6 @@ public final class WorkloadProtectableItemResourceList extends ResourceList { /* * List of resources. */ - @JsonProperty(value = "value") private List value; /** @@ -62,9 +64,50 @@ public WorkloadProtectableItemResourceList withNextLink(String nextLink) { */ @Override public void validate() { - super.validate(); if (value() != null) { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", nextLink()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadProtectableItemResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadProtectableItemResourceList if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadProtectableItemResourceList. + */ + public static WorkloadProtectableItemResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadProtectableItemResourceList deserializedWorkloadProtectableItemResourceList + = new WorkloadProtectableItemResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nextLink".equals(fieldName)) { + deserializedWorkloadProtectableItemResourceList.withNextLink(reader.getString()); + } else if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkloadProtectableItemResourceInner.fromJson(reader1)); + deserializedWorkloadProtectableItemResourceList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadProtectableItemResourceList; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadType.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadType.java index c45d555b97734..f8603daf46fae 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadType.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -107,7 +106,6 @@ public WorkloadType() { * @param name a name to look for. * @return the corresponding WorkloadType. */ - @JsonCreator public static WorkloadType fromString(String name) { return fromString(name, WorkloadType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/XcoolState.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/XcoolState.java index 08cedb6717544..a0f315b88eadf 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/XcoolState.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/XcoolState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public XcoolState() { * @param name a name to look for. * @return the corresponding XcoolState. */ - @JsonCreator public static XcoolState fromString(String name) { return fromString(name, XcoolState.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/YearlyRetentionSchedule.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/YearlyRetentionSchedule.java index 95fb5b751f85e..d423059169485 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/YearlyRetentionSchedule.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/YearlyRetentionSchedule.java @@ -5,49 +5,49 @@ package com.azure.resourcemanager.recoveryservicesbackup.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Yearly retention schedule. */ @Fluent -public final class YearlyRetentionSchedule { +public final class YearlyRetentionSchedule implements JsonSerializable { /* * Retention schedule format for yearly retention policy. */ - @JsonProperty(value = "retentionScheduleFormatType") private RetentionScheduleFormat retentionScheduleFormatType; /* * List of months of year of yearly retention policy. */ - @JsonProperty(value = "monthsOfYear") private List monthsOfYear; /* * Daily retention format for yearly retention policy. */ - @JsonProperty(value = "retentionScheduleDaily") private DailyRetentionFormat retentionScheduleDaily; /* * Weekly retention format for yearly retention policy. */ - @JsonProperty(value = "retentionScheduleWeekly") private WeeklyRetentionFormat retentionScheduleWeekly; /* * Retention times of retention policy. */ - @JsonProperty(value = "retentionTimes") private List retentionTimes; /* * Retention duration of retention Policy. */ - @JsonProperty(value = "retentionDuration") private RetentionDuration retentionDuration; /** @@ -193,4 +193,64 @@ public void validate() { retentionDuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("retentionScheduleFormatType", + this.retentionScheduleFormatType == null ? null : this.retentionScheduleFormatType.toString()); + jsonWriter.writeArrayField("monthsOfYear", this.monthsOfYear, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("retentionScheduleDaily", this.retentionScheduleDaily); + jsonWriter.writeJsonField("retentionScheduleWeekly", this.retentionScheduleWeekly); + jsonWriter.writeArrayField("retentionTimes", this.retentionTimes, (writer, element) -> writer + .writeString(element == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(element))); + jsonWriter.writeJsonField("retentionDuration", this.retentionDuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of YearlyRetentionSchedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of YearlyRetentionSchedule if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the YearlyRetentionSchedule. + */ + public static YearlyRetentionSchedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + YearlyRetentionSchedule deserializedYearlyRetentionSchedule = new YearlyRetentionSchedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionScheduleFormatType".equals(fieldName)) { + deserializedYearlyRetentionSchedule.retentionScheduleFormatType + = RetentionScheduleFormat.fromString(reader.getString()); + } else if ("monthsOfYear".equals(fieldName)) { + List monthsOfYear + = reader.readArray(reader1 -> MonthOfYear.fromString(reader1.getString())); + deserializedYearlyRetentionSchedule.monthsOfYear = monthsOfYear; + } else if ("retentionScheduleDaily".equals(fieldName)) { + deserializedYearlyRetentionSchedule.retentionScheduleDaily = DailyRetentionFormat.fromJson(reader); + } else if ("retentionScheduleWeekly".equals(fieldName)) { + deserializedYearlyRetentionSchedule.retentionScheduleWeekly + = WeeklyRetentionFormat.fromJson(reader); + } else if ("retentionTimes".equals(fieldName)) { + List retentionTimes = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + deserializedYearlyRetentionSchedule.retentionTimes = retentionTimes; + } else if ("retentionDuration".equals(fieldName)) { + deserializedYearlyRetentionSchedule.retentionDuration = RetentionDuration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedYearlyRetentionSchedule; + }); + } } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/module-info.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/module-info.java index 9031a6f554c49..0fba7f1a1b091 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/module-info.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/module-info.java @@ -10,7 +10,6 @@ exports com.azure.resourcemanager.recoveryservicesbackup.fluent.models; exports com.azure.resourcemanager.recoveryservicesbackup.models; - opens com.azure.resourcemanager.recoveryservicesbackup.fluent.models - to com.azure.core, com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.recoveryservicesbackup.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.recoveryservicesbackup.fluent.models to com.azure.core; + opens com.azure.resourcemanager.recoveryservicesbackup.models to com.azure.core; } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/proxy-config.json b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/proxy-config.json index 4437f3ef75ba4..b81e412f8d36d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/proxy-config.json +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/proxy-config.json @@ -1 +1 @@ -[ [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceStorageConfigsNonCrrsClientImpl$BackupResourceStorageConfigsNonCrrsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionIntentsClientImpl$ProtectionIntentsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupStatusClientImpl$BackupStatusService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.FeatureSupportsClientImpl$FeatureSupportsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectionIntentsClientImpl$BackupProtectionIntentsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupUsageSummariesClientImpl$BackupUsageSummariesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceVaultConfigsClientImpl$BackupResourceVaultConfigsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceEncryptionConfigsClientImpl$BackupResourceEncryptionConfigsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.PrivateEndpointsClientImpl$PrivateEndpointsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceProvidersClientImpl$ResourceProvidersService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BmsPrepareDataMoveOperationResultsClientImpl$BmsPrepareDataMoveOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemsClientImpl$ProtectedItemsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemOperationResultsClientImpl$ProtectedItemOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.RecoveryPointsClientImpl$RecoveryPointsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.RestoresClientImpl$RestoresService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupPoliciesClientImpl$BackupPoliciesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPoliciesClientImpl$ProtectionPoliciesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPolicyOperationResultsClientImpl$ProtectionPolicyOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupJobsClientImpl$BackupJobsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.JobDetailsClientImpl$JobDetailsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.JobCancellationsClientImpl$JobCancellationsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.JobOperationResultsClientImpl$JobOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ExportJobsOperationResultsClientImpl$ExportJobsOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.JobsClientImpl$JobsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectedItemsClientImpl$BackupProtectedItemsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.OperationOperationsClientImpl$OperationOperationsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationsClientImpl$ValidateOperationsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationResultsClientImpl$ValidateOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationStatusesClientImpl$ValidateOperationStatusesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupEnginesClientImpl$BackupEnginesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainerRefreshOperationResultsClientImpl$ProtectionContainerRefreshOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectableContainersClientImpl$ProtectableContainersService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainersClientImpl$ProtectionContainersService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupWorkloadItemsClientImpl$BackupWorkloadItemsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainerOperationResultsClientImpl$ProtectionContainerOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupsClientImpl$BackupsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemOperationStatusesClientImpl$ProtectedItemOperationStatusesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ItemLevelRecoveryConnectionsClientImpl$ItemLevelRecoveryConnectionsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupOperationResultsClientImpl$BackupOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupOperationStatusesClientImpl$BackupOperationStatusesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPolicyOperationStatusesClientImpl$ProtectionPolicyOperationStatusesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectableItemsClientImpl$BackupProtectableItemsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectionContainersClientImpl$BackupProtectionContainersService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.DeletedProtectionContainersClientImpl$DeletedProtectionContainersService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.SecurityPINsClientImpl$SecurityPINsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.RecoveryPointsRecommendedForMovesClientImpl$RecoveryPointsRecommendedForMovesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceGuardProxiesClientImpl$ResourceGuardProxiesService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceGuardProxyOperationsClientImpl$ResourceGuardProxyOperationsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.FetchTieringCostsClientImpl$FetchTieringCostsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.GetTieringCostOperationResultsClientImpl$GetTieringCostOperationResultsService" ], [ "com.azure.resourcemanager.recoveryservicesbackup.implementation.TieringCostOperationStatusClientImpl$TieringCostOperationStatusService" ] ] \ No newline at end of file +[["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupEnginesClientImpl$BackupEnginesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupJobsClientImpl$BackupJobsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupOperationResultsClientImpl$BackupOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupOperationStatusesClientImpl$BackupOperationStatusesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupPoliciesClientImpl$BackupPoliciesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectableItemsClientImpl$BackupProtectableItemsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectedItemsClientImpl$BackupProtectedItemsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectionContainersClientImpl$BackupProtectionContainersService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupProtectionIntentsClientImpl$BackupProtectionIntentsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceEncryptionConfigsClientImpl$BackupResourceEncryptionConfigsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceStorageConfigsNonCrrsClientImpl$BackupResourceStorageConfigsNonCrrsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupResourceVaultConfigsClientImpl$BackupResourceVaultConfigsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupStatusClientImpl$BackupStatusService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupUsageSummariesClientImpl$BackupUsageSummariesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupWorkloadItemsClientImpl$BackupWorkloadItemsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BackupsClientImpl$BackupsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.BmsPrepareDataMoveOperationResultsClientImpl$BmsPrepareDataMoveOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.DeletedProtectionContainersClientImpl$DeletedProtectionContainersService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ExportJobsOperationResultsClientImpl$ExportJobsOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.FeatureSupportsClientImpl$FeatureSupportsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.FetchTieringCostsClientImpl$FetchTieringCostsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.GetTieringCostOperationResultsClientImpl$GetTieringCostOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ItemLevelRecoveryConnectionsClientImpl$ItemLevelRecoveryConnectionsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.JobCancellationsClientImpl$JobCancellationsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.JobDetailsClientImpl$JobDetailsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.JobOperationResultsClientImpl$JobOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.JobsClientImpl$JobsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.OperationOperationsClientImpl$OperationOperationsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.PrivateEndpointsClientImpl$PrivateEndpointsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectableContainersClientImpl$ProtectableContainersService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemOperationResultsClientImpl$ProtectedItemOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemOperationStatusesClientImpl$ProtectedItemOperationStatusesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectedItemsClientImpl$ProtectedItemsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainerOperationResultsClientImpl$ProtectionContainerOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainerRefreshOperationResultsClientImpl$ProtectionContainerRefreshOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionContainersClientImpl$ProtectionContainersService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionIntentsClientImpl$ProtectionIntentsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPoliciesClientImpl$ProtectionPoliciesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPolicyOperationResultsClientImpl$ProtectionPolicyOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ProtectionPolicyOperationStatusesClientImpl$ProtectionPolicyOperationStatusesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.RecoveryPointsClientImpl$RecoveryPointsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.RecoveryPointsRecommendedForMovesClientImpl$RecoveryPointsRecommendedForMovesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceGuardProxiesClientImpl$ResourceGuardProxiesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceGuardProxyOperationsClientImpl$ResourceGuardProxyOperationsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ResourceProvidersClientImpl$ResourceProvidersService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.RestoresClientImpl$RestoresService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.SecurityPINsClientImpl$SecurityPINsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.TieringCostOperationStatusClientImpl$TieringCostOperationStatusService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationResultsClientImpl$ValidateOperationResultsService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationStatusesClientImpl$ValidateOperationStatusesService"],["com.azure.resourcemanager.recoveryservicesbackup.implementation.ValidateOperationsClientImpl$ValidateOperationsService"]] \ No newline at end of file diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/reflect-config.json b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/reflect-config.json index 444bd277bf599..0637a088a01e8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/reflect-config.json +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-recoveryservicesbackup/reflect-config.json @@ -1,1786 +1 @@ -[ { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceConfigResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfig", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PreValidateEnableBackupRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.PreValidateEnableBackupResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupStatusRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupStatusResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.FeatureSupportRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.AzureVMResourceFeatureSupportResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionIntentResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntentResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementUsageList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupManagementUsageInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.NameInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryResponse", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ClientDiscoveryValueForSingleApiInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryDisplay", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForServiceSpecification", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForLogSpecification", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceVaultConfigResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfig", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceEncryptionConfigExtendedResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceEncryptionConfigExtended", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceEncryptionConfig", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceEncryptionConfigResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.PrivateEndpointConnectionResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnection", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PrivateLinkServiceConnectionState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.OperationStatusInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusError", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PrepareDataMoveRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.VaultStorageConfigOperationResultResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TriggerDataMoveRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectedItemResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.RecoveryPointResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequestResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionPolicyResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.JobResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.JobResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.Job", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.OperationResultInfoBaseResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationResultInfoBase", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationWorkerResponse", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationRequestResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ValidateOperationsResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationResponse", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ErrorDetail", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBaseResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupEngineBaseResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBase", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainerResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectableContainerResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionContainerResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItemResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadItemResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupRequestResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequestResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItemResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadProtectableItemResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SecurityPinBase", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.TokenInformationInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MoveRPAcrossTiersRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ListRecoveryPointsRecommendedForMoveRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBaseResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ResourceGuardProxyBaseResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBase", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardOperationDetail", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.UnlockDeleteRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.UnlockDeleteResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostInfoRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.fluent.models.TieringCostInfoInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileshareProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.KpiResourceHealthDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ResourceHealthDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileshareProtectedItemExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RestoreFileSpecs", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TargetAfsRestoreInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.Settings", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SubProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TieringPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotBackupAdditionalDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.VaultRetentionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSClassicComputeVMProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmHealthDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmProtectedItemExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ExtendedProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DiskExclusionProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSComputeVMProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmErrorInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmJob", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmJobExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmJobTaskDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmJobV2", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.InstantRPAdditionalDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlProtectedItemExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageErrorInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageJob", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageJobExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageJobTaskDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadProtectedItemExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DistributedNodesInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapAseDatabaseProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaDatabaseProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaDBInstanceProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlDatabaseProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadErrorInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadJob", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadJobExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadJobTaskDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadPointInTimeRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PointInTimeRange", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformation", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadPointInTimeRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaPointInTimeRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaPointInTimeRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlPointInTimeRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRecoveryPointExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectory", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlPointInTimeRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryMapping", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BekDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DiskInformation", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionFormat", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.Day", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionSchedule", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmErrorInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmJob", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmJobExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmJobTaskDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmProtectedItemExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.EncryptionDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ExportJobsOperationResultInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.GenericProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.HourlySchedule", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DailySchedule", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WeeklySchedule", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IdentityBasedRestoreDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IdentityInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.GenericProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.GenericRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMRecoveryPoint", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.KeyAndSecretDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.KekDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointDiskConfiguration", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ExtendedLocation", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SecuredVMDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessSettings", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMRestoreRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.LogSchedulePolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.LongTermRetentionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionSchedule", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MonthlyRetentionSchedule", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.YearlyRetentionSchedule", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.LongTermSchedulePolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabErrorInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabFileFolderProtectedItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabFileFolderProtectedItemExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabJob", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabJobExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabJobTaskDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabProtectionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationResultInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PrepareDataMoveResponse", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SimpleRetentionPolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SimpleSchedulePolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SimpleSchedulePolicyV2", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ValidateIaasVMRestoreOperationRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ValidateRestoreOperationRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.VaultJob", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.VaultJobErrorInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.VaultJobExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureBackupServerContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmContainerExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureBackupServerEngine", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareBackupRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareProvisionIlrRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSClassicComputeVMContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaaSvmContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSClassicComputeVMProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaaSvmProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSComputeVMContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSComputeVMProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlagWorkloadContainerProtectionContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadContainerExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.InquiryInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadInquiryDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.InquiryValidation", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageProtectableContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVMAppContainerProtectableContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVMAppContainerProtectionContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PreBackupValidation", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapAseDatabaseWorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapAseSystemProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapAseSystemWorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaDatabaseProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaDatabaseWorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaSystemProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaDBInstance", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaHsr", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaSystemWorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlAvailabilityGroupProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlDatabaseProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlDatabaseWorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlInstanceProtectableItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlInstanceWorkloadItem", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadBackupRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureBackupGoalFeatureSupportRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureRecoveryServiceVaultProtectionIntent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureResourceProtectionIntent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureVMResourceFeatureSupportRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadContainerAutoProtectionIntent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadAutoProtectionIntent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlAutoProtectionIntent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ClientScriptForConnect", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ContainerIdentityInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DpmBackupEngine", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.GenericContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.GenericContainerExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMBackupRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaasVmilrRegistrationRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.InstantItemRecoveryTarget", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabContainer", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabContainerExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabContainerHealthDetails", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusJobExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusJobsExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusProvisionIlrExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusValidateOperationExtendedInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointRehydrationInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaRestoreWithRehydrateRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRestoreWithRehydrateRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMRestoreWithRehydrationRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostInfoForRehydrationRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostRehydrationInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostSavingInfo", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostSavingsInfoForPolicyRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostSavingsInfoForProtectedItemRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostSavingsInfoForVaultRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.StorageType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DedupState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.XcoolState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ValidationStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.FabricName", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AcquireStorageAccountLock", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SupportStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntentItemType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.UsagesUnit", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.EnhancedSecurityState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SoftDeleteFeatureState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.EncryptionAtRestType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.LastUpdateStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.InfrastructureEncryptionState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.VaultSubResourceType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusValues", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DataMoveLevel", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ResourceHealthStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.CopyOptions", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequestType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.PolicyType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TieringMode", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.HealthStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaasvmPolicyType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMSnapshotConsistencyType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.LastBackupStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemHealthStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RestorePointType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RetentionScheduleFormat", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MabServerType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ScheduleRunType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.OperationType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.InquiryStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItemType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.BackupItemType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriority", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.HttpStatusCode", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainerType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.JobSupportedAction", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessOption", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.recoveryservicesbackup.models.MonthOfYear", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -} ] \ No newline at end of file +[] \ No newline at end of file diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesGetSamples.java index 34898d915aaaa..6e19aaa962637 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesGetSamples.java @@ -9,7 +9,9 @@ */ public final class BackupEnginesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Dpm/BackupEngines_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Dpm/BackupEngines_Get.json */ /** * Sample code: Get Dpm/AzureBackupServer/Lajolla Backup Engine Details. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesListSamples.java index c5a8dc0eed078..49f02495faddd 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupEnginesListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Dpm/BackupEngines_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Dpm/BackupEngines_List.json */ /** * Sample code: List Dpm/AzureBackupServer/Lajolla Backup Engines. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupJobsListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupJobsListSamples.java index 46c51fa2da366..c09f9c3d78950 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupJobsListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupJobsListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupJobsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobs.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ListJobs.json */ /** * Sample code: List All Jobs. @@ -22,7 +24,9 @@ public final class BackupJobsListSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobsWithAllSupportedFilters.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ListJobsWithAllSupportedFilters.json */ /** * Sample code: List Jobs With Filters. @@ -38,7 +42,9 @@ public final class BackupJobsListSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ListJobsWithStartTimeAndEndTimeFilters.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ListJobsWithStartTimeAndEndTimeFilters.json */ /** * Sample code: List Jobs With Time Filter. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationResultsGetSamples.java index 2b16e8ccc4948..f9854312e8701 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class BackupOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete_OperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ProtectedItem_Delete_OperationResult.json */ /** * Sample code: Get Result for Protected Item Delete Operation. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationStatusesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationStatusesGetSamples.java index 1c00ad1acb114..24407d781254d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationStatusesGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationStatusesGetSamples.java @@ -9,7 +9,9 @@ */ public final class BackupOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete_OperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ProtectedItem_Delete_OperationStatus.json */ /** * Sample code: Get Protected Item Delete Operation Status. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupPoliciesListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupPoliciesListSamples.java index 4f1e7fee84d98..e82f046a92062 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupPoliciesListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupPoliciesListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupPoliciesListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupPolicies_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupPolicies_List.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureWorkload. @@ -24,7 +26,9 @@ public static void listProtectionPoliciesWithBackupManagementTypeFilterAsAzureWo } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/v2-List-Policies.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/v2-List-Policies.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureIaasVm with both V1 and V2 @@ -40,7 +44,9 @@ public static void listProtectionPoliciesWithBackupManagementTypeFilterAsAzureIa } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupPolicies_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupPolicies_List.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureIaasVm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectableItemsListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectableItemsListSamples.java index 07a1f0f7f5067..dba42ce9e9728 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectableItemsListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectableItemsListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupProtectableItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupProtectableItems_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupProtectableItems_List.json */ /** * Sample code: List protectable items with backupManagementType filter as AzureIaasVm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectedItemsListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectedItemsListSamples.java index d72d4e46cb77a..151b367d184ab 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectedItemsListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectedItemsListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupProtectedItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupProtectedItems_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupProtectedItems_List.json */ /** * Sample code: List protected items with backupManagementType filter as AzureIaasVm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionContainersListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionContainersListSamples.java index 912d7f0674e17..99a36b34f7b36 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionContainersListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionContainersListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupProtectionContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_List.json */ /** * Sample code: List Backup Protection Containers. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionIntentListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionIntentListSamples.java index 4aea56b8ca76f..7a7660cf084fb 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionIntentListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionIntentListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupProtectionIntentListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupProtectionIntent_List.json */ /** * Sample code: List protection intent with backupManagementType filter. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsGetSamples.java index 71fab52d789d5..c8b3c2c436b39 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsGetSamples.java @@ -9,7 +9,9 @@ */ public final class BackupResourceEncryptionConfigsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupResourceEncryptionConfig_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupResourceEncryptionConfig_Get.json */ /** * Sample code: Get Vault Encryption Configuration. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsUpdateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsUpdateSamples.java index 88ff64a6369fd..de9cdfc198dcf 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsUpdateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceEncryptionConfigsUpdateSamples.java @@ -14,7 +14,9 @@ */ public final class BackupResourceEncryptionConfigsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupResourceEncryptionConfig_Put.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupResourceEncryptionConfig_Put.json */ /** * Sample code: Update Vault Encryption Configuration. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrGetSamples.java index 9efa2bff611f6..2c893e7238a8d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrGetSamples.java @@ -9,7 +9,9 @@ */ public final class BackupResourceStorageConfigsNonCrrGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupStorageConfig_Get.json */ /** * Sample code: Get Vault Storage Configuration. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrPatchSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrPatchSamples.java index ac8f1417ec653..bcdf87dbb22af 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrPatchSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrPatchSamples.java @@ -14,7 +14,9 @@ */ public final class BackupResourceStorageConfigsNonCrrPatchSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Patch.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupStorageConfig_Patch.json */ /** * Sample code: Update Vault Storage Configuration. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrUpdateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrUpdateSamples.java index 8b3d33c1c17b4..3e188a720c631 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrUpdateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrUpdateSamples.java @@ -14,7 +14,9 @@ */ public final class BackupResourceStorageConfigsNonCrrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupStorageConfig_Put.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupStorageConfig_Put.json */ /** * Sample code: Update Vault Storage Configuration. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsGetSamples.java index 902037f446e7d..56ed25730f187 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsGetSamples.java @@ -9,7 +9,9 @@ */ public final class BackupResourceVaultConfigsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupResourceVaultConfigs_Get.json */ /** * Sample code: Get Vault Security Config. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsPutSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsPutSamples.java index fca520ede79b8..567ab5dc4d504 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsPutSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsPutSamples.java @@ -14,7 +14,9 @@ */ public final class BackupResourceVaultConfigsPutSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Put.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupResourceVaultConfigs_Put.json */ /** * Sample code: Update Vault Security Config. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsUpdateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsUpdateSamples.java index 01cfc76c11567..3952d48ee6d16 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsUpdateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsUpdateSamples.java @@ -13,7 +13,9 @@ */ public final class BackupResourceVaultConfigsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupResourceVaultConfigs_Patch.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupResourceVaultConfigs_Patch.json */ /** * Sample code: Update Vault Security Config. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupStatusGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupStatusGetSamples.java index 7137e79e295a8..fae1bffd49ac1 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupStatusGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupStatusGetSamples.java @@ -5,14 +5,16 @@ package com.azure.resourcemanager.recoveryservicesbackup.generated; import com.azure.resourcemanager.recoveryservicesbackup.models.BackupStatusRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType; +import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceTypeAutoGenerated2; /** * Samples for BackupStatus Get. */ public final class BackupStatusGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/GetBackupStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/GetBackupStatus.json */ /** * Sample code: Get Azure Virtual Machine Backup Status. @@ -22,7 +24,8 @@ public final class BackupStatusGetSamples { public static void getAzureVirtualMachineBackupStatus( com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { manager.backupStatus() - .getWithResponse("southeastasia", new BackupStatusRequest().withResourceType(DataSourceType.VM) + .getWithResponse("southeastasia", new BackupStatusRequest() + .withResourceType(DataSourceTypeAutoGenerated2.VM) .withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Compute/VirtualMachines/testVm"), com.azure.core.util.Context.NONE); diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupUsageSummariesListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupUsageSummariesListSamples.java index 38dbadb96a550..5e5361939b60b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupUsageSummariesListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupUsageSummariesListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupUsageSummariesListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupProtectedItem_UsageSummary_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupProtectedItem_UsageSummary_Get.json */ /** * Sample code: Get Protected Items Usages Summary. @@ -24,7 +26,9 @@ public static void getProtectedItemsUsagesSummary( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupProtectionContainers_UsageSummary_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupProtectionContainers_UsageSummary_Get.json */ /** * Sample code: Get Protected Containers Usages Summary. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupWorkloadItemsListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupWorkloadItemsListSamples.java index ce75a7cbecaab..4e06aca59c72d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupWorkloadItemsListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupWorkloadItemsListSamples.java @@ -9,7 +9,9 @@ */ public final class BackupWorkloadItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupWorkloadItems_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupWorkloadItems_List.json */ /** * Sample code: List Workload Items in Container. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupsTriggerSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupsTriggerSamples.java index 2bd590e9acdaa..036da0bcf1c7a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupsTriggerSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupsTriggerSamples.java @@ -12,7 +12,9 @@ */ public final class BackupsTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerBackup_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/TriggerBackup_Post.json */ /** * Sample code: Trigger Backup. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BmsPrepareDataMoveOperationResultGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BmsPrepareDataMoveOperationResultGetSamples.java index c522fd8804fbb..f6ed30774c40d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BmsPrepareDataMoveOperationResultGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BmsPrepareDataMoveOperationResultGetSamples.java @@ -9,7 +9,9 @@ */ public final class BmsPrepareDataMoveOperationResultGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/PrepareDataMoveOperationResult_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/PrepareDataMoveOperationResult_Get.json */ /** * Sample code: Get operation result for PrepareDataMove. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DeletedProtectionContainersListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DeletedProtectionContainersListSamples.java index c78ef87eedfdd..0dfcb71b4362f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DeletedProtectionContainersListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DeletedProtectionContainersListSamples.java @@ -9,7 +9,9 @@ */ public final class DeletedProtectionContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/SoftDeletedContainers_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/SoftDeletedContainers_List.json */ /** * Sample code: List Backup Protection Containers. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExportJobsOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExportJobsOperationResultsGetSamples.java index dfca48c54e181..547543dac6ced 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExportJobsOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExportJobsOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class ExportJobsOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ExportJobsOperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ExportJobsOperationResult.json */ /** * Sample code: Export Jobs Operation Results. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportValidateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportValidateSamples.java index a62a35759b2cd..5455b38473ce7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportValidateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportValidateSamples.java @@ -11,7 +11,9 @@ */ public final class FeatureSupportValidateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/BackupFeature_Validate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/BackupFeature_Validate.json */ /** * Sample code: Check Azure Vm Backup Feature Support. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostPostSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostPostSamples.java index a6cd10d771542..11e242132af1f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostPostSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostPostSamples.java @@ -16,7 +16,9 @@ */ public final class FetchTieringCostPostSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForRehydrate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForRehydrate.json */ /** * Sample code: Get the rehydration cost for recovery point. @@ -37,7 +39,9 @@ public static void getTheRehydrationCostForRecoveryPoint( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForProtectedItem.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForProtectedItem.json */ /** * Sample code: Get the tiering savings cost info for protected item. @@ -57,7 +61,9 @@ public static void getTheTieringSavingsCostInfoForProtectedItem( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForPolicy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForPolicy.json */ /** * Sample code: Get the tiering savings cost info for policy. @@ -75,7 +81,9 @@ public static void getTheTieringSavingsCostInfoForPolicy( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/FetchTieringCostForVault.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/FetchTieringCostForVault.json */ /** * Sample code: Get the tiering savings cost info for vault. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GetTieringCostOperationResultGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GetTieringCostOperationResultGetSamples.java index 52d5dceeb02c5..26e941d777a06 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GetTieringCostOperationResultGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GetTieringCostOperationResultGetSamples.java @@ -9,7 +9,9 @@ */ public final class GetTieringCostOperationResultGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/GetTieringCostOperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/GetTieringCostOperationResult.json */ /** * Sample code: Fetch Tiering Cost Operation Result. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsProvisionSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsProvisionSamples.java index 5013f2a5240da..0670a165c36f2 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsProvisionSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsProvisionSamples.java @@ -12,7 +12,9 @@ */ public final class ItemLevelRecoveryConnectionsProvisionSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Provision_Ilr.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/Provision_Ilr.json */ /** * Sample code: Provision Instant Item Level Recovery for Azure Vm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsRevokeSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsRevokeSamples.java index 180683297e1b2..11660cc04c735 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsRevokeSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsRevokeSamples.java @@ -9,7 +9,9 @@ */ public final class ItemLevelRecoveryConnectionsRevokeSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Revoke_Ilr.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/Revoke_Ilr.json */ /** * Sample code: Revoke Instant Item Level Recovery for Azure Vm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobCancellationsTriggerSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobCancellationsTriggerSamples.java index 0743d69b92db7..587d2046f510e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobCancellationsTriggerSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobCancellationsTriggerSamples.java @@ -9,7 +9,9 @@ */ public final class JobCancellationsTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerCancelJob.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/TriggerCancelJob.json */ /** * Sample code: Cancel Job. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobDetailsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobDetailsGetSamples.java index 1f85664e6f1f9..a53ac3c234053 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobDetailsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobDetailsGetSamples.java @@ -9,7 +9,9 @@ */ public final class JobDetailsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/GetJobDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/GetJobDetails.json */ /** * Sample code: Get Job Details. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobOperationResultsGetSamples.java index a3d4aba567919..3e2c1542b3b3d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class JobOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/CancelJobOperationResult.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/CancelJobOperationResult.json */ /** * Sample code: Cancel Job Operation Result. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobsExportSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobsExportSamples.java index 3a602e8c82a2f..2300929b5abca 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobsExportSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobsExportSamples.java @@ -9,7 +9,9 @@ */ public final class JobsExportSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/TriggerExportJobs.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/TriggerExportJobs.json */ /** * Sample code: Export Jobs. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationOperationValidateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationOperationValidateSamples.java index 92b94be8659de..7887919e5b0da 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationOperationValidateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationOperationValidateSamples.java @@ -17,7 +17,9 @@ */ public final class OperationOperationValidateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperation_RestoreDisk.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperation_RestoreDisk.json */ /** * Sample code: Validate Operation. @@ -47,7 +49,9 @@ public final class OperationOperationValidateSamples { } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperation_RestoreDisk_IdentityBasedRestoreDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperation_RestoreDisk_IdentityBasedRestoreDetails.json */ /** * Sample code: Validate Operation with identityBasedRestoreDetails. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationsListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationsListSamples.java index 74f3d36d69c92..df59d8cfd6b16 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationsListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationsListSamples.java @@ -9,7 +9,9 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ListOperations.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ListOperations.json */ /** * Sample code: ListOperations. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionDeleteSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionDeleteSamples.java index 692c659bc7b78..43e3d2657bad5 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionDeleteSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionDeleteSamples.java @@ -9,7 +9,9 @@ */ public final class PrivateEndpointConnectionDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/DeletePrivateEndpointConnection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/DeletePrivateEndpointConnection.json */ /** * Sample code: Delete PrivateEndpointConnection. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionGetSamples.java index 1e3ef8aed1bc5..37e2aaeea81cc 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionGetSamples.java @@ -9,7 +9,9 @@ */ public final class PrivateEndpointConnectionGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/GetPrivateEndpointConnection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/GetPrivateEndpointConnection.json */ /** * Sample code: Get PrivateEndpointConnection. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionPutSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionPutSamples.java index 5ea82c56b1d7e..e1e0ad8cc552a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionPutSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionPutSamples.java @@ -18,7 +18,9 @@ */ public final class PrivateEndpointConnectionPutSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/PutPrivateEndpointConnection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/PutPrivateEndpointConnection.json */ /** * Sample code: Update PrivateEndpointConnection. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointGetOperationStatusSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointGetOperationStatusSamples.java index a90f9849692af..191052c2a0146 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointGetOperationStatusSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointGetOperationStatusSamples.java @@ -9,7 +9,9 @@ */ public final class PrivateEndpointGetOperationStatusSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/PrivateEndpointConnection/GetPrivateEndpointConnectionOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/PrivateEndpointConnection/GetPrivateEndpointConnectionOperationStatus.json */ /** * Sample code: Get OperationStatus. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainersListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainersListSamples.java index 8ee22cb304439..9e18ca596d15c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainersListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainersListSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectableContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectableContainers_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectableContainers_List.json */ /** * Sample code: List protectable items with backupManagementType filter as AzureStorage. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationResultsGetSamples.java index c45cdc2745661..52ced22bad460 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectedItemOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectedItemOperationResults.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectedItemOperationResults.json */ /** * Sample code: Get Operation Results of Protected Vm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationStatusesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationStatusesGetSamples.java index e2adbd598fb4d..c2e02ca27d3c2 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationStatusesGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationStatusesGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectedItemOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectedItemOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectedItemOperationStatus.json */ /** * Sample code: Get Operation Status of Protected Vm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsCreateOrUpdateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsCreateOrUpdateSamples.java index 85d2619d0e912..385184eed1606 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsCreateOrUpdateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsCreateOrUpdateSamples.java @@ -12,7 +12,9 @@ */ public final class ProtectedItemsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/StopProtection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/StopProtection.json */ /** * Sample code: Stop Protection with retain data on Azure IaasVm. @@ -33,7 +35,9 @@ public static void stopProtectionWithRetainDataOnAzureIaasVm( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ConfigureProtection.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ConfigureProtection.json */ /** * Sample code: Enable Protection on Azure IaasVm. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsDeleteSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsDeleteSamples.java index 0ec5278dd39e3..0c4dc23fa22e4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsDeleteSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsDeleteSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectedItemsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/ProtectedItem_Delete.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/ProtectedItem_Delete.json */ /** * Sample code: Delete Protection from Azure Virtual Machine. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsGetSamples.java index f82d69ef09371..f214f86c75213 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectedItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ClassicCompute_ProtectedItem_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ClassicCompute_ProtectedItem_Get.json */ /** * Sample code: Get Protected Classic Virtual Machine Details. @@ -25,7 +27,9 @@ public static void getProtectedClassicVirtualMachineDetails( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/Compute_ProtectedItem_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/Compute_ProtectedItem_Get.json */ /** * Sample code: Get Protected Virtual Machine Details. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerOperationResultsGetSamples.java index b33276d13c6e9..59a65e40b38ce 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionContainerOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Inquire_Result.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_Inquire_Result.json */ /** * Sample code: Get Azure Storage Protection Container Operation Result. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerRefreshOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerRefreshOperationResultsGetSamples.java index 2a5a5d568a53b..d56d1ccd0d1e6 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerRefreshOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerRefreshOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionContainerRefreshOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/RefreshContainers_OperationResults.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/RefreshContainers_OperationResults.json */ /** * Sample code: Azure Vm Discovery Operation Result. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersGetSamples.java index a5ca3e7f1fb28..1b9583e67b3db 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionContainersGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionContainers_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/ProtectionContainers_Get.json */ /** * Sample code: Get Protection Container Details. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersInquireSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersInquireSamples.java index f6764b191a504..e72c4ccddb27b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersInquireSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersInquireSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionContainersInquireSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Inquire.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_Inquire.json */ /** * Sample code: Inquire Azure Storage Protection Containers. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRefreshSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRefreshSamples.java index 1195fd0939c7c..d90304352dbfc 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRefreshSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRefreshSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionContainersRefreshSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/RefreshContainers.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/RefreshContainers.json */ /** * Sample code: Trigger Azure Vm Discovery. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRegisterSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRegisterSamples.java index ec74506bac142..d75c0851474b9 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRegisterSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRegisterSamples.java @@ -13,7 +13,9 @@ */ public final class ProtectionContainersRegisterSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionContainers_Register.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionContainers_Register.json */ /** * Sample code: RegisterAzure Storage ProtectionContainers. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersUnregisterSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersUnregisterSamples.java index 3bf842c2ac04f..a2ca1fbd9c3e0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersUnregisterSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersUnregisterSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionContainersUnregisterSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionContainers_Unregister.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/ProtectionContainers_Unregister.json */ /** * Sample code: Unregister Protection Container. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentCreateOrUpdateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentCreateOrUpdateSamples.java index ed2fc7eb8b868..7275275caf175 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentCreateOrUpdateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentCreateOrUpdateSamples.java @@ -11,7 +11,9 @@ */ public final class ProtectionIntentCreateOrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionIntent_CreateOrUpdate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionIntent_CreateOrUpdate.json */ /** * Sample code: Create or Update Azure Vm Protection Intent. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentDeleteSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentDeleteSamples.java index 63f38c0b1b3c6..07a9b194fb2d7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentDeleteSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentDeleteSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionIntentDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_Delete.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupProtectionIntent_Delete.json */ /** * Sample code: Delete Protection intent from item. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentGetSamples.java index 287e6d0e64e97..5e5000bfc23aa 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionIntentGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/BackupProtectionIntent_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/BackupProtectionIntent_Get.json */ /** * Sample code: Get ProtectionIntent for an item. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentValidateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentValidateSamples.java index a6082e03bcaa9..571e911ab982f 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentValidateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentValidateSamples.java @@ -4,7 +4,7 @@ package com.azure.resourcemanager.recoveryservicesbackup.generated; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType; +import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceTypeAutoGenerated; import com.azure.resourcemanager.recoveryservicesbackup.models.PreValidateEnableBackupRequest; /** @@ -12,7 +12,9 @@ */ public final class ProtectionIntentValidateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionIntent_Validate.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionIntent_Validate.json */ /** * Sample code: Validate Enable Protection on Azure Vm. @@ -23,7 +25,7 @@ public static void validateEnableProtectionOnAzureVm( com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { manager.protectionIntents() .validateWithResponse("southeastasia", new PreValidateEnableBackupRequest() - .withResourceType(DataSourceType.VM) + .withResourceType(DataSourceTypeAutoGenerated.VM) .withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/arunaupgrade/providers/Microsoft.Compute/VirtualMachines/upgrade1") .withVaultId( diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesCreateOrUpdateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesCreateOrUpdateSamples.java index ccf8bbe542a5e..1c31642053216 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesCreateOrUpdateSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesCreateOrUpdateSamples.java @@ -11,12 +11,12 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.DailySchedule; import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; import com.azure.resourcemanager.recoveryservicesbackup.models.HourlySchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaasvmPolicyType; import com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMSnapshotConsistencyType; +import com.azure.resourcemanager.recoveryservicesbackup.models.IaasvmPolicyType; import com.azure.resourcemanager.recoveryservicesbackup.models.LogSchedulePolicy; import com.azure.resourcemanager.recoveryservicesbackup.models.LongTermRetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.MonthlyRetentionSchedule; import com.azure.resourcemanager.recoveryservicesbackup.models.MonthOfYear; +import com.azure.resourcemanager.recoveryservicesbackup.models.MonthlyRetentionSchedule; import com.azure.resourcemanager.recoveryservicesbackup.models.PolicyType; import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; @@ -28,9 +28,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.SimpleSchedulePolicyV2; import com.azure.resourcemanager.recoveryservicesbackup.models.SubProtectionPolicy; import com.azure.resourcemanager.recoveryservicesbackup.models.VaultRetentionPolicy; +import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat; import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionSchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType; import com.azure.resourcemanager.recoveryservicesbackup.models.YearlyRetentionSchedule; import java.time.OffsetDateTime; @@ -41,7 +41,9 @@ */ public final class ProtectionPoliciesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureWorkload/ProtectionPolicies_CreateOrUpdate_Complex.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureWorkload/ProtectionPolicies_CreateOrUpdate_Complex.json */ /** * Sample code: Create or Update Full Azure Workload Protection Policy. @@ -105,7 +107,9 @@ public static void createOrUpdateFullAzureWorkloadProtectionPolicy( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Simple.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Simple.json */ /** * Sample code: Create or Update Simple Azure Vm Protection Policy. @@ -130,7 +134,9 @@ public static void createOrUpdateSimpleAzureVmProtectionPolicy( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Daily.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Daily.json */ /** * Sample code: Create or Update Daily Azure Storage Protection Policy. @@ -181,7 +187,9 @@ public static void createOrUpdateDailyAzureStorageProtectionPolicy( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hardened.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hardened.json */ /** * Sample code: Create or Update Azure Storage Vault Standard Protection Policy. @@ -237,7 +245,9 @@ public static void createOrUpdateAzureStorageVaultStandardProtectionPolicy( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hourly.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hourly.json */ /** * Sample code: Create or Update Hourly Azure Storage Protection Policy. @@ -283,7 +293,9 @@ public static void createOrUpdateHourlyAzureStorageProtectionPolicy( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Complex.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Complex.json */ /** * Sample code: Create or Update Full Azure Vm Protection Policy. @@ -334,7 +346,9 @@ public static void createOrUpdateFullAzureVmProtectionPolicy( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/IaaS_v2_hourly.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/IaaS_v2_hourly.json */ /** * Sample code: Create or Update Enhanced Azure Vm Protection Policy with Hourly backup. @@ -389,7 +403,9 @@ public static void createOrUpdateEnhancedAzureVmProtectionPolicyWithHourlyBackup } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/IaaS_v2_daily.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/IaaS_v2_daily.json */ /** * Sample code: Create or Update Enhanced Azure Vm Protection Policy with daily backup. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesDeleteSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesDeleteSamples.java index d2e720726def5..e88c44c69ec2c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesDeleteSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesDeleteSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionPoliciesDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_Delete.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_Delete.json */ /** * Sample code: Delete Azure Vm Protection Policy. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesGetSamples.java index 7a9731c0a783a..9960b7b686175 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionPoliciesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicies_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicies_Get.json */ /** * Sample code: Get Azure IaasVm Protection Policy Details. @@ -23,7 +25,9 @@ public static void getAzureIaasVmProtectionPolicyDetails( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/V2Policy/v2-Get-Policy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/V2Policy/v2-Get-Policy.json */ /** * Sample code: Get Azure IaasVm Enhanced Protection Policy Details. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationResultsGetSamples.java index c629b0f3bea33..55afbebc876d4 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionPolicyOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicyOperationResults_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicyOperationResults_Get.json */ /** * Sample code: Get Protection Policy Operation Results. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationStatusesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationStatusesGetSamples.java index 6c2ff327eba68..2eb804cbe8aca 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationStatusesGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationStatusesGetSamples.java @@ -9,7 +9,9 @@ */ public final class ProtectionPolicyOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ProtectionPolicyOperationStatuses_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ProtectionPolicyOperationStatuses_Get.json */ /** * Sample code: Get Protection Policy Operation Status. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsGetSamples.java index 5eba322e34113..a04e8ec959ff3 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsGetSamples.java @@ -9,7 +9,9 @@ */ public final class RecoveryPointsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPoints_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/RecoveryPoints_Get.json */ /** * Sample code: Get Azure Vm Recovery Point Details. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsListSamples.java index aff25dd7de98f..62ff92e5c54ba 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsListSamples.java @@ -9,7 +9,9 @@ */ public final class RecoveryPointsListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPoints_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/RecoveryPoints_List.json */ /** * Sample code: Get Protected Azure Vm Recovery Points. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsRecommendedForMoveListSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsRecommendedForMoveListSamples.java index 15172dc1964bc..7365e5a8ced8d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsRecommendedForMoveListSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsRecommendedForMoveListSamples.java @@ -12,7 +12,9 @@ */ public final class RecoveryPointsRecommendedForMoveListSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/RecoveryPointsRecommendedForMove_List.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/RecoveryPointsRecommendedForMove_List.json */ /** * Sample code: Get Protected Azure Vm Recovery Points Recommended for Move. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsUpdateSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsUpdateSamples.java new file mode 100644 index 0000000000000..5b3af9f1b4b62 --- /dev/null +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicesbackup.generated; + +import com.azure.resourcemanager.recoveryservicesbackup.models.PatchRecoveryPointInput; +import com.azure.resourcemanager.recoveryservicesbackup.models.PatchRecoveryPointPropertiesInput; +import com.azure.resourcemanager.recoveryservicesbackup.models.UpdateRecoveryPointRequest; +import java.time.OffsetDateTime; + +/** + * Samples for RecoveryPoints Update. + */ +public final class RecoveryPointsUpdateSamples { + /* + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/RecoveryPoints_Update.json + */ + /** + * Sample code: Update Azure Vm Recovery Point Details. + * + * @param manager Entry point to RecoveryServicesBackupManager. + */ + public static void updateAzureVmRecoveryPointDetails( + com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { + manager.recoveryPoints() + .updateWithResponse("hanasnapshottesting", "HanaSnapshotTest", "Azure", + "VMAppContainer;compute;hanasnapshottesting;hana-eacan-2", "SAPHanaDatabase;hye;hye", + "2265668074516978193", + new UpdateRecoveryPointRequest().withProperties( + new PatchRecoveryPointInput().withRecoveryPointProperties(new PatchRecoveryPointPropertiesInput() + .withExpiryTime(OffsetDateTime.parse("2025-01-02T00:00:00.0000000Z")))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetSamples.java index b4643d506d708..0a97bce2647f7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetSamples.java @@ -9,7 +9,9 @@ */ public final class ResourceGuardProxiesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json */ /** * Sample code: Get VaultGuardProxies. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationDeleteSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationDeleteSamples.java index 35d899fb5da27..65d982a4127c8 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationDeleteSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationDeleteSamples.java @@ -9,7 +9,9 @@ */ public final class ResourceGuardProxyOperationDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json */ /** * Sample code: Delete ResourceGuardProxy. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationGetSamples.java index fedd709774688..60ac718c5a7ec 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationGetSamples.java @@ -9,7 +9,9 @@ */ public final class ResourceGuardProxyOperationGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json */ /** * Sample code: Get ResourceGuardProxy. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationPutSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationPutSamples.java index 1b2f32ba4461e..22a2329ed0d3d 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationPutSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationPutSamples.java @@ -11,7 +11,9 @@ */ public final class ResourceGuardProxyOperationPutSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json */ /** * Sample code: Create ResourceGuardProxy. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationUnlockDeleteSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationUnlockDeleteSamples.java index 125ad0cdfaa1c..4152f1641c96a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationUnlockDeleteSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationUnlockDeleteSamples.java @@ -12,7 +12,9 @@ */ public final class ResourceGuardProxyOperationUnlockDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json */ /** * Sample code: UnlockDelete ResourceGuardProxy. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsPrepareDataMoveSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsPrepareDataMoveSamples.java index d4185bd79914a..cfeaae7ee1526 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsPrepareDataMoveSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsPrepareDataMoveSamples.java @@ -12,7 +12,9 @@ */ public final class ResourceProviderBmsPrepareDataMoveSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/PrepareDataMove_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/PrepareDataMove_Post.json */ /** * Sample code: Prepare Data Move. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsTriggerDataMoveSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsTriggerDataMoveSamples.java index c6bd250354151..ada27ca2d5d0b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsTriggerDataMoveSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderBmsTriggerDataMoveSamples.java @@ -12,7 +12,9 @@ */ public final class ResourceProviderBmsTriggerDataMoveSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/TriggerDataMove_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/TriggerDataMove_Post.json */ /** * Sample code: Trigger Data Move. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderGetOperationStatusSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderGetOperationStatusSamples.java index 294b23bb98227..77e32b9628a9c 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderGetOperationStatusSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderGetOperationStatusSamples.java @@ -9,7 +9,9 @@ */ public final class ResourceProviderGetOperationStatusSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/BackupDataMove/BackupDataMoveOperationStatus_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/BackupDataMove/BackupDataMoveOperationStatus_Get.json */ /** * Sample code: Get OperationStatus. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderMoveRecoveryPointSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderMoveRecoveryPointSamples.java index 004a413355933..45610af57521b 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderMoveRecoveryPointSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProviderMoveRecoveryPointSamples.java @@ -12,7 +12,9 @@ */ public final class ResourceProviderMoveRecoveryPointSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TriggerRecoveryPointMove_Post.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TriggerRecoveryPointMove_Post.json */ /** * Sample code: Trigger RP Move Operation. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoresTriggerSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoresTriggerSamples.java index 894642644222c..a1f2d558c39d0 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoresTriggerSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoresTriggerSamples.java @@ -15,13 +15,51 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequestResource; import com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessOption; import com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessSettings; +import java.util.Arrays; /** * Samples for Restores Trigger. */ public final class RestoresTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ResourceGuardEnabled.json + */ + /** + * Sample code: Trigger Restore with MUA. + * + * @param manager Entry point to RecoveryServicesBackupManager. + */ + public static void + triggerRestoreWithMUA(com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager) { + manager.restores() + .trigger("testVault", "netsdktestrg", "Azure", + "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", "348916168024334", + new RestoreRequestResource().withProperties(new IaasVMRestoreRequest() + .withResourceGuardOperationRequests(Arrays.asList( + "/subscriptions/063bf7bc-e4dc-4cde-8840-8416fbd7921e/resourcegroups/ankurRG1/providers/Microsoft.DataProtection/resourceGuards/RG341/triggerRestoreRequests/default")) + .withRecoveryPointId("348916168024334") + .withRecoveryType(RecoveryType.RESTORE_DISKS) + .withSourceResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1") + .withRegion("southeastasia") + .withCreateNewCloudService(true) + .withOriginalStorageAccountOption(false) + .withEncryptionDetails(new EncryptionDetails().withEncryptionEnabled(false)) + .withIdentityInfo(new IdentityInfo().withIsSystemAssignedIdentity(false) + .withManagedIdentityResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi")) + .withIdentityBasedRestoreDetails(new IdentityBasedRestoreDetails().withTargetStorageAccountId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount"))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreWithRehydrationRequest. @@ -60,7 +98,9 @@ public static void restoreToNewAzureIaasVmWithIaasVMRestoreWithRehydrationReques } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest. @@ -97,7 +137,9 @@ public static void restoreToNewAzureIaasVmWithIaasVMRestoreRequest( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreWithRehydrationRequest. @@ -128,7 +170,9 @@ public static void restoreDisksWithIaasVMRestoreWithRehydrationRequest( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest with identityBasedRestoreDetails. @@ -165,7 +209,9 @@ public static void restoreToNewAzureIaasVmWithIaasVMRestoreRequestWithIdentityBa } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreRequest. @@ -201,7 +247,9 @@ public static void restoreDisksWithIaasVMRestoreRequest( } /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json */ /** * Sample code: Restore Disks with IaasVMRestoreRequest with IdentityBasedRestoreDetails. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecurityPINsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecurityPINsGetSamples.java index 8460fd31c954d..de0797dd6a719 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecurityPINsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecurityPINsGetSamples.java @@ -9,7 +9,9 @@ */ public final class SecurityPINsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/Common/BackupSecurityPin_Get.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/Common/BackupSecurityPin_Get.json */ /** * Sample code: Get Vault Security Pin. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostOperationStatusGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostOperationStatusGetSamples.java index 82efdab71014f..829d50fd2ff20 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostOperationStatusGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostOperationStatusGetSamples.java @@ -9,7 +9,9 @@ */ public final class TieringCostOperationStatusGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/TieringCost/GetTieringCostOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/TieringCost/GetTieringCostOperationStatus.json */ /** * Sample code: Fetch Tiering Cost Operation Status. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationResultsGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationResultsGetSamples.java index f9695a3329939..3103ed56d90b7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationResultsGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationResultsGetSamples.java @@ -9,7 +9,9 @@ */ public final class ValidateOperationResultsGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperationResults.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperationResults.json */ /** * Sample code: Get Operation Results of Validate Operation. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationStatusesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationStatusesGetSamples.java index b8fc06ea6bdea..8eafb48c0d27a 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationStatusesGetSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationStatusesGetSamples.java @@ -9,7 +9,9 @@ */ public final class ValidateOperationStatusesGetSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/ValidateOperationStatus.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/ValidateOperationStatus.json */ /** * Sample code: Get Operation Status of Validate Operation. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationTriggerSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationTriggerSamples.java index e25c9a684fdf7..ad2eab2bd82ad 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationTriggerSamples.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationTriggerSamples.java @@ -16,7 +16,9 @@ */ public final class ValidateOperationTriggerSamples { /* - * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2024-04-01/examples/AzureIaasVm/TriggerValidateOperation_RestoreDisk.json + * x-ms-original-file: + * specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2024-11-01-preview/ + * examples/AzureIaasVm/TriggerValidateOperation_RestoreDisk.json */ /** * Sample code: Trigger Validate Operation. diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupGoalFeatureSupportRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupGoalFeatureSupportRequestTests.java deleted file mode 100644 index d385a657a1c8d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupGoalFeatureSupportRequestTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureBackupGoalFeatureSupportRequest; - -public final class AzureBackupGoalFeatureSupportRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureBackupGoalFeatureSupportRequest model = BinaryData.fromString("{\"featureType\":\"AzureBackupGoals\"}") - .toObject(AzureBackupGoalFeatureSupportRequest.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureBackupGoalFeatureSupportRequest model = new AzureBackupGoalFeatureSupportRequest(); - model = BinaryData.fromObject(model).toObject(AzureBackupGoalFeatureSupportRequest.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupServerContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupServerContainerTests.java deleted file mode 100644 index e3b36d8c7efe6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupServerContainerTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureBackupServerContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmContainerExtendedInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AzureBackupServerContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureBackupServerContainer model = BinaryData.fromString( - "{\"containerType\":\"AzureBackupServerContainer\",\"canReRegister\":true,\"containerId\":\"xsi\",\"protectedItemCount\":3239466388694248428,\"dpmAgentVersion\":\"bebjfu\",\"dpmServers\":[\"oichdlpnfpubnt\",\"batzviqsows\",\"aelcat\",\"cjuhplrvkm\"],\"upgradeAvailable\":false,\"protectionStatus\":\"jvlgfggcvkyyliz\",\"extendedInfo\":{\"lastRefreshedAt\":\"2021-07-07T04:53:59Z\"},\"friendlyName\":\"sfxsf\",\"backupManagementType\":\"MAB\",\"registrationStatus\":\"vtmva\",\"healthStatus\":\"w\",\"protectableObjectType\":\"qlvh\"}") - .toObject(AzureBackupServerContainer.class); - Assertions.assertEquals("sfxsf", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("vtmva", model.registrationStatus()); - Assertions.assertEquals("w", model.healthStatus()); - Assertions.assertEquals("qlvh", model.protectableObjectType()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("xsi", model.containerId()); - Assertions.assertEquals(3239466388694248428L, model.protectedItemCount()); - Assertions.assertEquals("bebjfu", model.dpmAgentVersion()); - Assertions.assertEquals("oichdlpnfpubnt", model.dpmServers().get(0)); - Assertions.assertEquals(false, model.upgradeAvailable()); - Assertions.assertEquals("jvlgfggcvkyyliz", model.protectionStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-07T04:53:59Z"), model.extendedInfo().lastRefreshedAt()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureBackupServerContainer model = new AzureBackupServerContainer().withFriendlyName("sfxsf") - .withBackupManagementType(BackupManagementType.MAB) - .withRegistrationStatus("vtmva") - .withHealthStatus("w") - .withProtectableObjectType("qlvh") - .withCanReRegister(true) - .withContainerId("xsi") - .withProtectedItemCount(3239466388694248428L) - .withDpmAgentVersion("bebjfu") - .withDpmServers(Arrays.asList("oichdlpnfpubnt", "batzviqsows", "aelcat", "cjuhplrvkm")) - .withUpgradeAvailable(false) - .withProtectionStatus("jvlgfggcvkyyliz") - .withExtendedInfo( - new DpmContainerExtendedInfo().withLastRefreshedAt(OffsetDateTime.parse("2021-07-07T04:53:59Z"))); - model = BinaryData.fromObject(model).toObject(AzureBackupServerContainer.class); - Assertions.assertEquals("sfxsf", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("vtmva", model.registrationStatus()); - Assertions.assertEquals("w", model.healthStatus()); - Assertions.assertEquals("qlvh", model.protectableObjectType()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("xsi", model.containerId()); - Assertions.assertEquals(3239466388694248428L, model.protectedItemCount()); - Assertions.assertEquals("bebjfu", model.dpmAgentVersion()); - Assertions.assertEquals("oichdlpnfpubnt", model.dpmServers().get(0)); - Assertions.assertEquals(false, model.upgradeAvailable()); - Assertions.assertEquals("jvlgfggcvkyyliz", model.protectionStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-07T04:53:59Z"), model.extendedInfo().lastRefreshedAt()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupServerEngineTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupServerEngineTests.java deleted file mode 100644 index a49af05e7d919..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureBackupServerEngineTests.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureBackupServerEngine; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureBackupServerEngineTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureBackupServerEngine model = BinaryData.fromString( - "{\"backupEngineType\":\"AzureBackupServerEngine\",\"friendlyName\":\"gv\",\"backupManagementType\":\"AzureIaasVM\",\"registrationStatus\":\"rrkolawjmjs\",\"backupEngineState\":\"rokcdxfzzzwyjaf\",\"healthStatus\":\"lhguyn\",\"canReRegister\":true,\"backupEngineId\":\"gmltxdw\",\"dpmVersion\":\"ozusgz\",\"azureBackupAgentVersion\":\"ns\",\"isAzureBackupAgentUpgradeAvailable\":true,\"isDpmUpgradeAvailable\":true,\"extendedInfo\":{\"databaseName\":\"folpymwamxqzra\",\"protectedItemsCount\":520460830,\"protectedServersCount\":1456330987,\"diskCount\":36085311,\"usedDiskSpace\":77.45310615268932,\"availableDiskSpace\":3.1510208685722407,\"refreshedAt\":\"2021-09-16T17:21:57Z\",\"azureProtectedInstances\":1390786576}}") - .toObject(AzureBackupServerEngine.class); - Assertions.assertEquals("gv", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_IAAS_VM, model.backupManagementType()); - Assertions.assertEquals("rrkolawjmjs", model.registrationStatus()); - Assertions.assertEquals("rokcdxfzzzwyjaf", model.backupEngineState()); - Assertions.assertEquals("lhguyn", model.healthStatus()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("gmltxdw", model.backupEngineId()); - Assertions.assertEquals("ozusgz", model.dpmVersion()); - Assertions.assertEquals("ns", model.azureBackupAgentVersion()); - Assertions.assertEquals(true, model.isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(true, model.isDpmUpgradeAvailable()); - Assertions.assertEquals("folpymwamxqzra", model.extendedInfo().databaseName()); - Assertions.assertEquals(520460830, model.extendedInfo().protectedItemsCount()); - Assertions.assertEquals(1456330987, model.extendedInfo().protectedServersCount()); - Assertions.assertEquals(36085311, model.extendedInfo().diskCount()); - Assertions.assertEquals(77.45310615268932D, model.extendedInfo().usedDiskSpace()); - Assertions.assertEquals(3.1510208685722407D, model.extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-16T17:21:57Z"), model.extendedInfo().refreshedAt()); - Assertions.assertEquals(1390786576, model.extendedInfo().azureProtectedInstances()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureBackupServerEngine model = new AzureBackupServerEngine().withFriendlyName("gv") - .withBackupManagementType(BackupManagementType.AZURE_IAAS_VM) - .withRegistrationStatus("rrkolawjmjs") - .withBackupEngineState("rokcdxfzzzwyjaf") - .withHealthStatus("lhguyn") - .withCanReRegister(true) - .withBackupEngineId("gmltxdw") - .withDpmVersion("ozusgz") - .withAzureBackupAgentVersion("ns") - .withIsAzureBackupAgentUpgradeAvailable(true) - .withIsDpmUpgradeAvailable(true) - .withExtendedInfo(new BackupEngineExtendedInfo().withDatabaseName("folpymwamxqzra") - .withProtectedItemsCount(520460830) - .withProtectedServersCount(1456330987) - .withDiskCount(36085311) - .withUsedDiskSpace(77.45310615268932D) - .withAvailableDiskSpace(3.1510208685722407D) - .withRefreshedAt(OffsetDateTime.parse("2021-09-16T17:21:57Z")) - .withAzureProtectedInstances(1390786576)); - model = BinaryData.fromObject(model).toObject(AzureBackupServerEngine.class); - Assertions.assertEquals("gv", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_IAAS_VM, model.backupManagementType()); - Assertions.assertEquals("rrkolawjmjs", model.registrationStatus()); - Assertions.assertEquals("rokcdxfzzzwyjaf", model.backupEngineState()); - Assertions.assertEquals("lhguyn", model.healthStatus()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("gmltxdw", model.backupEngineId()); - Assertions.assertEquals("ozusgz", model.dpmVersion()); - Assertions.assertEquals("ns", model.azureBackupAgentVersion()); - Assertions.assertEquals(true, model.isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(true, model.isDpmUpgradeAvailable()); - Assertions.assertEquals("folpymwamxqzra", model.extendedInfo().databaseName()); - Assertions.assertEquals(520460830, model.extendedInfo().protectedItemsCount()); - Assertions.assertEquals(1456330987, model.extendedInfo().protectedServersCount()); - Assertions.assertEquals(36085311, model.extendedInfo().diskCount()); - Assertions.assertEquals(77.45310615268932D, model.extendedInfo().usedDiskSpace()); - Assertions.assertEquals(3.1510208685722407D, model.extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-16T17:21:57Z"), model.extendedInfo().refreshedAt()); - Assertions.assertEquals(1390786576, model.extendedInfo().azureProtectedInstances()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareBackupRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareBackupRequestTests.java deleted file mode 100644 index 097867af5e27d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareBackupRequestTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareBackupRequest; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureFileShareBackupRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureFileShareBackupRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureFileShareBackupRequest\",\"recoveryPointExpiryTimeInUTC\":\"2021-01-16T12:01:28Z\"}") - .toObject(AzureFileShareBackupRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-16T12:01:28Z"), model.recoveryPointExpiryTimeInUtc()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureFileShareBackupRequest model = new AzureFileShareBackupRequest() - .withRecoveryPointExpiryTimeInUtc(OffsetDateTime.parse("2021-01-16T12:01:28Z")); - model = BinaryData.fromObject(model).toObject(AzureFileShareBackupRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-16T12:01:28Z"), model.recoveryPointExpiryTimeInUtc()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProtectableItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProtectableItemTests.java deleted file mode 100644 index 82408c9cdb91d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProtectableItemTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareProtectableItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureFileShareProtectableItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureFileShareProtectableItem model = BinaryData.fromString( - "{\"protectableItemType\":\"AzureFileShare\",\"parentContainerFabricId\":\"srlzknmzlan\",\"parentContainerFriendlyName\":\"pdwvnphcn\",\"azureFileShareType\":\"Invalid\",\"backupManagementType\":\"jhmqrhvthla\",\"workloadType\":\"dcxsmlz\",\"friendlyName\":\"zdtxetlgyd\",\"protectionState\":\"Protected\"}") - .toObject(AzureFileShareProtectableItem.class); - Assertions.assertEquals("jhmqrhvthla", model.backupManagementType()); - Assertions.assertEquals("dcxsmlz", model.workloadType()); - Assertions.assertEquals("zdtxetlgyd", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("srlzknmzlan", model.parentContainerFabricId()); - Assertions.assertEquals("pdwvnphcn", model.parentContainerFriendlyName()); - Assertions.assertEquals(AzureFileShareType.INVALID, model.azureFileShareType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureFileShareProtectableItem model - = new AzureFileShareProtectableItem().withBackupManagementType("jhmqrhvthla") - .withWorkloadType("dcxsmlz") - .withFriendlyName("zdtxetlgyd") - .withProtectionState(ProtectionStatus.PROTECTED) - .withParentContainerFabricId("srlzknmzlan") - .withParentContainerFriendlyName("pdwvnphcn") - .withAzureFileShareType(AzureFileShareType.INVALID); - model = BinaryData.fromObject(model).toObject(AzureFileShareProtectableItem.class); - Assertions.assertEquals("jhmqrhvthla", model.backupManagementType()); - Assertions.assertEquals("dcxsmlz", model.workloadType()); - Assertions.assertEquals("zdtxetlgyd", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("srlzknmzlan", model.parentContainerFabricId()); - Assertions.assertEquals("pdwvnphcn", model.parentContainerFriendlyName()); - Assertions.assertEquals(AzureFileShareType.INVALID, model.azureFileShareType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProtectionPolicyTests.java deleted file mode 100644 index c1dd7185a83b3..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProtectionPolicyTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultRetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AzureFileShareProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureFileShareProtectionPolicy model = BinaryData.fromString( - "{\"backupManagementType\":\"AzureStorage\",\"workLoadType\":\"Client\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"vaultRetentionPolicy\":{\"vaultRetention\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"snapshotRetentionInDays\":211422779},\"timeZone\":\"tiewdj\",\"protectedItemsCount\":231543850,\"resourceGuardOperationRequests\":[\"wr\",\"ehwagoh\",\"uffkmrqemvvh\"]}") - .toObject(AzureFileShareProtectionPolicy.class); - Assertions.assertEquals(231543850, model.protectedItemsCount()); - Assertions.assertEquals("wr", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(WorkloadType.CLIENT, model.workLoadType()); - Assertions.assertEquals(211422779, model.vaultRetentionPolicy().snapshotRetentionInDays()); - Assertions.assertEquals("tiewdj", model.timeZone()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureFileShareProtectionPolicy model = new AzureFileShareProtectionPolicy().withProtectedItemsCount(231543850) - .withResourceGuardOperationRequests(Arrays.asList("wr", "ehwagoh", "uffkmrqemvvh")) - .withWorkLoadType(WorkloadType.CLIENT) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withVaultRetentionPolicy(new VaultRetentionPolicy().withVaultRetention(new RetentionPolicy()) - .withSnapshotRetentionInDays(211422779)) - .withTimeZone("tiewdj"); - model = BinaryData.fromObject(model).toObject(AzureFileShareProtectionPolicy.class); - Assertions.assertEquals(231543850, model.protectedItemsCount()); - Assertions.assertEquals("wr", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(WorkloadType.CLIENT, model.workLoadType()); - Assertions.assertEquals(211422779, model.vaultRetentionPolicy().snapshotRetentionInDays()); - Assertions.assertEquals("tiewdj", model.timeZone()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProvisionIlrRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProvisionIlrRequestTests.java deleted file mode 100644 index 54025125cb732..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareProvisionIlrRequestTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareProvisionIlrRequest; -import org.junit.jupiter.api.Assertions; - -public final class AzureFileShareProvisionIlrRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureFileShareProvisionIlrRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureFileShareProvisionILRRequest\",\"recoveryPointId\":\"lnnpx\",\"sourceResourceId\":\"afiqgeaarbgjekg\"}") - .toObject(AzureFileShareProvisionIlrRequest.class); - Assertions.assertEquals("lnnpx", model.recoveryPointId()); - Assertions.assertEquals("afiqgeaarbgjekg", model.sourceResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureFileShareProvisionIlrRequest model = new AzureFileShareProvisionIlrRequest().withRecoveryPointId("lnnpx") - .withSourceResourceId("afiqgeaarbgjekg"); - model = BinaryData.fromObject(model).toObject(AzureFileShareProvisionIlrRequest.class); - Assertions.assertEquals("lnnpx", model.recoveryPointId()); - Assertions.assertEquals("afiqgeaarbgjekg", model.sourceResourceId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareRecoveryPointTests.java deleted file mode 100644 index 81e9a9cd217ea..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareRecoveryPointTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureFileShareRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureFileShareRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"AzureFileShareRecoveryPoint\",\"recoveryPointType\":\"h\",\"recoveryPointTime\":\"2021-03-17T00:42:38Z\",\"fileShareSnapshotUri\":\"fdntwjchrdgoih\",\"recoveryPointSizeInGB\":1654736009,\"recoveryPointProperties\":{\"expiryTime\":\"ton\",\"ruleName\":\"jl\",\"isSoftDeleted\":true}}") - .toObject(AzureFileShareRecoveryPoint.class); - Assertions.assertEquals("h", model.recoveryPointType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-17T00:42:38Z"), model.recoveryPointTime()); - Assertions.assertEquals("fdntwjchrdgoih", model.fileShareSnapshotUri()); - Assertions.assertEquals(1654736009, model.recoveryPointSizeInGB()); - Assertions.assertEquals("ton", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("jl", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureFileShareRecoveryPoint model = new AzureFileShareRecoveryPoint().withRecoveryPointType("h") - .withRecoveryPointTime(OffsetDateTime.parse("2021-03-17T00:42:38Z")) - .withFileShareSnapshotUri("fdntwjchrdgoih") - .withRecoveryPointSizeInGB(1654736009) - .withRecoveryPointProperties( - new RecoveryPointProperties().withExpiryTime("ton").withRuleName("jl").withIsSoftDeleted(true)); - model = BinaryData.fromObject(model).toObject(AzureFileShareRecoveryPoint.class); - Assertions.assertEquals("h", model.recoveryPointType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-17T00:42:38Z"), model.recoveryPointTime()); - Assertions.assertEquals("fdntwjchrdgoih", model.fileShareSnapshotUri()); - Assertions.assertEquals(1654736009, model.recoveryPointSizeInGB()); - Assertions.assertEquals("ton", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("jl", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareRestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareRestoreRequestTests.java deleted file mode 100644 index a27915b50abf2..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileShareRestoreRequestTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareRestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.CopyOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreFileSpecs; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequestType; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetAfsRestoreInfo; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AzureFileShareRestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureFileShareRestoreRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureFileShareRestoreRequest\",\"recoveryType\":\"Offline\",\"sourceResourceId\":\"rgnepttwqmsniffc\",\"copyOptions\":\"Invalid\",\"restoreRequestType\":\"ItemLevelRestore\",\"restoreFileSpecs\":[{\"path\":\"pij\",\"fileSpecType\":\"rxfrddhc\",\"targetFolderPath\":\"tizzronasxif\"},{\"path\":\"zq\",\"fileSpecType\":\"hftwesgog\",\"targetFolderPath\":\"honnxkrlgnyhmos\"},{\"path\":\"kkgthr\",\"fileSpecType\":\"hxjbdhqxvc\",\"targetFolderPath\":\"frpdsofbshrns\"}],\"targetDetails\":{\"name\":\"swdvzyybycnun\",\"targetResourceId\":\"srtkfa\"},\"resourceGuardOperationRequests\":[\"pqgik\",\"zirtxdyuxzejntps\",\"wgioilqukry\",\"xtqmieoxor\"]}") - .toObject(AzureFileShareRestoreRequest.class); - Assertions.assertEquals("pqgik", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("rgnepttwqmsniffc", model.sourceResourceId()); - Assertions.assertEquals(CopyOptions.INVALID, model.copyOptions()); - Assertions.assertEquals(RestoreRequestType.ITEM_LEVEL_RESTORE, model.restoreRequestType()); - Assertions.assertEquals("pij", model.restoreFileSpecs().get(0).path()); - Assertions.assertEquals("rxfrddhc", model.restoreFileSpecs().get(0).fileSpecType()); - Assertions.assertEquals("tizzronasxif", model.restoreFileSpecs().get(0).targetFolderPath()); - Assertions.assertEquals("swdvzyybycnun", model.targetDetails().name()); - Assertions.assertEquals("srtkfa", model.targetDetails().targetResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureFileShareRestoreRequest model = new AzureFileShareRestoreRequest() - .withResourceGuardOperationRequests(Arrays.asList("pqgik", "zirtxdyuxzejntps", "wgioilqukry", "xtqmieoxor")) - .withRecoveryType(RecoveryType.OFFLINE) - .withSourceResourceId("rgnepttwqmsniffc") - .withCopyOptions(CopyOptions.INVALID) - .withRestoreRequestType(RestoreRequestType.ITEM_LEVEL_RESTORE) - .withRestoreFileSpecs(Arrays.asList( - new RestoreFileSpecs().withPath("pij") - .withFileSpecType("rxfrddhc") - .withTargetFolderPath("tizzronasxif"), - new RestoreFileSpecs().withPath("zq") - .withFileSpecType("hftwesgog") - .withTargetFolderPath("honnxkrlgnyhmos"), - new RestoreFileSpecs().withPath("kkgthr") - .withFileSpecType("hxjbdhqxvc") - .withTargetFolderPath("frpdsofbshrns"))) - .withTargetDetails(new TargetAfsRestoreInfo().withName("swdvzyybycnun").withTargetResourceId("srtkfa")); - model = BinaryData.fromObject(model).toObject(AzureFileShareRestoreRequest.class); - Assertions.assertEquals("pqgik", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("rgnepttwqmsniffc", model.sourceResourceId()); - Assertions.assertEquals(CopyOptions.INVALID, model.copyOptions()); - Assertions.assertEquals(RestoreRequestType.ITEM_LEVEL_RESTORE, model.restoreRequestType()); - Assertions.assertEquals("pij", model.restoreFileSpecs().get(0).path()); - Assertions.assertEquals("rxfrddhc", model.restoreFileSpecs().get(0).fileSpecType()); - Assertions.assertEquals("tizzronasxif", model.restoreFileSpecs().get(0).targetFolderPath()); - Assertions.assertEquals("swdvzyybycnun", model.targetDetails().name()); - Assertions.assertEquals("srtkfa", model.targetDetails().targetResourceId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileshareProtectedItemExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileshareProtectedItemExtendedInfoTests.java deleted file mode 100644 index 8f35e52eea292..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureFileshareProtectedItemExtendedInfoTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileshareProtectedItemExtendedInfo; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureFileshareProtectedItemExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureFileshareProtectedItemExtendedInfo model = BinaryData.fromString( - "{\"oldestRecoveryPoint\":\"2021-05-17T23:03:28Z\",\"recoveryPointCount\":1368964811,\"policyState\":\"lbfpncurd\",\"resourceState\":\"wiithtywub\",\"resourceStateSyncTime\":\"2021-05-27T18:04:18Z\"}") - .toObject(AzureFileshareProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-17T23:03:28Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(1368964811, model.recoveryPointCount()); - Assertions.assertEquals("lbfpncurd", model.policyState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureFileshareProtectedItemExtendedInfo model = new AzureFileshareProtectedItemExtendedInfo() - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-05-17T23:03:28Z")) - .withRecoveryPointCount(1368964811) - .withPolicyState("lbfpncurd"); - model = BinaryData.fromObject(model).toObject(AzureFileshareProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-17T23:03:28Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(1368964811, model.recoveryPointCount()); - Assertions.assertEquals("lbfpncurd", model.policyState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSClassicComputeVMContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSClassicComputeVMContainerTests.java deleted file mode 100644 index b1d75f7d4d795..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSClassicComputeVMContainerTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSClassicComputeVMContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSClassicComputeVMContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSClassicComputeVMContainer model = BinaryData.fromString( - "{\"containerType\":\"Microsoft.ClassicCompute/virtualMachines\",\"virtualMachineId\":\"lbyulidwcwvmze\",\"virtualMachineVersion\":\"o\",\"resourceGroup\":\"hj\",\"friendlyName\":\"wgdnqzbr\",\"backupManagementType\":\"DPM\",\"registrationStatus\":\"zhzmtksjci\",\"healthStatus\":\"igsxcdgljplk\",\"protectableObjectType\":\"acht\"}") - .toObject(AzureIaaSClassicComputeVMContainer.class); - Assertions.assertEquals("wgdnqzbr", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.backupManagementType()); - Assertions.assertEquals("zhzmtksjci", model.registrationStatus()); - Assertions.assertEquals("igsxcdgljplk", model.healthStatus()); - Assertions.assertEquals("acht", model.protectableObjectType()); - Assertions.assertEquals("lbyulidwcwvmze", model.virtualMachineId()); - Assertions.assertEquals("o", model.virtualMachineVersion()); - Assertions.assertEquals("hj", model.resourceGroup()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSClassicComputeVMContainer model = new AzureIaaSClassicComputeVMContainer().withFriendlyName("wgdnqzbr") - .withBackupManagementType(BackupManagementType.DPM) - .withRegistrationStatus("zhzmtksjci") - .withHealthStatus("igsxcdgljplk") - .withProtectableObjectType("acht") - .withVirtualMachineId("lbyulidwcwvmze") - .withVirtualMachineVersion("o") - .withResourceGroup("hj"); - model = BinaryData.fromObject(model).toObject(AzureIaaSClassicComputeVMContainer.class); - Assertions.assertEquals("wgdnqzbr", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.backupManagementType()); - Assertions.assertEquals("zhzmtksjci", model.registrationStatus()); - Assertions.assertEquals("igsxcdgljplk", model.healthStatus()); - Assertions.assertEquals("acht", model.protectableObjectType()); - Assertions.assertEquals("lbyulidwcwvmze", model.virtualMachineId()); - Assertions.assertEquals("o", model.virtualMachineVersion()); - Assertions.assertEquals("hj", model.resourceGroup()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSClassicComputeVMProtectableItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSClassicComputeVMProtectableItemTests.java deleted file mode 100644 index 9f1871d826a65..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSClassicComputeVMProtectableItemTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSClassicComputeVMProtectableItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSClassicComputeVMProtectableItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSClassicComputeVMProtectableItem model = BinaryData.fromString( - "{\"protectableItemType\":\"Microsoft.ClassicCompute/virtualMachines\",\"virtualMachineId\":\"rrleaesinuqt\",\"virtualMachineVersion\":\"qobbpihehcec\",\"resourceGroup\":\"mrqbrjbbmpxdlv\",\"backupManagementType\":\"frexcrseqw\",\"workloadType\":\"s\",\"friendlyName\":\"udgzhxogjgg\",\"protectionState\":\"NotProtected\"}") - .toObject(AzureIaaSClassicComputeVMProtectableItem.class); - Assertions.assertEquals("frexcrseqw", model.backupManagementType()); - Assertions.assertEquals("s", model.workloadType()); - Assertions.assertEquals("udgzhxogjgg", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("rrleaesinuqt", model.virtualMachineId()); - Assertions.assertEquals("qobbpihehcec", model.virtualMachineVersion()); - Assertions.assertEquals("mrqbrjbbmpxdlv", model.resourceGroup()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSClassicComputeVMProtectableItem model - = new AzureIaaSClassicComputeVMProtectableItem().withBackupManagementType("frexcrseqw") - .withWorkloadType("s") - .withFriendlyName("udgzhxogjgg") - .withProtectionState(ProtectionStatus.NOT_PROTECTED) - .withVirtualMachineId("rrleaesinuqt") - .withVirtualMachineVersion("qobbpihehcec") - .withResourceGroup("mrqbrjbbmpxdlv"); - model = BinaryData.fromObject(model).toObject(AzureIaaSClassicComputeVMProtectableItem.class); - Assertions.assertEquals("frexcrseqw", model.backupManagementType()); - Assertions.assertEquals("s", model.workloadType()); - Assertions.assertEquals("udgzhxogjgg", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("rrleaesinuqt", model.virtualMachineId()); - Assertions.assertEquals("qobbpihehcec", model.virtualMachineVersion()); - Assertions.assertEquals("mrqbrjbbmpxdlv", model.resourceGroup()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSComputeVMContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSComputeVMContainerTests.java deleted file mode 100644 index 1cdb6d14f09e2..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSComputeVMContainerTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSComputeVMContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSComputeVMContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSComputeVMContainer model = BinaryData.fromString( - "{\"containerType\":\"Microsoft.Compute/virtualMachines\",\"virtualMachineId\":\"mlikytw\",\"virtualMachineVersion\":\"zc\",\"resourceGroup\":\"k\",\"friendlyName\":\"ve\",\"backupManagementType\":\"DefaultBackup\",\"registrationStatus\":\"vlvhbwrnfxtgd\",\"healthStatus\":\"qthe\",\"protectableObjectType\":\"mnaoy\"}") - .toObject(AzureIaaSComputeVMContainer.class); - Assertions.assertEquals("ve", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("vlvhbwrnfxtgd", model.registrationStatus()); - Assertions.assertEquals("qthe", model.healthStatus()); - Assertions.assertEquals("mnaoy", model.protectableObjectType()); - Assertions.assertEquals("mlikytw", model.virtualMachineId()); - Assertions.assertEquals("zc", model.virtualMachineVersion()); - Assertions.assertEquals("k", model.resourceGroup()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSComputeVMContainer model = new AzureIaaSComputeVMContainer().withFriendlyName("ve") - .withBackupManagementType(BackupManagementType.DEFAULT_BACKUP) - .withRegistrationStatus("vlvhbwrnfxtgd") - .withHealthStatus("qthe") - .withProtectableObjectType("mnaoy") - .withVirtualMachineId("mlikytw") - .withVirtualMachineVersion("zc") - .withResourceGroup("k"); - model = BinaryData.fromObject(model).toObject(AzureIaaSComputeVMContainer.class); - Assertions.assertEquals("ve", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("vlvhbwrnfxtgd", model.registrationStatus()); - Assertions.assertEquals("qthe", model.healthStatus()); - Assertions.assertEquals("mnaoy", model.protectableObjectType()); - Assertions.assertEquals("mlikytw", model.virtualMachineId()); - Assertions.assertEquals("zc", model.virtualMachineVersion()); - Assertions.assertEquals("k", model.resourceGroup()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSComputeVMProtectableItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSComputeVMProtectableItemTests.java deleted file mode 100644 index c7e15d4dc7442..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSComputeVMProtectableItemTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSComputeVMProtectableItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSComputeVMProtectableItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSComputeVMProtectableItem model = BinaryData.fromString( - "{\"protectableItemType\":\"Microsoft.Compute/virtualMachines\",\"virtualMachineId\":\"kcoeqswank\",\"virtualMachineVersion\":\"ytmhdroznnhdrlkt\",\"resourceGroup\":\"csgguxhemlw\",\"backupManagementType\":\"ae\",\"workloadType\":\"zgfbukklelssx\",\"friendlyName\":\"ycsxzu\",\"protectionState\":\"Protected\"}") - .toObject(AzureIaaSComputeVMProtectableItem.class); - Assertions.assertEquals("ae", model.backupManagementType()); - Assertions.assertEquals("zgfbukklelssx", model.workloadType()); - Assertions.assertEquals("ycsxzu", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("kcoeqswank", model.virtualMachineId()); - Assertions.assertEquals("ytmhdroznnhdrlkt", model.virtualMachineVersion()); - Assertions.assertEquals("csgguxhemlw", model.resourceGroup()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSComputeVMProtectableItem model = new AzureIaaSComputeVMProtectableItem().withBackupManagementType("ae") - .withWorkloadType("zgfbukklelssx") - .withFriendlyName("ycsxzu") - .withProtectionState(ProtectionStatus.PROTECTED) - .withVirtualMachineId("kcoeqswank") - .withVirtualMachineVersion("ytmhdroznnhdrlkt") - .withResourceGroup("csgguxhemlw"); - model = BinaryData.fromObject(model).toObject(AzureIaaSComputeVMProtectableItem.class); - Assertions.assertEquals("ae", model.backupManagementType()); - Assertions.assertEquals("zgfbukklelssx", model.workloadType()); - Assertions.assertEquals("ycsxzu", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("kcoeqswank", model.virtualMachineId()); - Assertions.assertEquals("ytmhdroznnhdrlkt", model.virtualMachineVersion()); - Assertions.assertEquals("csgguxhemlw", model.resourceGroup()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmJobExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmJobExtendedInfoTests.java deleted file mode 100644 index de739996dd0bb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmJobExtendedInfoTests.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmJobExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmJobTaskDetails; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSvmJobExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSvmJobExtendedInfo model = BinaryData.fromString( - "{\"tasksList\":[{\"taskId\":\"qdunvmnnrwrbior\",\"startTime\":\"2021-10-04T07:28:45Z\",\"endTime\":\"2021-08-10T02:45:15Z\",\"instanceId\":\"jhhgdnhxmsi\",\"duration\":\"PT132H45M45S\",\"status\":\"iloxggdufiq\",\"progressPercentage\":88.44245570295712,\"taskExecutionDetails\":\"zaofjchvcyy\"},{\"taskId\":\"fgdo\",\"startTime\":\"2021-02-19T09:04:20Z\",\"endTime\":\"2021-03-25T23:54:59Z\",\"instanceId\":\"p\",\"duration\":\"PT52H49M10S\",\"status\":\"oqonma\",\"progressPercentage\":21.281080006106546,\"taskExecutionDetails\":\"izsh\"}],\"propertyBag\":{\"mblrrilbywd\":\"impevf\",\"n\":\"smiccwrwfscj\"},\"internalPropertyBag\":{\"wb\":\"zqujizdvoqytiby\",\"vutpthjoxo\":\"lgy\",\"pi\":\"smsks\"},\"progressPercentage\":19.47377395997789,\"estimatedRemainingDuration\":\"jxkcgxxlxsff\",\"dynamicErrorMessage\":\"vizqzdwl\"}") - .toObject(AzureIaaSvmJobExtendedInfo.class); - Assertions.assertEquals("qdunvmnnrwrbior", model.tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-04T07:28:45Z"), model.tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-10T02:45:15Z"), model.tasksList().get(0).endTime()); - Assertions.assertEquals("jhhgdnhxmsi", model.tasksList().get(0).instanceId()); - Assertions.assertEquals(Duration.parse("PT132H45M45S"), model.tasksList().get(0).duration()); - Assertions.assertEquals("iloxggdufiq", model.tasksList().get(0).status()); - Assertions.assertEquals(88.44245570295712D, model.tasksList().get(0).progressPercentage()); - Assertions.assertEquals("zaofjchvcyy", model.tasksList().get(0).taskExecutionDetails()); - Assertions.assertEquals("impevf", model.propertyBag().get("mblrrilbywd")); - Assertions.assertEquals("zqujizdvoqytiby", model.internalPropertyBag().get("wb")); - Assertions.assertEquals(19.47377395997789D, model.progressPercentage()); - Assertions.assertEquals("jxkcgxxlxsff", model.estimatedRemainingDuration()); - Assertions.assertEquals("vizqzdwl", model.dynamicErrorMessage()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSvmJobExtendedInfo model = new AzureIaaSvmJobExtendedInfo() - .withTasksList(Arrays.asList( - new AzureIaaSvmJobTaskDetails().withTaskId("qdunvmnnrwrbior") - .withStartTime(OffsetDateTime.parse("2021-10-04T07:28:45Z")) - .withEndTime(OffsetDateTime.parse("2021-08-10T02:45:15Z")) - .withInstanceId("jhhgdnhxmsi") - .withDuration(Duration.parse("PT132H45M45S")) - .withStatus("iloxggdufiq") - .withProgressPercentage(88.44245570295712D) - .withTaskExecutionDetails("zaofjchvcyy"), - new AzureIaaSvmJobTaskDetails().withTaskId("fgdo") - .withStartTime(OffsetDateTime.parse("2021-02-19T09:04:20Z")) - .withEndTime(OffsetDateTime.parse("2021-03-25T23:54:59Z")) - .withInstanceId("p") - .withDuration(Duration.parse("PT52H49M10S")) - .withStatus("oqonma") - .withProgressPercentage(21.281080006106546D) - .withTaskExecutionDetails("izsh"))) - .withPropertyBag(mapOf("mblrrilbywd", "impevf", "n", "smiccwrwfscj")) - .withInternalPropertyBag(mapOf("wb", "zqujizdvoqytiby", "vutpthjoxo", "lgy", "pi", "smsks")) - .withProgressPercentage(19.47377395997789D) - .withEstimatedRemainingDuration("jxkcgxxlxsff") - .withDynamicErrorMessage("vizqzdwl"); - model = BinaryData.fromObject(model).toObject(AzureIaaSvmJobExtendedInfo.class); - Assertions.assertEquals("qdunvmnnrwrbior", model.tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-04T07:28:45Z"), model.tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-10T02:45:15Z"), model.tasksList().get(0).endTime()); - Assertions.assertEquals("jhhgdnhxmsi", model.tasksList().get(0).instanceId()); - Assertions.assertEquals(Duration.parse("PT132H45M45S"), model.tasksList().get(0).duration()); - Assertions.assertEquals("iloxggdufiq", model.tasksList().get(0).status()); - Assertions.assertEquals(88.44245570295712D, model.tasksList().get(0).progressPercentage()); - Assertions.assertEquals("zaofjchvcyy", model.tasksList().get(0).taskExecutionDetails()); - Assertions.assertEquals("impevf", model.propertyBag().get("mblrrilbywd")); - Assertions.assertEquals("zqujizdvoqytiby", model.internalPropertyBag().get("wb")); - Assertions.assertEquals(19.47377395997789D, model.progressPercentage()); - Assertions.assertEquals("jxkcgxxlxsff", model.estimatedRemainingDuration()); - Assertions.assertEquals("vizqzdwl", model.dynamicErrorMessage()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmJobTaskDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmJobTaskDetailsTests.java deleted file mode 100644 index 722d6d547c22a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmJobTaskDetailsTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmJobTaskDetails; -import java.time.Duration; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSvmJobTaskDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSvmJobTaskDetails model = BinaryData.fromString( - "{\"taskId\":\"lyoupfgfbkju\",\"startTime\":\"2021-04-30T06:19:59Z\",\"endTime\":\"2021-05-02T14:41:51Z\",\"instanceId\":\"fminsgowzf\",\"duration\":\"PT64H45M57S\",\"status\":\"t\",\"progressPercentage\":21.873740552777832,\"taskExecutionDetails\":\"bqactxtgzukx\"}") - .toObject(AzureIaaSvmJobTaskDetails.class); - Assertions.assertEquals("lyoupfgfbkju", model.taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-30T06:19:59Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-02T14:41:51Z"), model.endTime()); - Assertions.assertEquals("fminsgowzf", model.instanceId()); - Assertions.assertEquals(Duration.parse("PT64H45M57S"), model.duration()); - Assertions.assertEquals("t", model.status()); - Assertions.assertEquals(21.873740552777832D, model.progressPercentage()); - Assertions.assertEquals("bqactxtgzukx", model.taskExecutionDetails()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSvmJobTaskDetails model = new AzureIaaSvmJobTaskDetails().withTaskId("lyoupfgfbkju") - .withStartTime(OffsetDateTime.parse("2021-04-30T06:19:59Z")) - .withEndTime(OffsetDateTime.parse("2021-05-02T14:41:51Z")) - .withInstanceId("fminsgowzf") - .withDuration(Duration.parse("PT64H45M57S")) - .withStatus("t") - .withProgressPercentage(21.873740552777832D) - .withTaskExecutionDetails("bqactxtgzukx"); - model = BinaryData.fromObject(model).toObject(AzureIaaSvmJobTaskDetails.class); - Assertions.assertEquals("lyoupfgfbkju", model.taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-30T06:19:59Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-02T14:41:51Z"), model.endTime()); - Assertions.assertEquals("fminsgowzf", model.instanceId()); - Assertions.assertEquals(Duration.parse("PT64H45M57S"), model.duration()); - Assertions.assertEquals("t", model.status()); - Assertions.assertEquals(21.873740552777832D, model.progressPercentage()); - Assertions.assertEquals("bqactxtgzukx", model.taskExecutionDetails()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmProtectedItemExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmProtectedItemExtendedInfoTests.java deleted file mode 100644 index fa9ec49ab75cf..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmProtectedItemExtendedInfoTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmProtectedItemExtendedInfo; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSvmProtectedItemExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSvmProtectedItemExtendedInfo model = BinaryData.fromString( - "{\"oldestRecoveryPoint\":\"2021-09-10T06:11:21Z\",\"oldestRecoveryPointInVault\":\"2021-06-03T02:33:07Z\",\"oldestRecoveryPointInArchive\":\"2021-08-28T04:22:09Z\",\"newestRecoveryPointInArchive\":\"2021-05-06T18:00:02Z\",\"recoveryPointCount\":1747811781,\"policyInconsistent\":false}") - .toObject(AzureIaaSvmProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T06:11:21Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-03T02:33:07Z"), model.oldestRecoveryPointInVault()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-28T04:22:09Z"), model.oldestRecoveryPointInArchive()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-06T18:00:02Z"), model.newestRecoveryPointInArchive()); - Assertions.assertEquals(1747811781, model.recoveryPointCount()); - Assertions.assertEquals(false, model.policyInconsistent()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSvmProtectedItemExtendedInfo model = new AzureIaaSvmProtectedItemExtendedInfo() - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-09-10T06:11:21Z")) - .withOldestRecoveryPointInVault(OffsetDateTime.parse("2021-06-03T02:33:07Z")) - .withOldestRecoveryPointInArchive(OffsetDateTime.parse("2021-08-28T04:22:09Z")) - .withNewestRecoveryPointInArchive(OffsetDateTime.parse("2021-05-06T18:00:02Z")) - .withRecoveryPointCount(1747811781) - .withPolicyInconsistent(false); - model = BinaryData.fromObject(model).toObject(AzureIaaSvmProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T06:11:21Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-03T02:33:07Z"), model.oldestRecoveryPointInVault()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-28T04:22:09Z"), model.oldestRecoveryPointInArchive()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-06T18:00:02Z"), model.newestRecoveryPointInArchive()); - Assertions.assertEquals(1747811781, model.recoveryPointCount()); - Assertions.assertEquals(false, model.policyInconsistent()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmProtectionPolicyTests.java deleted file mode 100644 index 256d0df40831f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmProtectionPolicyTests.java +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureIaaSvmProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaasvmPolicyType; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMSnapshotConsistencyType; -import com.azure.resourcemanager.recoveryservicesbackup.models.InstantRPAdditionalDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringPolicy; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureIaaSvmProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureIaaSvmProtectionPolicy model = BinaryData.fromString( - "{\"backupManagementType\":\"AzureIaasVM\",\"instantRPDetails\":{\"azureBackupRGNamePrefix\":\"k\",\"azureBackupRGNameSuffix\":\"zfvazi\"},\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"tieringPolicy\":{\"lkatnwxyiopidkqq\":{\"tieringMode\":\"TierRecommended\",\"duration\":1411328763,\"durationType\":\"Years\"},\"kdmligovi\":{\"tieringMode\":\"DoNotTier\",\"duration\":113648851,\"durationType\":\"Weeks\"},\"oaz\":{\"tieringMode\":\"Invalid\",\"duration\":610794804,\"durationType\":\"Days\"},\"oorb\":{\"tieringMode\":\"Invalid\",\"duration\":1388266960,\"durationType\":\"Years\"}},\"instantRpRetentionRangeInDays\":1028878744,\"timeZone\":\"bfhjxakvvjgsl\",\"policyType\":\"Invalid\",\"snapshotConsistencyType\":\"OnlyCrashConsistent\",\"protectedItemsCount\":482425656,\"resourceGuardOperationRequests\":[\"t\"]}") - .toObject(AzureIaaSvmProtectionPolicy.class); - Assertions.assertEquals(482425656, model.protectedItemsCount()); - Assertions.assertEquals("t", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("k", model.instantRPDetails().azureBackupRGNamePrefix()); - Assertions.assertEquals("zfvazi", model.instantRPDetails().azureBackupRGNameSuffix()); - Assertions.assertEquals(TieringMode.TIER_RECOMMENDED, - model.tieringPolicy().get("lkatnwxyiopidkqq").tieringMode()); - Assertions.assertEquals(1411328763, model.tieringPolicy().get("lkatnwxyiopidkqq").duration()); - Assertions.assertEquals(RetentionDurationType.YEARS, - model.tieringPolicy().get("lkatnwxyiopidkqq").durationType()); - Assertions.assertEquals(1028878744, model.instantRpRetentionRangeInDays()); - Assertions.assertEquals("bfhjxakvvjgsl", model.timeZone()); - Assertions.assertEquals(IaasvmPolicyType.INVALID, model.policyType()); - Assertions.assertEquals(IaasVMSnapshotConsistencyType.ONLY_CRASH_CONSISTENT, model.snapshotConsistencyType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureIaaSvmProtectionPolicy model = new AzureIaaSvmProtectionPolicy().withProtectedItemsCount(482425656) - .withResourceGuardOperationRequests(Arrays.asList("t")) - .withInstantRPDetails( - new InstantRPAdditionalDetails().withAzureBackupRGNamePrefix("k").withAzureBackupRGNameSuffix("zfvazi")) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withTieringPolicy(mapOf("lkatnwxyiopidkqq", - new TieringPolicy().withTieringMode(TieringMode.TIER_RECOMMENDED) - .withDuration(1411328763) - .withDurationType(RetentionDurationType.YEARS), - "kdmligovi", - new TieringPolicy().withTieringMode(TieringMode.DO_NOT_TIER) - .withDuration(113648851) - .withDurationType(RetentionDurationType.WEEKS), - "oaz", - new TieringPolicy().withTieringMode(TieringMode.INVALID) - .withDuration(610794804) - .withDurationType(RetentionDurationType.DAYS), - "oorb", - new TieringPolicy().withTieringMode(TieringMode.INVALID) - .withDuration(1388266960) - .withDurationType(RetentionDurationType.YEARS))) - .withInstantRpRetentionRangeInDays(1028878744) - .withTimeZone("bfhjxakvvjgsl") - .withPolicyType(IaasvmPolicyType.INVALID) - .withSnapshotConsistencyType(IaasVMSnapshotConsistencyType.ONLY_CRASH_CONSISTENT); - model = BinaryData.fromObject(model).toObject(AzureIaaSvmProtectionPolicy.class); - Assertions.assertEquals(482425656, model.protectedItemsCount()); - Assertions.assertEquals("t", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("k", model.instantRPDetails().azureBackupRGNamePrefix()); - Assertions.assertEquals("zfvazi", model.instantRPDetails().azureBackupRGNameSuffix()); - Assertions.assertEquals(TieringMode.TIER_RECOMMENDED, - model.tieringPolicy().get("lkatnwxyiopidkqq").tieringMode()); - Assertions.assertEquals(1411328763, model.tieringPolicy().get("lkatnwxyiopidkqq").duration()); - Assertions.assertEquals(RetentionDurationType.YEARS, - model.tieringPolicy().get("lkatnwxyiopidkqq").durationType()); - Assertions.assertEquals(1028878744, model.instantRpRetentionRangeInDays()); - Assertions.assertEquals("bfhjxakvvjgsl", model.timeZone()); - Assertions.assertEquals(IaasvmPolicyType.INVALID, model.policyType()); - Assertions.assertEquals(IaasVMSnapshotConsistencyType.ONLY_CRASH_CONSISTENT, model.snapshotConsistencyType()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureRecoveryServiceVaultProtectionIntentTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureRecoveryServiceVaultProtectionIntentTests.java deleted file mode 100644 index 44cc9ef444e68..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureRecoveryServiceVaultProtectionIntentTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureRecoveryServiceVaultProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureRecoveryServiceVaultProtectionIntentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureRecoveryServiceVaultProtectionIntent model = BinaryData.fromString( - "{\"protectionIntentItemType\":\"RecoveryServiceVaultItem\",\"backupManagementType\":\"MAB\",\"sourceResourceId\":\"ttuiaclkiexhajl\",\"itemId\":\"t\",\"policyId\":\"qfyuttd\",\"protectionState\":\"NotProtected\"}") - .toObject(AzureRecoveryServiceVaultProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("ttuiaclkiexhajl", model.sourceResourceId()); - Assertions.assertEquals("t", model.itemId()); - Assertions.assertEquals("qfyuttd", model.policyId()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureRecoveryServiceVaultProtectionIntent model - = new AzureRecoveryServiceVaultProtectionIntent().withBackupManagementType(BackupManagementType.MAB) - .withSourceResourceId("ttuiaclkiexhajl") - .withItemId("t") - .withPolicyId("qfyuttd") - .withProtectionState(ProtectionStatus.NOT_PROTECTED); - model = BinaryData.fromObject(model).toObject(AzureRecoveryServiceVaultProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("ttuiaclkiexhajl", model.sourceResourceId()); - Assertions.assertEquals("t", model.itemId()); - Assertions.assertEquals("qfyuttd", model.policyId()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureResourceProtectionIntentTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureResourceProtectionIntentTests.java deleted file mode 100644 index 52fb264814f37..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureResourceProtectionIntentTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureResourceProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureResourceProtectionIntentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureResourceProtectionIntent model = BinaryData.fromString( - "{\"protectionIntentItemType\":\"AzureResourceItem\",\"friendlyName\":\"pvn\",\"backupManagementType\":\"Invalid\",\"sourceResourceId\":\"txkyctwwgzwxjlm\",\"itemId\":\"vogygzyvneez\",\"policyId\":\"fg\",\"protectionState\":\"NotProtected\"}") - .toObject(AzureResourceProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.INVALID, model.backupManagementType()); - Assertions.assertEquals("txkyctwwgzwxjlm", model.sourceResourceId()); - Assertions.assertEquals("vogygzyvneez", model.itemId()); - Assertions.assertEquals("fg", model.policyId()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("pvn", model.friendlyName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureResourceProtectionIntent model - = new AzureResourceProtectionIntent().withBackupManagementType(BackupManagementType.INVALID) - .withSourceResourceId("txkyctwwgzwxjlm") - .withItemId("vogygzyvneez") - .withPolicyId("fg") - .withProtectionState(ProtectionStatus.NOT_PROTECTED) - .withFriendlyName("pvn"); - model = BinaryData.fromObject(model).toObject(AzureResourceProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.INVALID, model.backupManagementType()); - Assertions.assertEquals("txkyctwwgzwxjlm", model.sourceResourceId()); - Assertions.assertEquals("vogygzyvneez", model.itemId()); - Assertions.assertEquals("fg", model.policyId()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("pvn", model.friendlyName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlContainerTests.java deleted file mode 100644 index aa2b32a701b1b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlContainerTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import org.junit.jupiter.api.Assertions; - -public final class AzureSqlContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureSqlContainer model = BinaryData.fromString( - "{\"containerType\":\"AzureSqlContainer\",\"friendlyName\":\"mcub\",\"backupManagementType\":\"AzureSql\",\"registrationStatus\":\"oxxkubvp\",\"healthStatus\":\"v\",\"protectableObjectType\":\"h\"}") - .toObject(AzureSqlContainer.class); - Assertions.assertEquals("mcub", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("oxxkubvp", model.registrationStatus()); - Assertions.assertEquals("v", model.healthStatus()); - Assertions.assertEquals("h", model.protectableObjectType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureSqlContainer model = new AzureSqlContainer().withFriendlyName("mcub") - .withBackupManagementType(BackupManagementType.AZURE_SQL) - .withRegistrationStatus("oxxkubvp") - .withHealthStatus("v") - .withProtectableObjectType("h"); - model = BinaryData.fromObject(model).toObject(AzureSqlContainer.class); - Assertions.assertEquals("mcub", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("oxxkubvp", model.registrationStatus()); - Assertions.assertEquals("v", model.healthStatus()); - Assertions.assertEquals("h", model.protectableObjectType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectedItemExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectedItemExtendedInfoTests.java deleted file mode 100644 index a6b7edb8f6fbb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectedItemExtendedInfoTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlProtectedItemExtendedInfo; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureSqlProtectedItemExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureSqlProtectedItemExtendedInfo model = BinaryData.fromString( - "{\"oldestRecoveryPoint\":\"2021-06-10T22:10:44Z\",\"recoveryPointCount\":2048413099,\"policyState\":\"vlerchpqbmfpjba\"}") - .toObject(AzureSqlProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T22:10:44Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(2048413099, model.recoveryPointCount()); - Assertions.assertEquals("vlerchpqbmfpjba", model.policyState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureSqlProtectedItemExtendedInfo model = new AzureSqlProtectedItemExtendedInfo() - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-06-10T22:10:44Z")) - .withRecoveryPointCount(2048413099) - .withPolicyState("vlerchpqbmfpjba"); - model = BinaryData.fromObject(model).toObject(AzureSqlProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T22:10:44Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(2048413099, model.recoveryPointCount()); - Assertions.assertEquals("vlerchpqbmfpjba", model.policyState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectedItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectedItemTests.java deleted file mode 100644 index 3705c7f879819..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectedItemTests.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlProtectedItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlProtectedItemExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemState; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AzureSqlProtectedItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureSqlProtectedItem model = BinaryData.fromString( - "{\"protectedItemType\":\"Microsoft.Sql/servers/databases\",\"protectedItemDataId\":\"udtjuewbc\",\"protectionState\":\"Protected\",\"extendedInfo\":{\"oldestRecoveryPoint\":\"2021-03-30T06:07:22Z\",\"recoveryPointCount\":143136567,\"policyState\":\"yxccyb\"},\"backupManagementType\":\"AzureStorage\",\"workloadType\":\"SQLDB\",\"containerName\":\"kudzpxgwj\",\"sourceResourceId\":\"mag\",\"policyId\":\"cyohpfkyrkdbd\",\"lastRecoveryPoint\":\"2021-11-23T10:21:46Z\",\"backupSetName\":\"sjkmnwqj\",\"createMode\":\"Default\",\"deferredDeleteTimeInUTC\":\"2021-01-19T13:37:50Z\",\"isScheduledForDeferredDelete\":false,\"deferredDeleteTimeRemaining\":\"d\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":true,\"resourceGuardOperationRequests\":[\"n\",\"ntfpmvmemfnc\",\"dwvvba\",\"xlllchp\"],\"isArchiveEnabled\":false,\"policyName\":\"evwrdnhfuk\",\"softDeleteRetentionPeriodInDays\":1934709471,\"vaultId\":\"cswsmystul\"}") - .toObject(AzureSqlProtectedItem.class); - Assertions.assertEquals("kudzpxgwj", model.containerName()); - Assertions.assertEquals("mag", model.sourceResourceId()); - Assertions.assertEquals("cyohpfkyrkdbd", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-23T10:21:46Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("sjkmnwqj", model.backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-19T13:37:50Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("d", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("n", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isArchiveEnabled()); - Assertions.assertEquals("evwrdnhfuk", model.policyName()); - Assertions.assertEquals(1934709471, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("udtjuewbc", model.protectedItemDataId()); - Assertions.assertEquals(ProtectedItemState.PROTECTED, model.protectionState()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-30T06:07:22Z"), - model.extendedInfo().oldestRecoveryPoint()); - Assertions.assertEquals(143136567, model.extendedInfo().recoveryPointCount()); - Assertions.assertEquals("yxccyb", model.extendedInfo().policyState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureSqlProtectedItem model = new AzureSqlProtectedItem().withContainerName("kudzpxgwj") - .withSourceResourceId("mag") - .withPolicyId("cyohpfkyrkdbd") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-11-23T10:21:46Z")) - .withBackupSetName("sjkmnwqj") - .withCreateMode(CreateMode.DEFAULT) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-01-19T13:37:50Z")) - .withIsScheduledForDeferredDelete(false) - .withDeferredDeleteTimeRemaining("d") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(true) - .withResourceGuardOperationRequests(Arrays.asList("n", "ntfpmvmemfnc", "dwvvba", "xlllchp")) - .withIsArchiveEnabled(false) - .withPolicyName("evwrdnhfuk") - .withSoftDeleteRetentionPeriod(1934709471) - .withProtectedItemDataId("udtjuewbc") - .withProtectionState(ProtectedItemState.PROTECTED) - .withExtendedInfo(new AzureSqlProtectedItemExtendedInfo() - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-03-30T06:07:22Z")) - .withRecoveryPointCount(143136567) - .withPolicyState("yxccyb")); - model = BinaryData.fromObject(model).toObject(AzureSqlProtectedItem.class); - Assertions.assertEquals("kudzpxgwj", model.containerName()); - Assertions.assertEquals("mag", model.sourceResourceId()); - Assertions.assertEquals("cyohpfkyrkdbd", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-23T10:21:46Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("sjkmnwqj", model.backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-19T13:37:50Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("d", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("n", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isArchiveEnabled()); - Assertions.assertEquals("evwrdnhfuk", model.policyName()); - Assertions.assertEquals(1934709471, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("udtjuewbc", model.protectedItemDataId()); - Assertions.assertEquals(ProtectedItemState.PROTECTED, model.protectionState()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-30T06:07:22Z"), - model.extendedInfo().oldestRecoveryPoint()); - Assertions.assertEquals(143136567, model.extendedInfo().recoveryPointCount()); - Assertions.assertEquals("yxccyb", model.extendedInfo().policyState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectionPolicyTests.java deleted file mode 100644 index 3e5af2593df02..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureSqlProtectionPolicyTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureSqlProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AzureSqlProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureSqlProtectionPolicy model = BinaryData.fromString( - "{\"backupManagementType\":\"AzureSql\",\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"protectedItemsCount\":1275946087,\"resourceGuardOperationRequests\":[\"spuunnoxyhkxgq\",\"drihpfhoqcaaewda\",\"mdjvlpj\",\"xkzb\"]}") - .toObject(AzureSqlProtectionPolicy.class); - Assertions.assertEquals(1275946087, model.protectedItemsCount()); - Assertions.assertEquals("spuunnoxyhkxgq", model.resourceGuardOperationRequests().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureSqlProtectionPolicy model = new AzureSqlProtectionPolicy().withProtectedItemsCount(1275946087) - .withResourceGuardOperationRequests(Arrays.asList("spuunnoxyhkxgq", "drihpfhoqcaaewda", "mdjvlpj", "xkzb")) - .withRetentionPolicy(new RetentionPolicy()); - model = BinaryData.fromObject(model).toObject(AzureSqlProtectionPolicy.class); - Assertions.assertEquals(1275946087, model.protectedItemsCount()); - Assertions.assertEquals("spuunnoxyhkxgq", model.resourceGuardOperationRequests().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageContainerTests.java deleted file mode 100644 index a1fd681015ff6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageContainerTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AcquireStorageAccountLock; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import org.junit.jupiter.api.Assertions; - -public final class AzureStorageContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureStorageContainer model = BinaryData.fromString( - "{\"containerType\":\"StorageContainer\",\"sourceResourceId\":\"bqgvgovpbbtte\",\"storageAccountVersion\":\"oknssqyzqedikdf\",\"resourceGroup\":\"biqmrjgei\",\"protectedItemCount\":7728759697884020161,\"acquireStorageAccountLock\":\"NotAcquire\",\"friendlyName\":\"fiwzcxmjpbyep\",\"backupManagementType\":\"MAB\",\"registrationStatus\":\"vljvrc\",\"healthStatus\":\"fqip\",\"protectableObjectType\":\"hnp\"}") - .toObject(AzureStorageContainer.class); - Assertions.assertEquals("fiwzcxmjpbyep", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("vljvrc", model.registrationStatus()); - Assertions.assertEquals("fqip", model.healthStatus()); - Assertions.assertEquals("hnp", model.protectableObjectType()); - Assertions.assertEquals("bqgvgovpbbtte", model.sourceResourceId()); - Assertions.assertEquals("oknssqyzqedikdf", model.storageAccountVersion()); - Assertions.assertEquals("biqmrjgei", model.resourceGroup()); - Assertions.assertEquals(7728759697884020161L, model.protectedItemCount()); - Assertions.assertEquals(AcquireStorageAccountLock.NOT_ACQUIRE, model.acquireStorageAccountLock()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureStorageContainer model = new AzureStorageContainer().withFriendlyName("fiwzcxmjpbyep") - .withBackupManagementType(BackupManagementType.MAB) - .withRegistrationStatus("vljvrc") - .withHealthStatus("fqip") - .withProtectableObjectType("hnp") - .withSourceResourceId("bqgvgovpbbtte") - .withStorageAccountVersion("oknssqyzqedikdf") - .withResourceGroup("biqmrjgei") - .withProtectedItemCount(7728759697884020161L) - .withAcquireStorageAccountLock(AcquireStorageAccountLock.NOT_ACQUIRE); - model = BinaryData.fromObject(model).toObject(AzureStorageContainer.class); - Assertions.assertEquals("fiwzcxmjpbyep", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("vljvrc", model.registrationStatus()); - Assertions.assertEquals("fqip", model.healthStatus()); - Assertions.assertEquals("hnp", model.protectableObjectType()); - Assertions.assertEquals("bqgvgovpbbtte", model.sourceResourceId()); - Assertions.assertEquals("oknssqyzqedikdf", model.storageAccountVersion()); - Assertions.assertEquals("biqmrjgei", model.resourceGroup()); - Assertions.assertEquals(7728759697884020161L, model.protectedItemCount()); - Assertions.assertEquals(AcquireStorageAccountLock.NOT_ACQUIRE, model.acquireStorageAccountLock()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageJobExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageJobExtendedInfoTests.java deleted file mode 100644 index d32ca90ef4f59..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageJobExtendedInfoTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageJobExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageJobTaskDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureStorageJobExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureStorageJobExtendedInfo model = BinaryData.fromString( - "{\"tasksList\":[{\"taskId\":\"cjdx\",\"status\":\"bzo\"}],\"propertyBag\":{\"ogtqxepnylbf\":\"ulapzwyrp\",\"cib\":\"ajlyjtlvofqzhv\",\"uxrkjp\":\"fmo\",\"wiivwzjbhyzsx\":\"dwxf\"},\"dynamicErrorMessage\":\"kambtrnegvmnvuqe\"}") - .toObject(AzureStorageJobExtendedInfo.class); - Assertions.assertEquals("cjdx", model.tasksList().get(0).taskId()); - Assertions.assertEquals("bzo", model.tasksList().get(0).status()); - Assertions.assertEquals("ulapzwyrp", model.propertyBag().get("ogtqxepnylbf")); - Assertions.assertEquals("kambtrnegvmnvuqe", model.dynamicErrorMessage()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureStorageJobExtendedInfo model = new AzureStorageJobExtendedInfo() - .withTasksList(Arrays.asList(new AzureStorageJobTaskDetails().withTaskId("cjdx").withStatus("bzo"))) - .withPropertyBag( - mapOf("ogtqxepnylbf", "ulapzwyrp", "cib", "ajlyjtlvofqzhv", "uxrkjp", "fmo", "wiivwzjbhyzsx", "dwxf")) - .withDynamicErrorMessage("kambtrnegvmnvuqe"); - model = BinaryData.fromObject(model).toObject(AzureStorageJobExtendedInfo.class); - Assertions.assertEquals("cjdx", model.tasksList().get(0).taskId()); - Assertions.assertEquals("bzo", model.tasksList().get(0).status()); - Assertions.assertEquals("ulapzwyrp", model.propertyBag().get("ogtqxepnylbf")); - Assertions.assertEquals("kambtrnegvmnvuqe", model.dynamicErrorMessage()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageJobTaskDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageJobTaskDetailsTests.java deleted file mode 100644 index 33b68c7a1d5e8..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageJobTaskDetailsTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageJobTaskDetails; -import org.junit.jupiter.api.Assertions; - -public final class AzureStorageJobTaskDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureStorageJobTaskDetails model = BinaryData.fromString("{\"taskId\":\"lds\",\"status\":\"stjbkkdmfl\"}") - .toObject(AzureStorageJobTaskDetails.class); - Assertions.assertEquals("lds", model.taskId()); - Assertions.assertEquals("stjbkkdmfl", model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureStorageJobTaskDetails model = new AzureStorageJobTaskDetails().withTaskId("lds").withStatus("stjbkkdmfl"); - model = BinaryData.fromObject(model).toObject(AzureStorageJobTaskDetails.class); - Assertions.assertEquals("lds", model.taskId()); - Assertions.assertEquals("stjbkkdmfl", model.status()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageProtectableContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageProtectableContainerTests.java deleted file mode 100644 index 46b9bdcb9eb41..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureStorageProtectableContainerTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureStorageProtectableContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import org.junit.jupiter.api.Assertions; - -public final class AzureStorageProtectableContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureStorageProtectableContainer model = BinaryData.fromString( - "{\"protectableContainerType\":\"StorageContainer\",\"friendlyName\":\"yqwcabvnuil\",\"backupManagementType\":\"DefaultBackup\",\"healthStatus\":\"swlpaugmrmfj\",\"containerId\":\"xwtoaukhfkvc\"}") - .toObject(AzureStorageProtectableContainer.class); - Assertions.assertEquals("yqwcabvnuil", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("swlpaugmrmfj", model.healthStatus()); - Assertions.assertEquals("xwtoaukhfkvc", model.containerId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureStorageProtectableContainer model = new AzureStorageProtectableContainer().withFriendlyName("yqwcabvnuil") - .withBackupManagementType(BackupManagementType.DEFAULT_BACKUP) - .withHealthStatus("swlpaugmrmfj") - .withContainerId("xwtoaukhfkvc"); - model = BinaryData.fromObject(model).toObject(AzureStorageProtectableContainer.class); - Assertions.assertEquals("yqwcabvnuil", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("swlpaugmrmfj", model.healthStatus()); - Assertions.assertEquals("xwtoaukhfkvc", model.containerId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMAppContainerProtectableContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMAppContainerProtectableContainerTests.java deleted file mode 100644 index e3f2e829ffa36..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMAppContainerProtectableContainerTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVMAppContainerProtectableContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import org.junit.jupiter.api.Assertions; - -public final class AzureVMAppContainerProtectableContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVMAppContainerProtectableContainer model = BinaryData.fromString( - "{\"protectableContainerType\":\"VMAppContainer\",\"friendlyName\":\"izmoaeds\",\"backupManagementType\":\"MAB\",\"healthStatus\":\"ive\",\"containerId\":\"cgyee\"}") - .toObject(AzureVMAppContainerProtectableContainer.class); - Assertions.assertEquals("izmoaeds", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("ive", model.healthStatus()); - Assertions.assertEquals("cgyee", model.containerId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVMAppContainerProtectableContainer model - = new AzureVMAppContainerProtectableContainer().withFriendlyName("izmoaeds") - .withBackupManagementType(BackupManagementType.MAB) - .withHealthStatus("ive") - .withContainerId("cgyee"); - model = BinaryData.fromObject(model).toObject(AzureVMAppContainerProtectableContainer.class); - Assertions.assertEquals("izmoaeds", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("ive", model.healthStatus()); - Assertions.assertEquals("cgyee", model.containerId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMResourceFeatureSupportRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMResourceFeatureSupportRequestTests.java deleted file mode 100644 index dd183352dd334..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMResourceFeatureSupportRequestTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVMResourceFeatureSupportRequest; -import org.junit.jupiter.api.Assertions; - -public final class AzureVMResourceFeatureSupportRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVMResourceFeatureSupportRequest model = BinaryData.fromString( - "{\"featureType\":\"AzureVMResourceBackup\",\"vmSize\":\"qqtlffhzbkrkj\",\"vmSku\":\"avfqnvhnqoewdogi\"}") - .toObject(AzureVMResourceFeatureSupportRequest.class); - Assertions.assertEquals("qqtlffhzbkrkj", model.vmSize()); - Assertions.assertEquals("avfqnvhnqoewdogi", model.vmSku()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVMResourceFeatureSupportRequest model - = new AzureVMResourceFeatureSupportRequest().withVmSize("qqtlffhzbkrkj").withVmSku("avfqnvhnqoewdogi"); - model = BinaryData.fromObject(model).toObject(AzureVMResourceFeatureSupportRequest.class); - Assertions.assertEquals("qqtlffhzbkrkj", model.vmSize()); - Assertions.assertEquals("avfqnvhnqoewdogi", model.vmSku()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMResourceFeatureSupportResponseInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMResourceFeatureSupportResponseInnerTests.java deleted file mode 100644 index ed590ec67ccb3..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVMResourceFeatureSupportResponseInnerTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.AzureVMResourceFeatureSupportResponseInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.SupportStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureVMResourceFeatureSupportResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVMResourceFeatureSupportResponseInner model = BinaryData.fromString("{\"supportStatus\":\"DefaultOFF\"}") - .toObject(AzureVMResourceFeatureSupportResponseInner.class); - Assertions.assertEquals(SupportStatus.DEFAULT_OFF, model.supportStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVMResourceFeatureSupportResponseInner model - = new AzureVMResourceFeatureSupportResponseInner().withSupportStatus(SupportStatus.DEFAULT_OFF); - model = BinaryData.fromObject(model).toObject(AzureVMResourceFeatureSupportResponseInner.class); - Assertions.assertEquals(SupportStatus.DEFAULT_OFF, model.supportStatus()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadItemTests.java deleted file mode 100644 index 22b00475351ca..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadItemTests.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"AzureVmWorkloadItem\",\"parentName\":\"hvn\",\"serverName\":\"gnxkympqan\",\"isAutoProtectable\":false,\"subinquireditemcount\":777524300,\"subWorkloadItemCount\":494382455,\"backupManagementType\":\"bta\",\"workloadType\":\"pnyghs\",\"friendlyName\":\"cyl\",\"protectionState\":\"Protected\"}") - .toObject(AzureVmWorkloadItem.class); - Assertions.assertEquals("bta", model.backupManagementType()); - Assertions.assertEquals("pnyghs", model.workloadType()); - Assertions.assertEquals("cyl", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("hvn", model.parentName()); - Assertions.assertEquals("gnxkympqan", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(777524300, model.subinquireditemcount()); - Assertions.assertEquals(494382455, model.subWorkloadItemCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadItem model = new AzureVmWorkloadItem().withBackupManagementType("bta") - .withWorkloadType("pnyghs") - .withFriendlyName("cyl") - .withProtectionState(ProtectionStatus.PROTECTED) - .withParentName("hvn") - .withServerName("gnxkympqan") - .withIsAutoProtectable(false) - .withSubinquireditemcount(777524300) - .withSubWorkloadItemCount(494382455); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadItem.class); - Assertions.assertEquals("bta", model.backupManagementType()); - Assertions.assertEquals("pnyghs", model.workloadType()); - Assertions.assertEquals("cyl", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("hvn", model.parentName()); - Assertions.assertEquals("gnxkympqan", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(777524300, model.subinquireditemcount()); - Assertions.assertEquals(494382455, model.subWorkloadItemCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadProtectedItemExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadProtectedItemExtendedInfoTests.java deleted file mode 100644 index b8b1cbd0e97eb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadProtectedItemExtendedInfoTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadProtectedItemExtendedInfo; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadProtectedItemExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadProtectedItemExtendedInfo model = BinaryData.fromString( - "{\"oldestRecoveryPoint\":\"2021-01-23T08:33:04Z\",\"oldestRecoveryPointInVault\":\"2021-06-18T06:48:52Z\",\"oldestRecoveryPointInArchive\":\"2021-11-13T22:42:49Z\",\"newestRecoveryPointInArchive\":\"2021-02-08T17:34:52Z\",\"recoveryPointCount\":1076182839,\"policyState\":\"ev\",\"recoveryModel\":\"epr\"}") - .toObject(AzureVmWorkloadProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-23T08:33:04Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-18T06:48:52Z"), model.oldestRecoveryPointInVault()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T22:42:49Z"), model.oldestRecoveryPointInArchive()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T17:34:52Z"), model.newestRecoveryPointInArchive()); - Assertions.assertEquals(1076182839, model.recoveryPointCount()); - Assertions.assertEquals("ev", model.policyState()); - Assertions.assertEquals("epr", model.recoveryModel()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadProtectedItemExtendedInfo model = new AzureVmWorkloadProtectedItemExtendedInfo() - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-01-23T08:33:04Z")) - .withOldestRecoveryPointInVault(OffsetDateTime.parse("2021-06-18T06:48:52Z")) - .withOldestRecoveryPointInArchive(OffsetDateTime.parse("2021-11-13T22:42:49Z")) - .withNewestRecoveryPointInArchive(OffsetDateTime.parse("2021-02-08T17:34:52Z")) - .withRecoveryPointCount(1076182839) - .withPolicyState("ev") - .withRecoveryModel("epr"); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-23T08:33:04Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-18T06:48:52Z"), model.oldestRecoveryPointInVault()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T22:42:49Z"), model.oldestRecoveryPointInArchive()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T17:34:52Z"), model.newestRecoveryPointInArchive()); - Assertions.assertEquals(1076182839, model.recoveryPointCount()); - Assertions.assertEquals("ev", model.policyState()); - Assertions.assertEquals("epr", model.recoveryModel()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadProtectionPolicyTests.java deleted file mode 100644 index d330aa9932159..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadProtectionPolicyTests.java +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.PolicyType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.Settings; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotBackupAdditionalDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.SubProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadProtectionPolicy model = BinaryData.fromString( - "{\"backupManagementType\":\"AzureWorkload\",\"workLoadType\":\"Client\",\"settings\":{\"timeZone\":\"zdgiruj\",\"issqlcompression\":true,\"isCompression\":true},\"subProtectionPolicy\":[{\"policyType\":\"SnapshotFull\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"tieringPolicy\":{\"jviylwdshfs\":{\"tieringMode\":\"TierAfter\",\"duration\":1569127875,\"durationType\":\"Days\"}},\"snapshotBackupAdditionalDetails\":{\"instantRpRetentionRangeInDays\":1046699767,\"instantRPDetails\":\"ye\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"msgaoj\",\"identityName\":\"wncot\",\"userAssignedIdentityProperties\":{\"clientId\":\"hirctymoxoftpipi\",\"principalId\":\"czuhxacpqjlihh\"}}}},{\"policyType\":\"SnapshotCopyOnlyFull\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"tieringPolicy\":{\"wdgzxulucv\":{\"tieringMode\":\"TierAfter\",\"duration\":2119274239,\"durationType\":\"Invalid\"},\"uzvx\":{\"tieringMode\":\"DoNotTier\",\"duration\":1595182067,\"durationType\":\"Months\"}},\"snapshotBackupAdditionalDetails\":{\"instantRpRetentionRangeInDays\":1209025236,\"instantRPDetails\":\"nhn\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"ifqjz\",\"identityName\":\"mrhublwpc\",\"userAssignedIdentityProperties\":{\"clientId\":\"trgjupauutpwoqh\",\"principalId\":\"ejqgw\"}}}},{\"policyType\":\"Full\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"tieringPolicy\":{\"vfoimwksli\":{\"tieringMode\":\"TierAfter\",\"duration\":315596091,\"durationType\":\"Invalid\"},\"ydfce\":{\"tieringMode\":\"Invalid\",\"duration\":772864922,\"durationType\":\"Years\"},\"gdyftumrtwna\":{\"tieringMode\":\"Invalid\",\"duration\":751635247,\"durationType\":\"Years\"}},\"snapshotBackupAdditionalDetails\":{\"instantRpRetentionRangeInDays\":825702732,\"instantRPDetails\":\"iw\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"gcyztsfmznbae\",\"identityName\":\"hchqnrnrpx\",\"userAssignedIdentityProperties\":{\"clientId\":\"wrykqgai\",\"principalId\":\"viklb\"}}}},{\"policyType\":\"CopyOnlyFull\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"tieringPolicy\":{\"vdsrhnjiv\":{\"tieringMode\":\"Invalid\",\"duration\":1504091159,\"durationType\":\"Days\"}},\"snapshotBackupAdditionalDetails\":{\"instantRpRetentionRangeInDays\":2016874931,\"instantRPDetails\":\"ovqfzge\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"ftul\",\"identityName\":\"tduceamt\",\"userAssignedIdentityProperties\":{\"clientId\":\"u\",\"principalId\":\"ejwcwwqiok\"}}}}],\"makePolicyConsistent\":false,\"protectedItemsCount\":1563475651,\"resourceGuardOperationRequests\":[\"msvpkjpr\",\"kwcf\"]}") - .toObject(AzureVmWorkloadProtectionPolicy.class); - Assertions.assertEquals(1563475651, model.protectedItemsCount()); - Assertions.assertEquals("msvpkjpr", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(WorkloadType.CLIENT, model.workLoadType()); - Assertions.assertEquals("zdgiruj", model.settings().timeZone()); - Assertions.assertEquals(true, model.settings().issqlcompression()); - Assertions.assertEquals(true, model.settings().isCompression()); - Assertions.assertEquals(PolicyType.SNAPSHOT_FULL, model.subProtectionPolicy().get(0).policyType()); - Assertions.assertEquals(TieringMode.TIER_AFTER, - model.subProtectionPolicy().get(0).tieringPolicy().get("jviylwdshfs").tieringMode()); - Assertions.assertEquals(1569127875, - model.subProtectionPolicy().get(0).tieringPolicy().get("jviylwdshfs").duration()); - Assertions.assertEquals(RetentionDurationType.DAYS, - model.subProtectionPolicy().get(0).tieringPolicy().get("jviylwdshfs").durationType()); - Assertions.assertEquals(1046699767, - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRpRetentionRangeInDays()); - Assertions.assertEquals("ye", - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRPDetails()); - Assertions.assertEquals("msgaoj", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityArmId()); - Assertions.assertEquals("wncot", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityName()); - Assertions.assertEquals("hirctymoxoftpipi", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .clientId()); - Assertions.assertEquals("czuhxacpqjlihh", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .principalId()); - Assertions.assertEquals(false, model.makePolicyConsistent()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadProtectionPolicy model - = new AzureVmWorkloadProtectionPolicy().withProtectedItemsCount(1563475651) - .withResourceGuardOperationRequests(Arrays.asList("msvpkjpr", "kwcf")) - .withWorkLoadType(WorkloadType.CLIENT) - .withSettings(new Settings().withTimeZone("zdgiruj").withIssqlcompression(true).withIsCompression(true)) - .withSubProtectionPolicy( - Arrays - .asList( - new SubProtectionPolicy().withPolicyType(PolicyType.SNAPSHOT_FULL) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withTieringPolicy(mapOf("jviylwdshfs", - new TieringPolicy().withTieringMode(TieringMode.TIER_AFTER) - .withDuration(1569127875) - .withDurationType(RetentionDurationType.DAYS))) - .withSnapshotBackupAdditionalDetails( - new SnapshotBackupAdditionalDetails().withInstantRpRetentionRangeInDays(1046699767) - .withInstantRPDetails("ye") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("msgaoj") - .withIdentityName("wncot") - .withUserAssignedIdentityProperties(new UserAssignedIdentityProperties() - .withClientId("hirctymoxoftpipi") - .withPrincipalId("czuhxacpqjlihh")))), - new SubProtectionPolicy().withPolicyType(PolicyType.SNAPSHOT_COPY_ONLY_FULL) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withTieringPolicy(mapOf("wdgzxulucv", - new TieringPolicy().withTieringMode(TieringMode.TIER_AFTER) - .withDuration(2119274239) - .withDurationType(RetentionDurationType.INVALID), - "uzvx", - new TieringPolicy().withTieringMode(TieringMode.DO_NOT_TIER) - .withDuration(1595182067) - .withDurationType(RetentionDurationType.MONTHS))) - .withSnapshotBackupAdditionalDetails( - new SnapshotBackupAdditionalDetails().withInstantRpRetentionRangeInDays(1209025236) - .withInstantRPDetails("nhn") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("ifqjz") - .withIdentityName("mrhublwpc") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("trgjupauutpwoqh") - .withPrincipalId("ejqgw")))), - new SubProtectionPolicy().withPolicyType(PolicyType.FULL) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withTieringPolicy(mapOf("vfoimwksli", - new TieringPolicy().withTieringMode(TieringMode.TIER_AFTER) - .withDuration(315596091) - .withDurationType(RetentionDurationType.INVALID), - "ydfce", - new TieringPolicy().withTieringMode(TieringMode.INVALID) - .withDuration(772864922) - .withDurationType(RetentionDurationType.YEARS), - "gdyftumrtwna", - new TieringPolicy().withTieringMode(TieringMode.INVALID) - .withDuration(751635247) - .withDurationType(RetentionDurationType.YEARS))) - .withSnapshotBackupAdditionalDetails(new SnapshotBackupAdditionalDetails() - .withInstantRpRetentionRangeInDays(825702732) - .withInstantRPDetails("iw") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("gcyztsfmznbae") - .withIdentityName("hchqnrnrpx") - .withUserAssignedIdentityProperties(new UserAssignedIdentityProperties() - .withClientId("wrykqgai") - .withPrincipalId("viklb")))), - new SubProtectionPolicy().withPolicyType(PolicyType.COPY_ONLY_FULL) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withTieringPolicy(mapOf("vdsrhnjiv", - new TieringPolicy().withTieringMode(TieringMode.INVALID) - .withDuration(1504091159) - .withDurationType(RetentionDurationType.DAYS))) - .withSnapshotBackupAdditionalDetails( - new SnapshotBackupAdditionalDetails().withInstantRpRetentionRangeInDays(2016874931) - .withInstantRPDetails("ovqfzge") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("ftul") - .withIdentityName("tduceamt") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("u") - .withPrincipalId("ejwcwwqiok")))))) - .withMakePolicyConsistent(false); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadProtectionPolicy.class); - Assertions.assertEquals(1563475651, model.protectedItemsCount()); - Assertions.assertEquals("msvpkjpr", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(WorkloadType.CLIENT, model.workLoadType()); - Assertions.assertEquals("zdgiruj", model.settings().timeZone()); - Assertions.assertEquals(true, model.settings().issqlcompression()); - Assertions.assertEquals(true, model.settings().isCompression()); - Assertions.assertEquals(PolicyType.SNAPSHOT_FULL, model.subProtectionPolicy().get(0).policyType()); - Assertions.assertEquals(TieringMode.TIER_AFTER, - model.subProtectionPolicy().get(0).tieringPolicy().get("jviylwdshfs").tieringMode()); - Assertions.assertEquals(1569127875, - model.subProtectionPolicy().get(0).tieringPolicy().get("jviylwdshfs").duration()); - Assertions.assertEquals(RetentionDurationType.DAYS, - model.subProtectionPolicy().get(0).tieringPolicy().get("jviylwdshfs").durationType()); - Assertions.assertEquals(1046699767, - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRpRetentionRangeInDays()); - Assertions.assertEquals("ye", - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRPDetails()); - Assertions.assertEquals("msgaoj", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityArmId()); - Assertions.assertEquals("wncot", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityName()); - Assertions.assertEquals("hirctymoxoftpipi", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .clientId()); - Assertions.assertEquals("czuhxacpqjlihh", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .principalId()); - Assertions.assertEquals(false, model.makePolicyConsistent()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapAseDatabaseWorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapAseDatabaseWorkloadItemTests.java deleted file mode 100644 index c6d5d57da49e4..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapAseDatabaseWorkloadItemTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapAseDatabaseWorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadSapAseDatabaseWorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadSapAseDatabaseWorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"SAPAseDatabase\",\"parentName\":\"obkdqzrdzsyl\",\"serverName\":\"lgtrczzy\",\"isAutoProtectable\":false,\"subinquireditemcount\":367147351,\"subWorkloadItemCount\":1633572921,\"backupManagementType\":\"vuaurk\",\"workloadType\":\"ci\",\"friendlyName\":\"defxrdc\",\"protectionState\":\"Invalid\"}") - .toObject(AzureVmWorkloadSapAseDatabaseWorkloadItem.class); - Assertions.assertEquals("vuaurk", model.backupManagementType()); - Assertions.assertEquals("ci", model.workloadType()); - Assertions.assertEquals("defxrdc", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.INVALID, model.protectionState()); - Assertions.assertEquals("obkdqzrdzsyl", model.parentName()); - Assertions.assertEquals("lgtrczzy", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(367147351, model.subinquireditemcount()); - Assertions.assertEquals(1633572921, model.subWorkloadItemCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadSapAseDatabaseWorkloadItem model - = new AzureVmWorkloadSapAseDatabaseWorkloadItem().withBackupManagementType("vuaurk") - .withWorkloadType("ci") - .withFriendlyName("defxrdc") - .withProtectionState(ProtectionStatus.INVALID) - .withParentName("obkdqzrdzsyl") - .withServerName("lgtrczzy") - .withIsAutoProtectable(false) - .withSubinquireditemcount(367147351) - .withSubWorkloadItemCount(1633572921); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadSapAseDatabaseWorkloadItem.class); - Assertions.assertEquals("vuaurk", model.backupManagementType()); - Assertions.assertEquals("ci", model.workloadType()); - Assertions.assertEquals("defxrdc", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.INVALID, model.protectionState()); - Assertions.assertEquals("obkdqzrdzsyl", model.parentName()); - Assertions.assertEquals("lgtrczzy", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(367147351, model.subinquireditemcount()); - Assertions.assertEquals(1633572921, model.subWorkloadItemCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapAseSystemWorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapAseSystemWorkloadItemTests.java deleted file mode 100644 index 91d2e4a13b574..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapAseSystemWorkloadItemTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapAseSystemWorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadSapAseSystemWorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadSapAseSystemWorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"SAPAseSystem\",\"parentName\":\"xrblmliowxihs\",\"serverName\":\"xwqagnepzw\",\"isAutoProtectable\":false,\"subinquireditemcount\":2052489280,\"subWorkloadItemCount\":716318057,\"backupManagementType\":\"qqagwwr\",\"workloadType\":\"omzisglrrcz\",\"friendlyName\":\"k\",\"protectionState\":\"Protecting\"}") - .toObject(AzureVmWorkloadSapAseSystemWorkloadItem.class); - Assertions.assertEquals("qqagwwr", model.backupManagementType()); - Assertions.assertEquals("omzisglrrcz", model.workloadType()); - Assertions.assertEquals("k", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState()); - Assertions.assertEquals("xrblmliowxihs", model.parentName()); - Assertions.assertEquals("xwqagnepzw", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(2052489280, model.subinquireditemcount()); - Assertions.assertEquals(716318057, model.subWorkloadItemCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadSapAseSystemWorkloadItem model - = new AzureVmWorkloadSapAseSystemWorkloadItem().withBackupManagementType("qqagwwr") - .withWorkloadType("omzisglrrcz") - .withFriendlyName("k") - .withProtectionState(ProtectionStatus.PROTECTING) - .withParentName("xrblmliowxihs") - .withServerName("xwqagnepzw") - .withIsAutoProtectable(false) - .withSubinquireditemcount(2052489280) - .withSubWorkloadItemCount(716318057); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadSapAseSystemWorkloadItem.class); - Assertions.assertEquals("qqagwwr", model.backupManagementType()); - Assertions.assertEquals("omzisglrrcz", model.workloadType()); - Assertions.assertEquals("k", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState()); - Assertions.assertEquals("xrblmliowxihs", model.parentName()); - Assertions.assertEquals("xwqagnepzw", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(2052489280, model.subinquireditemcount()); - Assertions.assertEquals(716318057, model.subWorkloadItemCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapHanaDatabaseWorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapHanaDatabaseWorkloadItemTests.java deleted file mode 100644 index 67219052dba3b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapHanaDatabaseWorkloadItemTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaDatabaseWorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadSapHanaDatabaseWorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadSapHanaDatabaseWorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"SAPHanaDatabase\",\"parentName\":\"qyybxubmdnafcbq\",\"serverName\":\"e\",\"isAutoProtectable\":false,\"subinquireditemcount\":939528719,\"subWorkloadItemCount\":1438564589,\"backupManagementType\":\"igeleohd\",\"workloadType\":\"qvwzkjopwbeonrl\",\"friendlyName\":\"zdqyb\",\"protectionState\":\"NotProtected\"}") - .toObject(AzureVmWorkloadSapHanaDatabaseWorkloadItem.class); - Assertions.assertEquals("igeleohd", model.backupManagementType()); - Assertions.assertEquals("qvwzkjopwbeonrl", model.workloadType()); - Assertions.assertEquals("zdqyb", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("qyybxubmdnafcbq", model.parentName()); - Assertions.assertEquals("e", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(939528719, model.subinquireditemcount()); - Assertions.assertEquals(1438564589, model.subWorkloadItemCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadSapHanaDatabaseWorkloadItem model - = new AzureVmWorkloadSapHanaDatabaseWorkloadItem().withBackupManagementType("igeleohd") - .withWorkloadType("qvwzkjopwbeonrl") - .withFriendlyName("zdqyb") - .withProtectionState(ProtectionStatus.NOT_PROTECTED) - .withParentName("qyybxubmdnafcbq") - .withServerName("e") - .withIsAutoProtectable(false) - .withSubinquireditemcount(939528719) - .withSubWorkloadItemCount(1438564589); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadSapHanaDatabaseWorkloadItem.class); - Assertions.assertEquals("igeleohd", model.backupManagementType()); - Assertions.assertEquals("qvwzkjopwbeonrl", model.workloadType()); - Assertions.assertEquals("zdqyb", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("qyybxubmdnafcbq", model.parentName()); - Assertions.assertEquals("e", model.serverName()); - Assertions.assertEquals(false, model.isAutoProtectable()); - Assertions.assertEquals(939528719, model.subinquireditemcount()); - Assertions.assertEquals(1438564589, model.subWorkloadItemCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapHanaSystemWorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapHanaSystemWorkloadItemTests.java deleted file mode 100644 index 3bb6eb714c1e8..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSapHanaSystemWorkloadItemTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSapHanaSystemWorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadSapHanaSystemWorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadSapHanaSystemWorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"SAPHanaSystem\",\"parentName\":\"qtjzmizvgbg\",\"serverName\":\"zuuvbxngrebw\",\"isAutoProtectable\":true,\"subinquireditemcount\":1794399403,\"subWorkloadItemCount\":80766571,\"backupManagementType\":\"swvajqfu\",\"workloadType\":\"x\",\"friendlyName\":\"qzasunwqrjzfrgqh\",\"protectionState\":\"Protected\"}") - .toObject(AzureVmWorkloadSapHanaSystemWorkloadItem.class); - Assertions.assertEquals("swvajqfu", model.backupManagementType()); - Assertions.assertEquals("x", model.workloadType()); - Assertions.assertEquals("qzasunwqrjzfrgqh", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("qtjzmizvgbg", model.parentName()); - Assertions.assertEquals("zuuvbxngrebw", model.serverName()); - Assertions.assertEquals(true, model.isAutoProtectable()); - Assertions.assertEquals(1794399403, model.subinquireditemcount()); - Assertions.assertEquals(80766571, model.subWorkloadItemCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadSapHanaSystemWorkloadItem model - = new AzureVmWorkloadSapHanaSystemWorkloadItem().withBackupManagementType("swvajqfu") - .withWorkloadType("x") - .withFriendlyName("qzasunwqrjzfrgqh") - .withProtectionState(ProtectionStatus.PROTECTED) - .withParentName("qtjzmizvgbg") - .withServerName("zuuvbxngrebw") - .withIsAutoProtectable(true) - .withSubinquireditemcount(1794399403) - .withSubWorkloadItemCount(80766571); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadSapHanaSystemWorkloadItem.class); - Assertions.assertEquals("swvajqfu", model.backupManagementType()); - Assertions.assertEquals("x", model.workloadType()); - Assertions.assertEquals("qzasunwqrjzfrgqh", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("qtjzmizvgbg", model.parentName()); - Assertions.assertEquals("zuuvbxngrebw", model.serverName()); - Assertions.assertEquals(true, model.isAutoProtectable()); - Assertions.assertEquals(1794399403, model.subinquireditemcount()); - Assertions.assertEquals(80766571, model.subWorkloadItemCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSqlDatabaseWorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSqlDatabaseWorkloadItemTests.java deleted file mode 100644 index 0c53b2a8baaa1..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSqlDatabaseWorkloadItemTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlDatabaseWorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadSqlDatabaseWorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadSqlDatabaseWorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"SQLDataBase\",\"parentName\":\"hi\",\"serverName\":\"gjlgvvpase\",\"isAutoProtectable\":true,\"subinquireditemcount\":1996272230,\"subWorkloadItemCount\":1935598051,\"backupManagementType\":\"tu\",\"workloadType\":\"dhga\",\"friendlyName\":\"pirpiwrqof\",\"protectionState\":\"Protected\"}") - .toObject(AzureVmWorkloadSqlDatabaseWorkloadItem.class); - Assertions.assertEquals("tu", model.backupManagementType()); - Assertions.assertEquals("dhga", model.workloadType()); - Assertions.assertEquals("pirpiwrqof", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("hi", model.parentName()); - Assertions.assertEquals("gjlgvvpase", model.serverName()); - Assertions.assertEquals(true, model.isAutoProtectable()); - Assertions.assertEquals(1996272230, model.subinquireditemcount()); - Assertions.assertEquals(1935598051, model.subWorkloadItemCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadSqlDatabaseWorkloadItem model - = new AzureVmWorkloadSqlDatabaseWorkloadItem().withBackupManagementType("tu") - .withWorkloadType("dhga") - .withFriendlyName("pirpiwrqof") - .withProtectionState(ProtectionStatus.PROTECTED) - .withParentName("hi") - .withServerName("gjlgvvpase") - .withIsAutoProtectable(true) - .withSubinquireditemcount(1996272230) - .withSubWorkloadItemCount(1935598051); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadSqlDatabaseWorkloadItem.class); - Assertions.assertEquals("tu", model.backupManagementType()); - Assertions.assertEquals("dhga", model.workloadType()); - Assertions.assertEquals("pirpiwrqof", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("hi", model.parentName()); - Assertions.assertEquals("gjlgvvpase", model.serverName()); - Assertions.assertEquals(true, model.isAutoProtectable()); - Assertions.assertEquals(1996272230, model.subinquireditemcount()); - Assertions.assertEquals(1935598051, model.subWorkloadItemCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSqlInstanceWorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSqlInstanceWorkloadItemTests.java deleted file mode 100644 index 458beb1d1b8ad..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureVmWorkloadSqlInstanceWorkloadItemTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVmWorkloadSqlInstanceWorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectory; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AzureVmWorkloadSqlInstanceWorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureVmWorkloadSqlInstanceWorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"SQLInstance\",\"dataDirectoryPaths\":[{\"type\":\"Data\",\"path\":\"pcjttbstvjeaqn\",\"logicalName\":\"vvf\"},{\"type\":\"Data\",\"path\":\"lghktuidvrm\",\"logicalName\":\"lpdwwexymzvlazi\"}],\"parentName\":\"hpwvqsgnyyuu\",\"serverName\":\"vensrpm\",\"isAutoProtectable\":true,\"subinquireditemcount\":1699043027,\"subWorkloadItemCount\":1912531836,\"backupManagementType\":\"tlbijpzg\",\"workloadType\":\"srfhf\",\"friendlyName\":\"lmknbnxwcdom\",\"protectionState\":\"NotProtected\"}") - .toObject(AzureVmWorkloadSqlInstanceWorkloadItem.class); - Assertions.assertEquals("tlbijpzg", model.backupManagementType()); - Assertions.assertEquals("srfhf", model.workloadType()); - Assertions.assertEquals("lmknbnxwcdom", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("hpwvqsgnyyuu", model.parentName()); - Assertions.assertEquals("vensrpm", model.serverName()); - Assertions.assertEquals(true, model.isAutoProtectable()); - Assertions.assertEquals(1699043027, model.subinquireditemcount()); - Assertions.assertEquals(1912531836, model.subWorkloadItemCount()); - Assertions.assertEquals(SqlDataDirectoryType.DATA, model.dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("pcjttbstvjeaqn", model.dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("vvf", model.dataDirectoryPaths().get(0).logicalName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureVmWorkloadSqlInstanceWorkloadItem model - = new AzureVmWorkloadSqlInstanceWorkloadItem().withBackupManagementType("tlbijpzg") - .withWorkloadType("srfhf") - .withFriendlyName("lmknbnxwcdom") - .withProtectionState(ProtectionStatus.NOT_PROTECTED) - .withParentName("hpwvqsgnyyuu") - .withServerName("vensrpm") - .withIsAutoProtectable(true) - .withSubinquireditemcount(1699043027) - .withSubWorkloadItemCount(1912531836) - .withDataDirectoryPaths(Arrays.asList( - new SqlDataDirectory().withType(SqlDataDirectoryType.DATA) - .withPath("pcjttbstvjeaqn") - .withLogicalName("vvf"), - new SqlDataDirectory().withType(SqlDataDirectoryType.DATA) - .withPath("lghktuidvrm") - .withLogicalName("lpdwwexymzvlazi"))); - model = BinaryData.fromObject(model).toObject(AzureVmWorkloadSqlInstanceWorkloadItem.class); - Assertions.assertEquals("tlbijpzg", model.backupManagementType()); - Assertions.assertEquals("srfhf", model.workloadType()); - Assertions.assertEquals("lmknbnxwcdom", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.protectionState()); - Assertions.assertEquals("hpwvqsgnyyuu", model.parentName()); - Assertions.assertEquals("vensrpm", model.serverName()); - Assertions.assertEquals(true, model.isAutoProtectable()); - Assertions.assertEquals(1699043027, model.subinquireditemcount()); - Assertions.assertEquals(1912531836, model.subWorkloadItemCount()); - Assertions.assertEquals(SqlDataDirectoryType.DATA, model.dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("pcjttbstvjeaqn", model.dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("vvf", model.dataDirectoryPaths().get(0).logicalName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadAutoProtectionIntentTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadAutoProtectionIntentTests.java deleted file mode 100644 index 8fbe3c8eb9a9e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadAutoProtectionIntentTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadAutoProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadAutoProtectionIntentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadAutoProtectionIntent model = BinaryData.fromString( - "{\"protectionIntentItemType\":\"AzureWorkloadAutoProtectionIntent\",\"backupManagementType\":\"AzureSql\",\"sourceResourceId\":\"bwqroohtuovm\",\"itemId\":\"nur\",\"policyId\":\"umghihpvecmsl\",\"protectionState\":\"Protected\"}") - .toObject(AzureWorkloadAutoProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("bwqroohtuovm", model.sourceResourceId()); - Assertions.assertEquals("nur", model.itemId()); - Assertions.assertEquals("umghihpvecmsl", model.policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadAutoProtectionIntent model - = new AzureWorkloadAutoProtectionIntent().withBackupManagementType(BackupManagementType.AZURE_SQL) - .withSourceResourceId("bwqroohtuovm") - .withItemId("nur") - .withPolicyId("umghihpvecmsl") - .withProtectionState(ProtectionStatus.PROTECTED); - model = BinaryData.fromObject(model).toObject(AzureWorkloadAutoProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("bwqroohtuovm", model.sourceResourceId()); - Assertions.assertEquals("nur", model.itemId()); - Assertions.assertEquals("umghihpvecmsl", model.policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadBackupRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadBackupRequestTests.java deleted file mode 100644 index 720e116025237..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadBackupRequestTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadBackupRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupType; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadBackupRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadBackupRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadBackupRequest\",\"backupType\":\"Invalid\",\"enableCompression\":true,\"recoveryPointExpiryTimeInUTC\":\"2021-08-05T10:26:57Z\"}") - .toObject(AzureWorkloadBackupRequest.class); - Assertions.assertEquals(BackupType.INVALID, model.backupType()); - Assertions.assertEquals(true, model.enableCompression()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-05T10:26:57Z"), model.recoveryPointExpiryTimeInUtc()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadBackupRequest model = new AzureWorkloadBackupRequest().withBackupType(BackupType.INVALID) - .withEnableCompression(true) - .withRecoveryPointExpiryTimeInUtc(OffsetDateTime.parse("2021-08-05T10:26:57Z")); - model = BinaryData.fromObject(model).toObject(AzureWorkloadBackupRequest.class); - Assertions.assertEquals(BackupType.INVALID, model.backupType()); - Assertions.assertEquals(true, model.enableCompression()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-05T10:26:57Z"), model.recoveryPointExpiryTimeInUtc()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadContainerAutoProtectionIntentTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadContainerAutoProtectionIntentTests.java deleted file mode 100644 index 6241055cd1160..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadContainerAutoProtectionIntentTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadContainerAutoProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadContainerAutoProtectionIntentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadContainerAutoProtectionIntent model = BinaryData.fromString( - "{\"protectionIntentItemType\":\"AzureWorkloadContainerAutoProtectionIntent\",\"backupManagementType\":\"DefaultBackup\",\"sourceResourceId\":\"sypvidbztjhqtfb\",\"itemId\":\"nynkbwet\",\"policyId\":\"uhpsprkzyaupia\",\"protectionState\":\"Invalid\"}") - .toObject(AzureWorkloadContainerAutoProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("sypvidbztjhqtfb", model.sourceResourceId()); - Assertions.assertEquals("nynkbwet", model.itemId()); - Assertions.assertEquals("uhpsprkzyaupia", model.policyId()); - Assertions.assertEquals(ProtectionStatus.INVALID, model.protectionState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadContainerAutoProtectionIntent model = new AzureWorkloadContainerAutoProtectionIntent() - .withBackupManagementType(BackupManagementType.DEFAULT_BACKUP) - .withSourceResourceId("sypvidbztjhqtfb") - .withItemId("nynkbwet") - .withPolicyId("uhpsprkzyaupia") - .withProtectionState(ProtectionStatus.INVALID); - model = BinaryData.fromObject(model).toObject(AzureWorkloadContainerAutoProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("sypvidbztjhqtfb", model.sourceResourceId()); - Assertions.assertEquals("nynkbwet", model.itemId()); - Assertions.assertEquals("uhpsprkzyaupia", model.policyId()); - Assertions.assertEquals(ProtectionStatus.INVALID, model.protectionState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadJobExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadJobExtendedInfoTests.java deleted file mode 100644 index e28d9e95ecbd2..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadJobExtendedInfoTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadJobExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadJobTaskDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadJobExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadJobExtendedInfo model = BinaryData.fromString( - "{\"tasksList\":[{\"taskId\":\"aspavehhr\",\"status\":\"bunzozudh\"},{\"taskId\":\"gkmoyxcdyuibhmfd\",\"status\":\"zydvfvf\"},{\"taskId\":\"naeo\",\"status\":\"rvhmgor\"}],\"propertyBag\":{\"faxvxil\":\"kiscvwmzhwpl\",\"nzeyqxtjj\":\"btgn\",\"vodggxdbee\":\"zqlqhyc\"},\"dynamicErrorMessage\":\"ieknl\"}") - .toObject(AzureWorkloadJobExtendedInfo.class); - Assertions.assertEquals("aspavehhr", model.tasksList().get(0).taskId()); - Assertions.assertEquals("bunzozudh", model.tasksList().get(0).status()); - Assertions.assertEquals("kiscvwmzhwpl", model.propertyBag().get("faxvxil")); - Assertions.assertEquals("ieknl", model.dynamicErrorMessage()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadJobExtendedInfo model = new AzureWorkloadJobExtendedInfo() - .withTasksList( - Arrays.asList(new AzureWorkloadJobTaskDetails().withTaskId("aspavehhr").withStatus("bunzozudh"), - new AzureWorkloadJobTaskDetails().withTaskId("gkmoyxcdyuibhmfd").withStatus("zydvfvf"), - new AzureWorkloadJobTaskDetails().withTaskId("naeo").withStatus("rvhmgor"))) - .withPropertyBag(mapOf("faxvxil", "kiscvwmzhwpl", "nzeyqxtjj", "btgn", "vodggxdbee", "zqlqhyc")) - .withDynamicErrorMessage("ieknl"); - model = BinaryData.fromObject(model).toObject(AzureWorkloadJobExtendedInfo.class); - Assertions.assertEquals("aspavehhr", model.tasksList().get(0).taskId()); - Assertions.assertEquals("bunzozudh", model.tasksList().get(0).status()); - Assertions.assertEquals("kiscvwmzhwpl", model.propertyBag().get("faxvxil")); - Assertions.assertEquals("ieknl", model.dynamicErrorMessage()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadJobTaskDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadJobTaskDetailsTests.java deleted file mode 100644 index c710d32664f21..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadJobTaskDetailsTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadJobTaskDetails; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadJobTaskDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadJobTaskDetails model = BinaryData.fromString("{\"taskId\":\"riaa\",\"status\":\"uagydwqfbylyrf\"}") - .toObject(AzureWorkloadJobTaskDetails.class); - Assertions.assertEquals("riaa", model.taskId()); - Assertions.assertEquals("uagydwqfbylyrf", model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadJobTaskDetails model - = new AzureWorkloadJobTaskDetails().withTaskId("riaa").withStatus("uagydwqfbylyrf"); - model = BinaryData.fromObject(model).toObject(AzureWorkloadJobTaskDetails.class); - Assertions.assertEquals("riaa", model.taskId()); - Assertions.assertEquals("uagydwqfbylyrf", model.status()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadPointInTimeRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadPointInTimeRecoveryPointTests.java deleted file mode 100644 index 07635ed98c869..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadPointInTimeRecoveryPointTests.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadPointInTimeRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.PointInTimeRange; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestorePointType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadPointInTimeRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadPointInTimeRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadPointInTimeRecoveryPoint\",\"timeRanges\":[{\"startTime\":\"2021-11-26T11:51:30Z\",\"endTime\":\"2021-05-30T12:34:32Z\"}],\"recoveryPointTimeInUTC\":\"2021-03-03T10:55:47Z\",\"type\":\"Differential\",\"recoveryPointTierDetails\":[{\"type\":\"HardenedRP\",\"status\":\"Valid\",\"extendedInfo\":{\"uxylfsbtkadpy\":\"usfzldmo\",\"tgkbugrjqctojc\":\"own\"}},{\"type\":\"ArchivedRP\",\"status\":\"Invalid\",\"extendedInfo\":{\"plcwkhi\":\"ypefojyqdhcupl\",\"rgnowcjhfgm\":\"ihlhzdsqtzb\",\"wotey\":\"ecactx\"}},{\"type\":\"ArchivedRP\",\"status\":\"Invalid\",\"extendedInfo\":{\"wifzmp\":\"vekqvgqo\",\"cvhrfsp\":\"wyivqikf\",\"kvyklxubyjaffmm\":\"uagrttikteusqc\"}}],\"recoveryPointMoveReadinessInfo\":{\"bgq\":{\"isReadyForMove\":true,\"additionalInfo\":\"u\"},\"metttwgd\":{\"isReadyForMove\":false,\"additionalInfo\":\"a\"},\"i\":{\"isReadyForMove\":true,\"additionalInfo\":\"ihhrmo\"},\"hyrpetogebjoxs\":{\"isReadyForMove\":true,\"additionalInfo\":\"ypxiutcxap\"}},\"recoveryPointProperties\":{\"expiryTime\":\"nhl\",\"ruleName\":\"rqnkkzjcjbtr\",\"isSoftDeleted\":false}}") - .toObject(AzureWorkloadPointInTimeRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-03T10:55:47Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.DIFFERENTIAL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("usfzldmo", - model.recoveryPointTierDetails().get(0).extendedInfo().get("uxylfsbtkadpy")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("bgq").isReadyForMove()); - Assertions.assertEquals("u", model.recoveryPointMoveReadinessInfo().get("bgq").additionalInfo()); - Assertions.assertEquals("nhl", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("rqnkkzjcjbtr", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-26T11:51:30Z"), model.timeRanges().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-30T12:34:32Z"), model.timeRanges().get(0).endTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadPointInTimeRecoveryPoint model - = new AzureWorkloadPointInTimeRecoveryPoint() - .withRecoveryPointTimeInUtc(OffsetDateTime.parse("2021-03-03T10:55:47Z")) - .withType(RestorePointType.DIFFERENTIAL) - .withRecoveryPointTierDetails( - Arrays - .asList( - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.HARDENED_RP) - .withStatus(RecoveryPointTierStatus.VALID) - .withExtendedInfo(mapOf("uxylfsbtkadpy", "usfzldmo", "tgkbugrjqctojc", "own")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.ARCHIVED_RP) - .withStatus(RecoveryPointTierStatus.INVALID) - .withExtendedInfo(mapOf("plcwkhi", "ypefojyqdhcupl", "rgnowcjhfgm", "ihlhzdsqtzb", - "wotey", "ecactx")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.ARCHIVED_RP) - .withStatus(RecoveryPointTierStatus.INVALID) - .withExtendedInfo(mapOf("wifzmp", "vekqvgqo", "cvhrfsp", "wyivqikf", "kvyklxubyjaffmm", - "uagrttikteusqc")))) - .withRecoveryPointMoveReadinessInfo(mapOf("bgq", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("u"), "metttwgd", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("a"), "i", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("ihhrmo"), - "hyrpetogebjoxs", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("ypxiutcxap"))) - .withRecoveryPointProperties(new RecoveryPointProperties().withExpiryTime("nhl") - .withRuleName("rqnkkzjcjbtr") - .withIsSoftDeleted(false)) - .withTimeRanges( - Arrays.asList(new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-11-26T11:51:30Z")) - .withEndTime(OffsetDateTime.parse("2021-05-30T12:34:32Z")))); - model = BinaryData.fromObject(model).toObject(AzureWorkloadPointInTimeRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-03T10:55:47Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.DIFFERENTIAL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("usfzldmo", - model.recoveryPointTierDetails().get(0).extendedInfo().get("uxylfsbtkadpy")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("bgq").isReadyForMove()); - Assertions.assertEquals("u", model.recoveryPointMoveReadinessInfo().get("bgq").additionalInfo()); - Assertions.assertEquals("nhl", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("rqnkkzjcjbtr", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-26T11:51:30Z"), model.timeRanges().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-30T12:34:32Z"), model.timeRanges().get(0).endTime()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadPointInTimeRestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadPointInTimeRestoreRequestTests.java deleted file mode 100644 index 50eee8d852f9e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadPointInTimeRestoreRequestTests.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadPointInTimeRestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadPointInTimeRestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadPointInTimeRestoreRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadPointInTimeRestoreRequest\",\"pointInTime\":\"2021-08-19T01:45:54Z\",\"recoveryType\":\"Invalid\",\"sourceResourceId\":\"neuvyinzqod\",\"propertyBag\":{\"xgsg\":\"gsh\",\"gzdjtxvzf\":\"p\",\"gafcqu\":\"bqvgaqv\",\"nwsdtutnwlduyc\":\"rdve\"},\"targetInfo\":{\"overwriteOption\":\"Overwrite\",\"containerId\":\"rmewipmve\",\"databaseName\":\"xukuqgsj\",\"targetDirectoryForFileRestore\":\"undxgketw\"},\"recoveryMode\":\"SnapshotAttachAndRecover\",\"targetResourceGroupName\":\"jhfjmhvvmuvgpm\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"qsxvmhf\",\"identityName\":\"zjyi\",\"userAssignedIdentityProperties\":{\"clientId\":\"sbhud\",\"principalId\":\"ohyuemslynsq\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":true,\"logPointInTimeForDBRecovery\":\"obrltt\"},\"targetVirtualMachineId\":\"sjnygqdnfwqzdzgt\",\"resourceGuardOperationRequests\":[\"xhnfhqly\",\"ijouwivkxoyzunb\"]}") - .toObject(AzureWorkloadPointInTimeRestoreRequest.class); - Assertions.assertEquals("xhnfhqly", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.INVALID, model.recoveryType()); - Assertions.assertEquals("neuvyinzqod", model.sourceResourceId()); - Assertions.assertEquals("gsh", model.propertyBag().get("xgsg")); - Assertions.assertEquals(OverwriteOptions.OVERWRITE, model.targetInfo().overwriteOption()); - Assertions.assertEquals("rmewipmve", model.targetInfo().containerId()); - Assertions.assertEquals("xukuqgsj", model.targetInfo().databaseName()); - Assertions.assertEquals("undxgketw", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH_AND_RECOVER, model.recoveryMode()); - Assertions.assertEquals("jhfjmhvvmuvgpm", model.targetResourceGroupName()); - Assertions.assertEquals("qsxvmhf", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("zjyi", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("sbhud", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("ohyuemslynsq", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("obrltt", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("sjnygqdnfwqzdzgt", model.targetVirtualMachineId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-19T01:45:54Z"), model.pointInTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadPointInTimeRestoreRequest model = new AzureWorkloadPointInTimeRestoreRequest() - .withResourceGuardOperationRequests(Arrays.asList("xhnfhqly", "ijouwivkxoyzunb")) - .withRecoveryType(RecoveryType.INVALID) - .withSourceResourceId("neuvyinzqod") - .withPropertyBag(mapOf("xgsg", "gsh", "gzdjtxvzf", "p", "gafcqu", "bqvgaqv", "nwsdtutnwlduyc", "rdve")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.OVERWRITE) - .withContainerId("rmewipmve") - .withDatabaseName("xukuqgsj") - .withTargetDirectoryForFileRestore("undxgketw")) - .withRecoveryMode(RecoveryMode.SNAPSHOT_ATTACH_AND_RECOVER) - .withTargetResourceGroupName("jhfjmhvvmuvgpm") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("qsxvmhf") - .withIdentityName("zjyi") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("sbhud").withPrincipalId("ohyuemslynsq"))) - .withSnapshotRestoreParameters( - new SnapshotRestoreParameters().withSkipAttachAndMount(true).withLogPointInTimeForDBRecovery("obrltt")) - .withTargetVirtualMachineId("sjnygqdnfwqzdzgt") - .withPointInTime(OffsetDateTime.parse("2021-08-19T01:45:54Z")); - model = BinaryData.fromObject(model).toObject(AzureWorkloadPointInTimeRestoreRequest.class); - Assertions.assertEquals("xhnfhqly", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.INVALID, model.recoveryType()); - Assertions.assertEquals("neuvyinzqod", model.sourceResourceId()); - Assertions.assertEquals("gsh", model.propertyBag().get("xgsg")); - Assertions.assertEquals(OverwriteOptions.OVERWRITE, model.targetInfo().overwriteOption()); - Assertions.assertEquals("rmewipmve", model.targetInfo().containerId()); - Assertions.assertEquals("xukuqgsj", model.targetInfo().databaseName()); - Assertions.assertEquals("undxgketw", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH_AND_RECOVER, model.recoveryMode()); - Assertions.assertEquals("jhfjmhvvmuvgpm", model.targetResourceGroupName()); - Assertions.assertEquals("qsxvmhf", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("zjyi", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("sbhud", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("ohyuemslynsq", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("obrltt", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("sjnygqdnfwqzdzgt", model.targetVirtualMachineId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-19T01:45:54Z"), model.pointInTime()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadRecoveryPointTests.java deleted file mode 100644 index 53accbbf6e240..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadRecoveryPointTests.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestorePointType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadRecoveryPoint\",\"recoveryPointTimeInUTC\":\"2021-10-20T18:11:07Z\",\"type\":\"Incremental\",\"recoveryPointTierDetails\":[{\"type\":\"HardenedRP\",\"status\":\"Disabled\",\"extendedInfo\":{\"dgfcwqmp\":\"tpkxztmoobklft\"}}],\"recoveryPointMoveReadinessInfo\":{\"ohu\":{\"isReadyForMove\":false,\"additionalInfo\":\"hemjy\"},\"culkbawpfaj\":{\"isReadyForMove\":false,\"additionalInfo\":\"wkozz\"},\"kcdmxzrpoaimln\":{\"isReadyForMove\":true,\"additionalInfo\":\"tlwtjjguktalhsn\"}},\"recoveryPointProperties\":{\"expiryTime\":\"aomylwea\",\"ruleName\":\"lcsethwwnpj\",\"isSoftDeleted\":false}}") - .toObject(AzureWorkloadRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-20T18:11:07Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.INCREMENTAL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.DISABLED, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("tpkxztmoobklft", - model.recoveryPointTierDetails().get(0).extendedInfo().get("dgfcwqmp")); - Assertions.assertEquals(false, model.recoveryPointMoveReadinessInfo().get("ohu").isReadyForMove()); - Assertions.assertEquals("hemjy", model.recoveryPointMoveReadinessInfo().get("ohu").additionalInfo()); - Assertions.assertEquals("aomylwea", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("lcsethwwnpj", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadRecoveryPoint model = new AzureWorkloadRecoveryPoint() - .withRecoveryPointTimeInUtc(OffsetDateTime.parse("2021-10-20T18:11:07Z")) - .withType(RestorePointType.INCREMENTAL) - .withRecoveryPointTierDetails( - Arrays.asList(new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.HARDENED_RP) - .withStatus(RecoveryPointTierStatus.DISABLED) - .withExtendedInfo(mapOf("dgfcwqmp", "tpkxztmoobklft")))) - .withRecoveryPointMoveReadinessInfo( - mapOf("ohu", new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("hemjy"), - "culkbawpfaj", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("wkozz"), - "kcdmxzrpoaimln", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true) - .withAdditionalInfo("tlwtjjguktalhsn"))) - .withRecoveryPointProperties(new RecoveryPointProperties().withExpiryTime("aomylwea") - .withRuleName("lcsethwwnpj") - .withIsSoftDeleted(false)); - model = BinaryData.fromObject(model).toObject(AzureWorkloadRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-20T18:11:07Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.INCREMENTAL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.DISABLED, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("tpkxztmoobklft", - model.recoveryPointTierDetails().get(0).extendedInfo().get("dgfcwqmp")); - Assertions.assertEquals(false, model.recoveryPointMoveReadinessInfo().get("ohu").isReadyForMove()); - Assertions.assertEquals("hemjy", model.recoveryPointMoveReadinessInfo().get("ohu").additionalInfo()); - Assertions.assertEquals("aomylwea", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("lcsethwwnpj", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadRestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadRestoreRequestTests.java deleted file mode 100644 index 5f5f54b505798..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadRestoreRequestTests.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadRestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadRestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadRestoreRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadRestoreRequest\",\"recoveryType\":\"Offline\",\"sourceResourceId\":\"ti\",\"propertyBag\":{\"tso\":\"pwpgclrci\",\"pdnqqskawaoqvmmb\":\"frkenxpmyyefrp\"},\"targetInfo\":{\"overwriteOption\":\"FailOnConflict\",\"containerId\":\"tqlkz\",\"databaseName\":\"gnitgvkxlzyq\",\"targetDirectoryForFileRestore\":\"fegcea\"},\"recoveryMode\":\"SnapshotAttach\",\"targetResourceGroupName\":\"hcans\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"yqhlwigdivbkbx\",\"identityName\":\"mf\",\"userAssignedIdentityProperties\":{\"clientId\":\"wasqvdaeyyg\",\"principalId\":\"akjsqz\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":false,\"logPointInTimeForDBRecovery\":\"kgimsidxasic\"},\"targetVirtualMachineId\":\"yvvjskgfmo\",\"resourceGuardOperationRequests\":[\"hpqgatjeaahhvj\"]}") - .toObject(AzureWorkloadRestoreRequest.class); - Assertions.assertEquals("hpqgatjeaahhvj", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("ti", model.sourceResourceId()); - Assertions.assertEquals("pwpgclrci", model.propertyBag().get("tso")); - Assertions.assertEquals(OverwriteOptions.FAIL_ON_CONFLICT, model.targetInfo().overwriteOption()); - Assertions.assertEquals("tqlkz", model.targetInfo().containerId()); - Assertions.assertEquals("gnitgvkxlzyq", model.targetInfo().databaseName()); - Assertions.assertEquals("fegcea", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH, model.recoveryMode()); - Assertions.assertEquals("hcans", model.targetResourceGroupName()); - Assertions.assertEquals("yqhlwigdivbkbx", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("mf", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("wasqvdaeyyg", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("akjsqz", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("kgimsidxasic", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("yvvjskgfmo", model.targetVirtualMachineId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadRestoreRequest model - = new AzureWorkloadRestoreRequest().withResourceGuardOperationRequests(Arrays.asList("hpqgatjeaahhvj")) - .withRecoveryType(RecoveryType.OFFLINE) - .withSourceResourceId("ti") - .withPropertyBag(mapOf("tso", "pwpgclrci", "pdnqqskawaoqvmmb", "frkenxpmyyefrp")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.FAIL_ON_CONFLICT) - .withContainerId("tqlkz") - .withDatabaseName("gnitgvkxlzyq") - .withTargetDirectoryForFileRestore("fegcea")) - .withRecoveryMode(RecoveryMode.SNAPSHOT_ATTACH) - .withTargetResourceGroupName("hcans") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("yqhlwigdivbkbx") - .withIdentityName("mf") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("wasqvdaeyyg").withPrincipalId("akjsqz"))) - .withSnapshotRestoreParameters(new SnapshotRestoreParameters().withSkipAttachAndMount(false) - .withLogPointInTimeForDBRecovery("kgimsidxasic")) - .withTargetVirtualMachineId("yvvjskgfmo"); - model = BinaryData.fromObject(model).toObject(AzureWorkloadRestoreRequest.class); - Assertions.assertEquals("hpqgatjeaahhvj", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("ti", model.sourceResourceId()); - Assertions.assertEquals("pwpgclrci", model.propertyBag().get("tso")); - Assertions.assertEquals(OverwriteOptions.FAIL_ON_CONFLICT, model.targetInfo().overwriteOption()); - Assertions.assertEquals("tqlkz", model.targetInfo().containerId()); - Assertions.assertEquals("gnitgvkxlzyq", model.targetInfo().databaseName()); - Assertions.assertEquals("fegcea", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH, model.recoveryMode()); - Assertions.assertEquals("hcans", model.targetResourceGroupName()); - Assertions.assertEquals("yqhlwigdivbkbx", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("mf", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("wasqvdaeyyg", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("akjsqz", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("kgimsidxasic", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("yvvjskgfmo", model.targetVirtualMachineId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRecoveryPointTests.java deleted file mode 100644 index e46751eb9c44f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRecoveryPointTests.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaPointInTimeRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.PointInTimeRange; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestorePointType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSapHanaPointInTimeRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSapHanaPointInTimeRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSAPHanaPointInTimeRecoveryPoint\",\"timeRanges\":[{\"startTime\":\"2021-09-21T07:24:07Z\",\"endTime\":\"2021-07-31T03:26:03Z\"},{\"startTime\":\"2021-06-20T08:18:39Z\",\"endTime\":\"2021-07-21T08:09:37Z\"}],\"recoveryPointTimeInUTC\":\"2021-07-16T00:25:09Z\",\"type\":\"SnapshotFull\",\"recoveryPointTierDetails\":[{\"type\":\"InstantRP\",\"status\":\"Disabled\",\"extendedInfo\":{\"ckt\":\"wklnsrmffeyc\",\"kk\":\"iymerteeammxqi\"}}],\"recoveryPointMoveReadinessInfo\":{\"mxvavrefdee\":{\"isReadyForMove\":true,\"additionalInfo\":\"kgdoj\"},\"xtxsuwprtujw\":{\"isReadyForMove\":true,\"additionalInfo\":\"uij\"},\"tzeexav\":{\"isReadyForMove\":false,\"additionalInfo\":\"djibabxvitit\"}},\"recoveryPointProperties\":{\"expiryTime\":\"fglecdmdqbwp\",\"ruleName\":\"q\",\"isSoftDeleted\":false}}") - .toObject(AzureWorkloadSapHanaPointInTimeRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-16T00:25:09Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.SNAPSHOT_FULL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.DISABLED, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("wklnsrmffeyc", model.recoveryPointTierDetails().get(0).extendedInfo().get("ckt")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("mxvavrefdee").isReadyForMove()); - Assertions.assertEquals("kgdoj", model.recoveryPointMoveReadinessInfo().get("mxvavrefdee").additionalInfo()); - Assertions.assertEquals("fglecdmdqbwp", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("q", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-21T07:24:07Z"), model.timeRanges().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T03:26:03Z"), model.timeRanges().get(0).endTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSapHanaPointInTimeRecoveryPoint model = new AzureWorkloadSapHanaPointInTimeRecoveryPoint() - .withRecoveryPointTimeInUtc(OffsetDateTime.parse("2021-07-16T00:25:09Z")) - .withType(RestorePointType.SNAPSHOT_FULL) - .withRecoveryPointTierDetails( - Arrays.asList(new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.INSTANT_RP) - .withStatus(RecoveryPointTierStatus.DISABLED) - .withExtendedInfo(mapOf("ckt", "wklnsrmffeyc", "kk", "iymerteeammxqi")))) - .withRecoveryPointMoveReadinessInfo(mapOf("mxvavrefdee", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("kgdoj"), - "xtxsuwprtujw", new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("uij"), - "tzeexav", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("djibabxvitit"))) - .withRecoveryPointProperties( - new RecoveryPointProperties().withExpiryTime("fglecdmdqbwp").withRuleName("q").withIsSoftDeleted(false)) - .withTimeRanges(Arrays.asList( - new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-09-21T07:24:07Z")) - .withEndTime(OffsetDateTime.parse("2021-07-31T03:26:03Z")), - new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-06-20T08:18:39Z")) - .withEndTime(OffsetDateTime.parse("2021-07-21T08:09:37Z")))); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSapHanaPointInTimeRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-16T00:25:09Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.SNAPSHOT_FULL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.DISABLED, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("wklnsrmffeyc", model.recoveryPointTierDetails().get(0).extendedInfo().get("ckt")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("mxvavrefdee").isReadyForMove()); - Assertions.assertEquals("kgdoj", model.recoveryPointMoveReadinessInfo().get("mxvavrefdee").additionalInfo()); - Assertions.assertEquals("fglecdmdqbwp", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("q", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-21T07:24:07Z"), model.timeRanges().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T03:26:03Z"), model.timeRanges().get(0).endTime()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRestoreRequestTests.java deleted file mode 100644 index 970c749d48f3d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRestoreRequestTests.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaPointInTimeRestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSapHanaPointInTimeRestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSapHanaPointInTimeRestoreRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSAPHanaPointInTimeRestoreRequest\",\"pointInTime\":\"2021-11-12T14:00:05Z\",\"recoveryType\":\"AlternateLocation\",\"sourceResourceId\":\"slhhxudbxv\",\"propertyBag\":{\"ud\":\"tnsi\",\"mes\":\"z\"},\"targetInfo\":{\"overwriteOption\":\"Overwrite\",\"containerId\":\"agzrcxfa\",\"databaseName\":\"cfxwmdbox\",\"targetDirectoryForFileRestore\":\"gsftufqobrjlnacg\"},\"recoveryMode\":\"Invalid\",\"targetResourceGroupName\":\"nhxk\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"ytnrzvuljraae\",\"identityName\":\"nok\",\"userAssignedIdentityProperties\":{\"clientId\":\"kkjqnvbroylaxxu\",\"principalId\":\"disdosfjbjsvgj\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":false,\"logPointInTimeForDBRecovery\":\"vyc\"},\"targetVirtualMachineId\":\"dclxgc\",\"resourceGuardOperationRequests\":[\"fnwmbtmvpdvj\"]}") - .toObject(AzureWorkloadSapHanaPointInTimeRestoreRequest.class); - Assertions.assertEquals("fnwmbtmvpdvj", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.ALTERNATE_LOCATION, model.recoveryType()); - Assertions.assertEquals("slhhxudbxv", model.sourceResourceId()); - Assertions.assertEquals("tnsi", model.propertyBag().get("ud")); - Assertions.assertEquals(OverwriteOptions.OVERWRITE, model.targetInfo().overwriteOption()); - Assertions.assertEquals("agzrcxfa", model.targetInfo().containerId()); - Assertions.assertEquals("cfxwmdbox", model.targetInfo().databaseName()); - Assertions.assertEquals("gsftufqobrjlnacg", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.INVALID, model.recoveryMode()); - Assertions.assertEquals("nhxk", model.targetResourceGroupName()); - Assertions.assertEquals("ytnrzvuljraae", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("nok", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("kkjqnvbroylaxxu", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("disdosfjbjsvgj", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("vyc", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("dclxgc", model.targetVirtualMachineId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-12T14:00:05Z"), model.pointInTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSapHanaPointInTimeRestoreRequest model = new AzureWorkloadSapHanaPointInTimeRestoreRequest() - .withResourceGuardOperationRequests(Arrays.asList("fnwmbtmvpdvj")) - .withRecoveryType(RecoveryType.ALTERNATE_LOCATION) - .withSourceResourceId("slhhxudbxv") - .withPropertyBag(mapOf("ud", "tnsi", "mes", "z")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.OVERWRITE) - .withContainerId("agzrcxfa") - .withDatabaseName("cfxwmdbox") - .withTargetDirectoryForFileRestore("gsftufqobrjlnacg")) - .withRecoveryMode(RecoveryMode.INVALID) - .withTargetResourceGroupName("nhxk") - .withUserAssignedManagedIdentityDetails(new UserAssignedManagedIdentityDetails() - .withIdentityArmId("ytnrzvuljraae") - .withIdentityName("nok") - .withUserAssignedIdentityProperties(new UserAssignedIdentityProperties().withClientId("kkjqnvbroylaxxu") - .withPrincipalId("disdosfjbjsvgj"))) - .withSnapshotRestoreParameters( - new SnapshotRestoreParameters().withSkipAttachAndMount(false).withLogPointInTimeForDBRecovery("vyc")) - .withTargetVirtualMachineId("dclxgc") - .withPointInTime(OffsetDateTime.parse("2021-11-12T14:00:05Z")); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSapHanaPointInTimeRestoreRequest.class); - Assertions.assertEquals("fnwmbtmvpdvj", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.ALTERNATE_LOCATION, model.recoveryType()); - Assertions.assertEquals("slhhxudbxv", model.sourceResourceId()); - Assertions.assertEquals("tnsi", model.propertyBag().get("ud")); - Assertions.assertEquals(OverwriteOptions.OVERWRITE, model.targetInfo().overwriteOption()); - Assertions.assertEquals("agzrcxfa", model.targetInfo().containerId()); - Assertions.assertEquals("cfxwmdbox", model.targetInfo().databaseName()); - Assertions.assertEquals("gsftufqobrjlnacg", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.INVALID, model.recoveryMode()); - Assertions.assertEquals("nhxk", model.targetResourceGroupName()); - Assertions.assertEquals("ytnrzvuljraae", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("nok", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("kkjqnvbroylaxxu", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("disdosfjbjsvgj", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("vyc", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("dclxgc", model.targetVirtualMachineId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-12T14:00:05Z"), model.pointInTime()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequestTests.java deleted file mode 100644 index 7ab2aa7cdddc7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequestTests.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointRehydrationInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriority; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest\",\"recoveryPointRehydrationInfo\":{\"rehydrationRetentionDuration\":\"napfdqwowftpt\",\"rehydrationPriority\":\"High\"},\"pointInTime\":\"2021-03-06T05:03:07Z\",\"recoveryType\":\"Offline\",\"sourceResourceId\":\"h\",\"propertyBag\":{\"hvyeldotj\":\"qyhleseyq\"},\"targetInfo\":{\"overwriteOption\":\"FailOnConflict\",\"containerId\":\"swskuk\",\"databaseName\":\"asbvw\",\"targetDirectoryForFileRestore\":\"pkxkdtxfk\"},\"recoveryMode\":\"SnapshotAttach\",\"targetResourceGroupName\":\"vtwknvgmmbugt\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"tmqa\",\"identityName\":\"ueatgroe\",\"userAssignedIdentityProperties\":{\"clientId\":\"ygzc\",\"principalId\":\"fqxkfaoyteh\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":true,\"logPointInTimeForDBRecovery\":\"mvqmtdwckygroej\"},\"targetVirtualMachineId\":\"dljdjuskb\",\"resourceGuardOperationRequests\":[\"qyn\"]}") - .toObject(AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.class); - Assertions.assertEquals("qyn", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("h", model.sourceResourceId()); - Assertions.assertEquals("qyhleseyq", model.propertyBag().get("hvyeldotj")); - Assertions.assertEquals(OverwriteOptions.FAIL_ON_CONFLICT, model.targetInfo().overwriteOption()); - Assertions.assertEquals("swskuk", model.targetInfo().containerId()); - Assertions.assertEquals("asbvw", model.targetInfo().databaseName()); - Assertions.assertEquals("pkxkdtxfk", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH, model.recoveryMode()); - Assertions.assertEquals("vtwknvgmmbugt", model.targetResourceGroupName()); - Assertions.assertEquals("tmqa", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("ueatgroe", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("ygzc", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("fqxkfaoyteh", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("mvqmtdwckygroej", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("dljdjuskb", model.targetVirtualMachineId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T05:03:07Z"), model.pointInTime()); - Assertions.assertEquals("napfdqwowftpt", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest model - = new AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest() - .withResourceGuardOperationRequests(Arrays.asList("qyn")) - .withRecoveryType(RecoveryType.OFFLINE) - .withSourceResourceId("h") - .withPropertyBag(mapOf("hvyeldotj", "qyhleseyq")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.FAIL_ON_CONFLICT) - .withContainerId("swskuk") - .withDatabaseName("asbvw") - .withTargetDirectoryForFileRestore("pkxkdtxfk")) - .withRecoveryMode(RecoveryMode.SNAPSHOT_ATTACH) - .withTargetResourceGroupName("vtwknvgmmbugt") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("tmqa") - .withIdentityName("ueatgroe") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("ygzc").withPrincipalId("fqxkfaoyteh"))) - .withSnapshotRestoreParameters(new SnapshotRestoreParameters().withSkipAttachAndMount(true) - .withLogPointInTimeForDBRecovery("mvqmtdwckygroej")) - .withTargetVirtualMachineId("dljdjuskb") - .withPointInTime(OffsetDateTime.parse("2021-03-06T05:03:07Z")) - .withRecoveryPointRehydrationInfo( - new RecoveryPointRehydrationInfo().withRehydrationRetentionDuration("napfdqwowftpt") - .withRehydrationPriority(RehydrationPriority.HIGH)); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest.class); - Assertions.assertEquals("qyn", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("h", model.sourceResourceId()); - Assertions.assertEquals("qyhleseyq", model.propertyBag().get("hvyeldotj")); - Assertions.assertEquals(OverwriteOptions.FAIL_ON_CONFLICT, model.targetInfo().overwriteOption()); - Assertions.assertEquals("swskuk", model.targetInfo().containerId()); - Assertions.assertEquals("asbvw", model.targetInfo().databaseName()); - Assertions.assertEquals("pkxkdtxfk", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH, model.recoveryMode()); - Assertions.assertEquals("vtwknvgmmbugt", model.targetResourceGroupName()); - Assertions.assertEquals("tmqa", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("ueatgroe", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("ygzc", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("fqxkfaoyteh", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("mvqmtdwckygroej", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("dljdjuskb", model.targetVirtualMachineId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T05:03:07Z"), model.pointInTime()); - Assertions.assertEquals("napfdqwowftpt", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRecoveryPointTests.java deleted file mode 100644 index 8cf5c3d1852f0..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRecoveryPointTests.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestorePointType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSapHanaRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSapHanaRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSAPHanaRecoveryPoint\",\"recoveryPointTimeInUTC\":\"2021-07-20T01:16:34Z\",\"type\":\"SnapshotFull\",\"recoveryPointTierDetails\":[{\"type\":\"HardenedRP\",\"status\":\"Valid\",\"extendedInfo\":{\"jscjpahl\":\"wtzolbaemwmdxmeb\",\"yijddtvqcttad\":\"veabfqxnmwmqtib\"}},{\"type\":\"InstantRP\",\"status\":\"Rehydrated\",\"extendedInfo\":{\"pndzaapmudqmeq\":\"rsiee\",\"wyxebeybpmzz\":\"igpibud\"}},{\"type\":\"InstantRP\",\"status\":\"Rehydrated\",\"extendedInfo\":{\"eufuqyrxpdlcgql\":\"qitmhheioqaqhv\"}}],\"recoveryPointMoveReadinessInfo\":{\"ivfcdisyirnx\":{\"isReadyForMove\":true,\"additionalInfo\":\"frddgamquhiosrsj\"},\"wrevkhgnlnzon\":{\"isReadyForMove\":true,\"additionalInfo\":\"exrxzbujrtrhq\"},\"yw\":{\"isReadyForMove\":true,\"additionalInfo\":\"i\"}},\"recoveryPointProperties\":{\"expiryTime\":\"jtszcof\",\"ruleName\":\"e\",\"isSoftDeleted\":true}}") - .toObject(AzureWorkloadSapHanaRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-20T01:16:34Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.SNAPSHOT_FULL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("wtzolbaemwmdxmeb", - model.recoveryPointTierDetails().get(0).extendedInfo().get("jscjpahl")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("ivfcdisyirnx").isReadyForMove()); - Assertions.assertEquals("frddgamquhiosrsj", - model.recoveryPointMoveReadinessInfo().get("ivfcdisyirnx").additionalInfo()); - Assertions.assertEquals("jtszcof", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("e", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSapHanaRecoveryPoint model - = new AzureWorkloadSapHanaRecoveryPoint() - .withRecoveryPointTimeInUtc(OffsetDateTime.parse("2021-07-20T01:16:34Z")) - .withType(RestorePointType.SNAPSHOT_FULL) - .withRecoveryPointTierDetails(Arrays.asList( - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.HARDENED_RP) - .withStatus(RecoveryPointTierStatus.VALID) - .withExtendedInfo(mapOf("jscjpahl", "wtzolbaemwmdxmeb", "yijddtvqcttad", "veabfqxnmwmqtib")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.INSTANT_RP) - .withStatus(RecoveryPointTierStatus.REHYDRATED) - .withExtendedInfo(mapOf("pndzaapmudqmeq", "rsiee", "wyxebeybpmzz", "igpibud")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.INSTANT_RP) - .withStatus(RecoveryPointTierStatus.REHYDRATED) - .withExtendedInfo(mapOf("eufuqyrxpdlcgql", "qitmhheioqaqhv")))) - .withRecoveryPointMoveReadinessInfo(mapOf("ivfcdisyirnx", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true) - .withAdditionalInfo("frddgamquhiosrsj"), - "wrevkhgnlnzon", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("exrxzbujrtrhq"), - "yw", new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("i"))) - .withRecoveryPointProperties( - new RecoveryPointProperties().withExpiryTime("jtszcof").withRuleName("e").withIsSoftDeleted(true)); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSapHanaRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-20T01:16:34Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.SNAPSHOT_FULL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("wtzolbaemwmdxmeb", - model.recoveryPointTierDetails().get(0).extendedInfo().get("jscjpahl")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("ivfcdisyirnx").isReadyForMove()); - Assertions.assertEquals("frddgamquhiosrsj", - model.recoveryPointMoveReadinessInfo().get("ivfcdisyirnx").additionalInfo()); - Assertions.assertEquals("jtszcof", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("e", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRestoreRequestTests.java deleted file mode 100644 index 37e858fd696cc..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRestoreRequestTests.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaRestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSapHanaRestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSapHanaRestoreRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSAPHanaRestoreRequest\",\"recoveryType\":\"Offline\",\"sourceResourceId\":\"zaefedxihc\",\"propertyBag\":{\"crjdqnsdfzpbgtg\":\"hk\",\"utlwxezwzhok\":\"ylkdghrje\",\"ehgpp\":\"bwnhhtql\",\"csheafidltugsr\":\"pifhpfeoajvgcxtx\"},\"targetInfo\":{\"overwriteOption\":\"FailOnConflict\",\"containerId\":\"sjhoiftxfkfwegpr\",\"databaseName\":\"tillucbiqtg\",\"targetDirectoryForFileRestore\":\"ohmcwsld\"},\"recoveryMode\":\"WorkloadRecovery\",\"targetResourceGroupName\":\"tpwb\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"llibphbqzmizak\",\"identityName\":\"ankjpdnjzh\",\"userAssignedIdentityProperties\":{\"clientId\":\"ylhjlm\",\"principalId\":\"y\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":true,\"logPointInTimeForDBRecovery\":\"rsopteecjm\"},\"targetVirtualMachineId\":\"slstvasy\",\"resourceGuardOperationRequests\":[\"dzaumweooh\"]}") - .toObject(AzureWorkloadSapHanaRestoreRequest.class); - Assertions.assertEquals("dzaumweooh", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("zaefedxihc", model.sourceResourceId()); - Assertions.assertEquals("hk", model.propertyBag().get("crjdqnsdfzpbgtg")); - Assertions.assertEquals(OverwriteOptions.FAIL_ON_CONFLICT, model.targetInfo().overwriteOption()); - Assertions.assertEquals("sjhoiftxfkfwegpr", model.targetInfo().containerId()); - Assertions.assertEquals("tillucbiqtg", model.targetInfo().databaseName()); - Assertions.assertEquals("ohmcwsld", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.WORKLOAD_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("tpwb", model.targetResourceGroupName()); - Assertions.assertEquals("llibphbqzmizak", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("ankjpdnjzh", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("ylhjlm", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("y", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("rsopteecjm", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("slstvasy", model.targetVirtualMachineId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSapHanaRestoreRequest model - = new AzureWorkloadSapHanaRestoreRequest().withResourceGuardOperationRequests(Arrays.asList("dzaumweooh")) - .withRecoveryType(RecoveryType.OFFLINE) - .withSourceResourceId("zaefedxihc") - .withPropertyBag(mapOf("crjdqnsdfzpbgtg", "hk", "utlwxezwzhok", "ylkdghrje", "ehgpp", "bwnhhtql", - "csheafidltugsr", "pifhpfeoajvgcxtx")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.FAIL_ON_CONFLICT) - .withContainerId("sjhoiftxfkfwegpr") - .withDatabaseName("tillucbiqtg") - .withTargetDirectoryForFileRestore("ohmcwsld")) - .withRecoveryMode(RecoveryMode.WORKLOAD_RECOVERY) - .withTargetResourceGroupName("tpwb") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("llibphbqzmizak") - .withIdentityName("ankjpdnjzh") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("ylhjlm").withPrincipalId("y"))) - .withSnapshotRestoreParameters(new SnapshotRestoreParameters().withSkipAttachAndMount(true) - .withLogPointInTimeForDBRecovery("rsopteecjm")) - .withTargetVirtualMachineId("slstvasy"); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSapHanaRestoreRequest.class); - Assertions.assertEquals("dzaumweooh", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("zaefedxihc", model.sourceResourceId()); - Assertions.assertEquals("hk", model.propertyBag().get("crjdqnsdfzpbgtg")); - Assertions.assertEquals(OverwriteOptions.FAIL_ON_CONFLICT, model.targetInfo().overwriteOption()); - Assertions.assertEquals("sjhoiftxfkfwegpr", model.targetInfo().containerId()); - Assertions.assertEquals("tillucbiqtg", model.targetInfo().databaseName()); - Assertions.assertEquals("ohmcwsld", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.WORKLOAD_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("tpwb", model.targetResourceGroupName()); - Assertions.assertEquals("llibphbqzmizak", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("ankjpdnjzh", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("ylhjlm", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("y", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("rsopteecjm", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("slstvasy", model.targetVirtualMachineId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRestoreWithRehydrateRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRestoreWithRehydrateRequestTests.java deleted file mode 100644 index e2ab012e40e78..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSapHanaRestoreWithRehydrateRequestTests.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSapHanaRestoreWithRehydrateRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointRehydrationInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriority; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSapHanaRestoreWithRehydrateRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSapHanaRestoreWithRehydrateRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSAPHanaRestoreWithRehydrateRequest\",\"recoveryPointRehydrationInfo\":{\"rehydrationRetentionDuration\":\"ddkvbxgkqu\",\"rehydrationPriority\":\"High\"},\"recoveryType\":\"AlternateLocation\",\"sourceResourceId\":\"dacarvvlfnty\",\"propertyBag\":{\"lsxkd\":\"oiwenazerohzrsq\"},\"targetInfo\":{\"overwriteOption\":\"Invalid\",\"containerId\":\"fgsdpcvessmzhhk\",\"databaseName\":\"ip\",\"targetDirectoryForFileRestore\":\"q\"},\"recoveryMode\":\"WorkloadRecovery\",\"targetResourceGroupName\":\"kva\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"htjqvqyvw\",\"identityName\":\"tae\",\"userAssignedIdentityProperties\":{\"clientId\":\"zzy\",\"principalId\":\"vusxiv\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":false,\"logPointInTimeForDBRecovery\":\"veimipskdyzatv\"},\"targetVirtualMachineId\":\"zkaftjvvrux\",\"resourceGuardOperationRequests\":[\"syeipqd\",\"mjtgrqg\",\"gkkileplkcsmkn\",\"wtbbaedorvvmqf\"]}") - .toObject(AzureWorkloadSapHanaRestoreWithRehydrateRequest.class); - Assertions.assertEquals("syeipqd", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.ALTERNATE_LOCATION, model.recoveryType()); - Assertions.assertEquals("dacarvvlfnty", model.sourceResourceId()); - Assertions.assertEquals("oiwenazerohzrsq", model.propertyBag().get("lsxkd")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("fgsdpcvessmzhhk", model.targetInfo().containerId()); - Assertions.assertEquals("ip", model.targetInfo().databaseName()); - Assertions.assertEquals("q", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.WORKLOAD_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("kva", model.targetResourceGroupName()); - Assertions.assertEquals("htjqvqyvw", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("tae", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("zzy", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("vusxiv", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("veimipskdyzatv", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("zkaftjvvrux", model.targetVirtualMachineId()); - Assertions.assertEquals("ddkvbxgkqu", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSapHanaRestoreWithRehydrateRequest model = new AzureWorkloadSapHanaRestoreWithRehydrateRequest() - .withResourceGuardOperationRequests(Arrays.asList("syeipqd", "mjtgrqg", "gkkileplkcsmkn", "wtbbaedorvvmqf")) - .withRecoveryType(RecoveryType.ALTERNATE_LOCATION) - .withSourceResourceId("dacarvvlfnty") - .withPropertyBag(mapOf("lsxkd", "oiwenazerohzrsq")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.INVALID) - .withContainerId("fgsdpcvessmzhhk") - .withDatabaseName("ip") - .withTargetDirectoryForFileRestore("q")) - .withRecoveryMode(RecoveryMode.WORKLOAD_RECOVERY) - .withTargetResourceGroupName("kva") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("htjqvqyvw") - .withIdentityName("tae") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("zzy").withPrincipalId("vusxiv"))) - .withSnapshotRestoreParameters(new SnapshotRestoreParameters().withSkipAttachAndMount(false) - .withLogPointInTimeForDBRecovery("veimipskdyzatv")) - .withTargetVirtualMachineId("zkaftjvvrux") - .withRecoveryPointRehydrationInfo( - new RecoveryPointRehydrationInfo().withRehydrationRetentionDuration("ddkvbxgkqu") - .withRehydrationPriority(RehydrationPriority.HIGH)); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSapHanaRestoreWithRehydrateRequest.class); - Assertions.assertEquals("syeipqd", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.ALTERNATE_LOCATION, model.recoveryType()); - Assertions.assertEquals("dacarvvlfnty", model.sourceResourceId()); - Assertions.assertEquals("oiwenazerohzrsq", model.propertyBag().get("lsxkd")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("fgsdpcvessmzhhk", model.targetInfo().containerId()); - Assertions.assertEquals("ip", model.targetInfo().databaseName()); - Assertions.assertEquals("q", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.WORKLOAD_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("kva", model.targetResourceGroupName()); - Assertions.assertEquals("htjqvqyvw", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("tae", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("zzy", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("vusxiv", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("veimipskdyzatv", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("zkaftjvvrux", model.targetVirtualMachineId()); - Assertions.assertEquals("ddkvbxgkqu", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlAutoProtectionIntentTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlAutoProtectionIntentTests.java deleted file mode 100644 index 21cbd9236fea9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlAutoProtectionIntentTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlAutoProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItemType; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlAutoProtectionIntentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlAutoProtectionIntent model = BinaryData.fromString( - "{\"protectionIntentItemType\":\"AzureWorkloadSQLAutoProtectionIntent\",\"workloadItemType\":\"SAPAseSystem\",\"backupManagementType\":\"AzureSql\",\"sourceResourceId\":\"tbsjuscvsf\",\"itemId\":\"gctmgxuupbezq\",\"policyId\":\"ydrtc\",\"protectionState\":\"ProtectionFailed\"}") - .toObject(AzureWorkloadSqlAutoProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("tbsjuscvsf", model.sourceResourceId()); - Assertions.assertEquals("gctmgxuupbezq", model.itemId()); - Assertions.assertEquals("ydrtc", model.policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState()); - Assertions.assertEquals(WorkloadItemType.SAPASE_SYSTEM, model.workloadItemType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlAutoProtectionIntent model - = new AzureWorkloadSqlAutoProtectionIntent().withBackupManagementType(BackupManagementType.AZURE_SQL) - .withSourceResourceId("tbsjuscvsf") - .withItemId("gctmgxuupbezq") - .withPolicyId("ydrtc") - .withProtectionState(ProtectionStatus.PROTECTION_FAILED) - .withWorkloadItemType(WorkloadItemType.SAPASE_SYSTEM); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlAutoProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("tbsjuscvsf", model.sourceResourceId()); - Assertions.assertEquals("gctmgxuupbezq", model.itemId()); - Assertions.assertEquals("ydrtc", model.policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState()); - Assertions.assertEquals(WorkloadItemType.SAPASE_SYSTEM, model.workloadItemType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRecoveryPointTests.java deleted file mode 100644 index e854e86cca81d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRecoveryPointTests.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlPointInTimeRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRecoveryPointExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.PointInTimeRange; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestorePointType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectory; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlPointInTimeRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlPointInTimeRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSQLPointInTimeRecoveryPoint\",\"timeRanges\":[{\"startTime\":\"2021-11-22T18:06:29Z\",\"endTime\":\"2020-12-26T18:59:24Z\"},{\"startTime\":\"2021-10-10T07:43:31Z\",\"endTime\":\"2021-01-25T05:24:41Z\"},{\"startTime\":\"2021-11-28T13:57:38Z\",\"endTime\":\"2021-09-10T20:36:42Z\"},{\"startTime\":\"2021-01-18T16:44:17Z\",\"endTime\":\"2021-05-30T08:24:19Z\"}],\"extendedInfo\":{\"dataDirectoryTimeInUTC\":\"2021-05-28T09:11:12Z\",\"dataDirectoryPaths\":[{\"type\":\"Log\",\"path\":\"hcxlpm\",\"logicalName\":\"rbdkelvidiz\"},{\"type\":\"Data\",\"path\":\"bccxjmonfdgn\",\"logicalName\":\"cypuuwwlt\"}]},\"recoveryPointTimeInUTC\":\"2021-11-20T18:00Z\",\"type\":\"Log\",\"recoveryPointTierDetails\":[{\"type\":\"InstantRP\",\"status\":\"Valid\",\"extendedInfo\":{\"svflyhbxcudch\":\"zzhmkd\",\"lvizb\":\"gsrboldforobw\",\"dxe\":\"hfovvacqpbtu\"}},{\"type\":\"ArchivedRP\",\"status\":\"Invalid\",\"extendedInfo\":{\"cqucwyhahnom\":\"awumuaslzkwrrwo\"}},{\"type\":\"HardenedRP\",\"status\":\"Deleted\",\"extendedInfo\":{\"lniexz\":\"psvfuurutlwexxwl\",\"tybbwwpgda\":\"rzpgep\"}},{\"type\":\"ArchivedRP\",\"status\":\"Valid\",\"extendedInfo\":{\"suxswqrntvlwijp\":\"ixqnrkcxkjibnxm\",\"uncuw\":\"ttexoqqpwcyyufmh\",\"unqndyfpchrqb\":\"qspkcdqzhlctd\",\"boxjumvq\":\"jjrcgegydc\"}}],\"recoveryPointMoveReadinessInfo\":{\"qxfuojrngif\":{\"isReadyForMove\":true,\"additionalInfo\":\"raiouaubrjtl\"},\"zdlyjdfqw\":{\"isReadyForMove\":false,\"additionalInfo\":\"asccbiui\"},\"ctfnmdxotng\":{\"isReadyForMove\":true,\"additionalInfo\":\"qufdvruzslzojh\"},\"bsnmfpph\":{\"isReadyForMove\":false,\"additionalInfo\":\"geyzihgrkyuiz\"}},\"recoveryPointProperties\":{\"expiryTime\":\"evy\",\"ruleName\":\"hsgz\",\"isSoftDeleted\":true}}") - .toObject(AzureWorkloadSqlPointInTimeRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-20T18:00Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.LOG, model.type()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("zzhmkd", model.recoveryPointTierDetails().get(0).extendedInfo().get("svflyhbxcudch")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("qxfuojrngif").isReadyForMove()); - Assertions.assertEquals("raiouaubrjtl", - model.recoveryPointMoveReadinessInfo().get("qxfuojrngif").additionalInfo()); - Assertions.assertEquals("evy", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("hsgz", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T09:11:12Z"), - model.extendedInfo().dataDirectoryTimeInUtc()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.extendedInfo().dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("hcxlpm", model.extendedInfo().dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("rbdkelvidiz", model.extendedInfo().dataDirectoryPaths().get(0).logicalName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-22T18:06:29Z"), model.timeRanges().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-26T18:59:24Z"), model.timeRanges().get(0).endTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlPointInTimeRecoveryPoint model = new AzureWorkloadSqlPointInTimeRecoveryPoint() - .withRecoveryPointTimeInUtc(OffsetDateTime.parse("2021-11-20T18:00Z")) - .withType(RestorePointType.LOG) - .withRecoveryPointTierDetails(Arrays.asList( - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.INSTANT_RP) - .withStatus(RecoveryPointTierStatus.VALID) - .withExtendedInfo( - mapOf("svflyhbxcudch", "zzhmkd", "lvizb", "gsrboldforobw", "dxe", "hfovvacqpbtu")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.ARCHIVED_RP) - .withStatus(RecoveryPointTierStatus.INVALID) - .withExtendedInfo(mapOf("cqucwyhahnom", "awumuaslzkwrrwo")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.HARDENED_RP) - .withStatus(RecoveryPointTierStatus.DELETED) - .withExtendedInfo(mapOf("lniexz", "psvfuurutlwexxwl", "tybbwwpgda", "rzpgep")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.ARCHIVED_RP) - .withStatus(RecoveryPointTierStatus.VALID) - .withExtendedInfo(mapOf("suxswqrntvlwijp", "ixqnrkcxkjibnxm", "uncuw", "ttexoqqpwcyyufmh", - "unqndyfpchrqb", "qspkcdqzhlctd", "boxjumvq", "jjrcgegydc")))) - .withRecoveryPointMoveReadinessInfo(mapOf("qxfuojrngif", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("raiouaubrjtl"), - "zdlyjdfqw", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("asccbiui"), - "ctfnmdxotng", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("qufdvruzslzojh"), - "bsnmfpph", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("geyzihgrkyuiz"))) - .withRecoveryPointProperties( - new RecoveryPointProperties().withExpiryTime("evy").withRuleName("hsgz").withIsSoftDeleted(true)) - .withExtendedInfo(new AzureWorkloadSqlRecoveryPointExtendedInfo() - .withDataDirectoryTimeInUtc(OffsetDateTime.parse("2021-05-28T09:11:12Z")) - .withDataDirectoryPaths(Arrays.asList( - new SqlDataDirectory().withType(SqlDataDirectoryType.LOG) - .withPath("hcxlpm") - .withLogicalName("rbdkelvidiz"), - new SqlDataDirectory().withType(SqlDataDirectoryType.DATA) - .withPath("bccxjmonfdgn") - .withLogicalName("cypuuwwlt")))) - .withTimeRanges(Arrays.asList( - new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-11-22T18:06:29Z")) - .withEndTime(OffsetDateTime.parse("2020-12-26T18:59:24Z")), - new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-10-10T07:43:31Z")) - .withEndTime(OffsetDateTime.parse("2021-01-25T05:24:41Z")), - new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-11-28T13:57:38Z")) - .withEndTime(OffsetDateTime.parse("2021-09-10T20:36:42Z")), - new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-01-18T16:44:17Z")) - .withEndTime(OffsetDateTime.parse("2021-05-30T08:24:19Z")))); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlPointInTimeRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-20T18:00Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.LOG, model.type()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("zzhmkd", model.recoveryPointTierDetails().get(0).extendedInfo().get("svflyhbxcudch")); - Assertions.assertEquals(true, model.recoveryPointMoveReadinessInfo().get("qxfuojrngif").isReadyForMove()); - Assertions.assertEquals("raiouaubrjtl", - model.recoveryPointMoveReadinessInfo().get("qxfuojrngif").additionalInfo()); - Assertions.assertEquals("evy", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("hsgz", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T09:11:12Z"), - model.extendedInfo().dataDirectoryTimeInUtc()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.extendedInfo().dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("hcxlpm", model.extendedInfo().dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("rbdkelvidiz", model.extendedInfo().dataDirectoryPaths().get(0).logicalName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-22T18:06:29Z"), model.timeRanges().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-26T18:59:24Z"), model.timeRanges().get(0).endTime()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRestoreRequestTests.java deleted file mode 100644 index 16cd844414d53..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRestoreRequestTests.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlPointInTimeRestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryMapping; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlPointInTimeRestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlPointInTimeRestoreRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSQLPointInTimeRestoreRequest\",\"pointInTime\":\"2021-05-03T01:44:42Z\",\"shouldUseAlternateTargetLocation\":false,\"isNonRecoverable\":true,\"alternateDirectoryPaths\":[{\"mappingType\":\"Data\",\"sourceLogicalName\":\"lbiojlvfhrb\",\"sourcePath\":\"neqvcwwyyurmo\",\"targetPath\":\"ppr\"},{\"mappingType\":\"Invalid\",\"sourceLogicalName\":\"mo\",\"sourcePath\":\"yzejnhlbk\",\"targetPath\":\"z\"},{\"mappingType\":\"Invalid\",\"sourceLogicalName\":\"ljhah\",\"sourcePath\":\"echndbnwieholew\",\"targetPath\":\"iuubwefqsf\"},{\"mappingType\":\"Invalid\",\"sourceLogicalName\":\"tf\",\"sourcePath\":\"rqwexjkmfxapjwog\",\"targetPath\":\"nobpudcdabtqwpw\"}],\"recoveryType\":\"OriginalLocation\",\"sourceResourceId\":\"zasqbucljgkyexao\",\"propertyBag\":{\"jumfqwazlnq\":\"aipidsdaultxi\",\"zqdqxt\":\"mcjn\",\"nyfusfzsvtuikzh\":\"jw\"},\"targetInfo\":{\"overwriteOption\":\"Invalid\",\"containerId\":\"cfhmlrqryxyn\",\"databaseName\":\"zrdpsovwxznptgoe\",\"targetDirectoryForFileRestore\":\"bbabp\"},\"recoveryMode\":\"SnapshotAttach\",\"targetResourceGroupName\":\"slkvntjl\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"jkskyr\",\"identityName\":\"ovzidsx\",\"userAssignedIdentityProperties\":{\"clientId\":\"bzmifrygznmmaxr\",\"principalId\":\"kzobgopxlhsln\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":true,\"logPointInTimeForDBRecovery\":\"ixynllxecwcrojp\"},\"targetVirtualMachineId\":\"lhc\",\"resourceGuardOperationRequests\":[\"u\",\"i\",\"dwfmvigorqjb\",\"tzh\"]}") - .toObject(AzureWorkloadSqlPointInTimeRestoreRequest.class); - Assertions.assertEquals("u", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.ORIGINAL_LOCATION, model.recoveryType()); - Assertions.assertEquals("zasqbucljgkyexao", model.sourceResourceId()); - Assertions.assertEquals("aipidsdaultxi", model.propertyBag().get("jumfqwazlnq")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("cfhmlrqryxyn", model.targetInfo().containerId()); - Assertions.assertEquals("zrdpsovwxznptgoe", model.targetInfo().databaseName()); - Assertions.assertEquals("bbabp", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH, model.recoveryMode()); - Assertions.assertEquals("slkvntjl", model.targetResourceGroupName()); - Assertions.assertEquals("jkskyr", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("ovzidsx", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("bzmifrygznmmaxr", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("kzobgopxlhsln", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("ixynllxecwcrojp", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("lhc", model.targetVirtualMachineId()); - Assertions.assertEquals(false, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(true, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.DATA, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("lbiojlvfhrb", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("neqvcwwyyurmo", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("ppr", model.alternateDirectoryPaths().get(0).targetPath()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T01:44:42Z"), model.pointInTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlPointInTimeRestoreRequest model = new AzureWorkloadSqlPointInTimeRestoreRequest() - .withResourceGuardOperationRequests(Arrays.asList("u", "i", "dwfmvigorqjb", "tzh")) - .withRecoveryType(RecoveryType.ORIGINAL_LOCATION) - .withSourceResourceId("zasqbucljgkyexao") - .withPropertyBag(mapOf("jumfqwazlnq", "aipidsdaultxi", "zqdqxt", "mcjn", "nyfusfzsvtuikzh", "jw")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.INVALID) - .withContainerId("cfhmlrqryxyn") - .withDatabaseName("zrdpsovwxznptgoe") - .withTargetDirectoryForFileRestore("bbabp")) - .withRecoveryMode(RecoveryMode.SNAPSHOT_ATTACH) - .withTargetResourceGroupName("slkvntjl") - .withUserAssignedManagedIdentityDetails(new UserAssignedManagedIdentityDetails().withIdentityArmId("jkskyr") - .withIdentityName("ovzidsx") - .withUserAssignedIdentityProperties(new UserAssignedIdentityProperties().withClientId("bzmifrygznmmaxr") - .withPrincipalId("kzobgopxlhsln"))) - .withSnapshotRestoreParameters(new SnapshotRestoreParameters().withSkipAttachAndMount(true) - .withLogPointInTimeForDBRecovery("ixynllxecwcrojp")) - .withTargetVirtualMachineId("lhc") - .withShouldUseAlternateTargetLocation(false) - .withIsNonRecoverable(true) - .withAlternateDirectoryPaths(Arrays.asList( - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.DATA) - .withSourceLogicalName("lbiojlvfhrb") - .withSourcePath("neqvcwwyyurmo") - .withTargetPath("ppr"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.INVALID) - .withSourceLogicalName("mo") - .withSourcePath("yzejnhlbk") - .withTargetPath("z"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.INVALID) - .withSourceLogicalName("ljhah") - .withSourcePath("echndbnwieholew") - .withTargetPath("iuubwefqsf"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.INVALID) - .withSourceLogicalName("tf") - .withSourcePath("rqwexjkmfxapjwog") - .withTargetPath("nobpudcdabtqwpw"))) - .withPointInTime(OffsetDateTime.parse("2021-05-03T01:44:42Z")); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlPointInTimeRestoreRequest.class); - Assertions.assertEquals("u", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.ORIGINAL_LOCATION, model.recoveryType()); - Assertions.assertEquals("zasqbucljgkyexao", model.sourceResourceId()); - Assertions.assertEquals("aipidsdaultxi", model.propertyBag().get("jumfqwazlnq")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("cfhmlrqryxyn", model.targetInfo().containerId()); - Assertions.assertEquals("zrdpsovwxznptgoe", model.targetInfo().databaseName()); - Assertions.assertEquals("bbabp", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH, model.recoveryMode()); - Assertions.assertEquals("slkvntjl", model.targetResourceGroupName()); - Assertions.assertEquals("jkskyr", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("ovzidsx", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("bzmifrygznmmaxr", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("kzobgopxlhsln", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("ixynllxecwcrojp", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("lhc", model.targetVirtualMachineId()); - Assertions.assertEquals(false, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(true, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.DATA, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("lbiojlvfhrb", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("neqvcwwyyurmo", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("ppr", model.alternateDirectoryPaths().get(0).targetPath()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T01:44:42Z"), model.pointInTime()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequestTests.java deleted file mode 100644 index 520f09c208ee5..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequestTests.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointRehydrationInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriority; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryMapping; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest\",\"recoveryPointRehydrationInfo\":{\"rehydrationRetentionDuration\":\"gbdg\",\"rehydrationPriority\":\"High\"},\"pointInTime\":\"2021-07-03T02:46:04Z\",\"shouldUseAlternateTargetLocation\":true,\"isNonRecoverable\":true,\"alternateDirectoryPaths\":[{\"mappingType\":\"Invalid\",\"sourceLogicalName\":\"exjddvjsaqwot\",\"sourcePath\":\"wllcolsr\",\"targetPath\":\"apte\"},{\"mappingType\":\"Data\",\"sourceLogicalName\":\"cgjokjljnhvlq\",\"sourcePath\":\"ek\",\"targetPath\":\"eksnbksdqhjvyk\"}],\"recoveryType\":\"Offline\",\"sourceResourceId\":\"lkhhu\",\"propertyBag\":{\"avnwqj\":\"poq\"},\"targetInfo\":{\"overwriteOption\":\"Invalid\",\"containerId\":\"lejjjkxy\",\"databaseName\":\"fdb\",\"targetDirectoryForFileRestore\":\"bztensvkzykjtj\"},\"recoveryMode\":\"FileRecovery\",\"targetResourceGroupName\":\"fwushcdpkupn\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"gjfbpkuwxeoi\",\"identityName\":\"fiz\",\"userAssignedIdentityProperties\":{\"clientId\":\"kjzwfbcyayk\",\"principalId\":\"fz\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":true,\"logPointInTimeForDBRecovery\":\"rzx\"},\"targetVirtualMachineId\":\"ewsrsxkrplbjaze\",\"resourceGuardOperationRequests\":[\"viyoypsuhbrnnhjx\"]}") - .toObject(AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.class); - Assertions.assertEquals("viyoypsuhbrnnhjx", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("lkhhu", model.sourceResourceId()); - Assertions.assertEquals("poq", model.propertyBag().get("avnwqj")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("lejjjkxy", model.targetInfo().containerId()); - Assertions.assertEquals("fdb", model.targetInfo().databaseName()); - Assertions.assertEquals("bztensvkzykjtj", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.FILE_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("fwushcdpkupn", model.targetResourceGroupName()); - Assertions.assertEquals("gjfbpkuwxeoi", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("fiz", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("kjzwfbcyayk", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("fz", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("rzx", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("ewsrsxkrplbjaze", model.targetVirtualMachineId()); - Assertions.assertEquals(true, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(true, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.INVALID, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("exjddvjsaqwot", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("wllcolsr", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("apte", model.alternateDirectoryPaths().get(0).targetPath()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T02:46:04Z"), model.pointInTime()); - Assertions.assertEquals("gbdg", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest model - = new AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest() - .withResourceGuardOperationRequests(Arrays.asList("viyoypsuhbrnnhjx")) - .withRecoveryType(RecoveryType.OFFLINE) - .withSourceResourceId("lkhhu") - .withPropertyBag(mapOf("avnwqj", "poq")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.INVALID) - .withContainerId("lejjjkxy") - .withDatabaseName("fdb") - .withTargetDirectoryForFileRestore("bztensvkzykjtj")) - .withRecoveryMode(RecoveryMode.FILE_RECOVERY) - .withTargetResourceGroupName("fwushcdpkupn") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("gjfbpkuwxeoi") - .withIdentityName("fiz") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("kjzwfbcyayk").withPrincipalId("fz"))) - .withSnapshotRestoreParameters( - new SnapshotRestoreParameters().withSkipAttachAndMount(true).withLogPointInTimeForDBRecovery("rzx")) - .withTargetVirtualMachineId("ewsrsxkrplbjaze") - .withShouldUseAlternateTargetLocation(true) - .withIsNonRecoverable(true) - .withAlternateDirectoryPaths(Arrays.asList( - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.INVALID) - .withSourceLogicalName("exjddvjsaqwot") - .withSourcePath("wllcolsr") - .withTargetPath("apte"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.DATA) - .withSourceLogicalName("cgjokjljnhvlq") - .withSourcePath("ek") - .withTargetPath("eksnbksdqhjvyk"))) - .withPointInTime(OffsetDateTime.parse("2021-07-03T02:46:04Z")) - .withRecoveryPointRehydrationInfo( - new RecoveryPointRehydrationInfo().withRehydrationRetentionDuration("gbdg") - .withRehydrationPriority(RehydrationPriority.HIGH)); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest.class); - Assertions.assertEquals("viyoypsuhbrnnhjx", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("lkhhu", model.sourceResourceId()); - Assertions.assertEquals("poq", model.propertyBag().get("avnwqj")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("lejjjkxy", model.targetInfo().containerId()); - Assertions.assertEquals("fdb", model.targetInfo().databaseName()); - Assertions.assertEquals("bztensvkzykjtj", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.FILE_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("fwushcdpkupn", model.targetResourceGroupName()); - Assertions.assertEquals("gjfbpkuwxeoi", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("fiz", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("kjzwfbcyayk", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("fz", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("rzx", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("ewsrsxkrplbjaze", model.targetVirtualMachineId()); - Assertions.assertEquals(true, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(true, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.INVALID, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("exjddvjsaqwot", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("wllcolsr", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("apte", model.alternateDirectoryPaths().get(0).targetPath()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T02:46:04Z"), model.pointInTime()); - Assertions.assertEquals("gbdg", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRecoveryPointExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRecoveryPointExtendedInfoTests.java deleted file mode 100644 index a6a9619d960d6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRecoveryPointExtendedInfoTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRecoveryPointExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectory; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlRecoveryPointExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlRecoveryPointExtendedInfo model = BinaryData.fromString( - "{\"dataDirectoryTimeInUTC\":\"2021-03-05T03:32:16Z\",\"dataDirectoryPaths\":[{\"type\":\"Invalid\",\"path\":\"dbevwqqxeysko\",\"logicalName\":\"zinkfkbgbzbowxeq\"},{\"type\":\"Invalid\",\"path\":\"mygvkzqkj\",\"logicalName\":\"okbzef\"},{\"type\":\"Log\",\"path\":\"cczurtlei\",\"logicalName\":\"xbkwv\"},{\"type\":\"Invalid\",\"path\":\"v\",\"logicalName\":\"bzdixzmq\"}]}") - .toObject(AzureWorkloadSqlRecoveryPointExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-05T03:32:16Z"), model.dataDirectoryTimeInUtc()); - Assertions.assertEquals(SqlDataDirectoryType.INVALID, model.dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("dbevwqqxeysko", model.dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("zinkfkbgbzbowxeq", model.dataDirectoryPaths().get(0).logicalName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlRecoveryPointExtendedInfo model = new AzureWorkloadSqlRecoveryPointExtendedInfo() - .withDataDirectoryTimeInUtc(OffsetDateTime.parse("2021-03-05T03:32:16Z")) - .withDataDirectoryPaths(Arrays.asList( - new SqlDataDirectory().withType(SqlDataDirectoryType.INVALID) - .withPath("dbevwqqxeysko") - .withLogicalName("zinkfkbgbzbowxeq"), - new SqlDataDirectory().withType(SqlDataDirectoryType.INVALID) - .withPath("mygvkzqkj") - .withLogicalName("okbzef"), - new SqlDataDirectory().withType(SqlDataDirectoryType.LOG) - .withPath("cczurtlei") - .withLogicalName("xbkwv"), - new SqlDataDirectory().withType(SqlDataDirectoryType.INVALID) - .withPath("v") - .withLogicalName("bzdixzmq"))); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlRecoveryPointExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-05T03:32:16Z"), model.dataDirectoryTimeInUtc()); - Assertions.assertEquals(SqlDataDirectoryType.INVALID, model.dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("dbevwqqxeysko", model.dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("zinkfkbgbzbowxeq", model.dataDirectoryPaths().get(0).logicalName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRecoveryPointTests.java deleted file mode 100644 index bcd90a6e14422..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRecoveryPointTests.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRecoveryPointExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestorePointType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectory; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSQLRecoveryPoint\",\"extendedInfo\":{\"dataDirectoryTimeInUTC\":\"2021-04-19T00:45:52Z\",\"dataDirectoryPaths\":[{\"type\":\"Log\",\"path\":\"glqgleoh\",\"logicalName\":\"etnluankrrfx\"},{\"type\":\"Log\",\"path\":\"tijv\",\"logicalName\":\"vbmqzbqq\"}]},\"recoveryPointTimeInUTC\":\"2021-01-26T11:06:15Z\",\"type\":\"Full\",\"recoveryPointTierDetails\":[{\"type\":\"HardenedRP\",\"status\":\"Valid\",\"extendedInfo\":{\"kuyxoafg\":\"h\",\"linmfgv\":\"oqltfae\"}},{\"type\":\"Invalid\",\"status\":\"Invalid\",\"extendedInfo\":{\"yznuciqd\":\"iypoqeyhlqhykprl\",\"asiibmiybnnust\":\"mexiitdfuxt\",\"nmgixh\":\"nlj\",\"oudorhcgyyp\":\"mavmq\"}},{\"type\":\"HardenedRP\",\"status\":\"Disabled\",\"extendedInfo\":{\"xhugcm\":\"ndm\",\"vlgo\":\"k\"}}],\"recoveryPointMoveReadinessInfo\":{\"jtotpvopvpbd\":{\"isReadyForMove\":false,\"additionalInfo\":\"mdtzfjltfvnzc\"},\"ibcysihsgqc\":{\"isReadyForMove\":true,\"additionalInfo\":\"qqihedsvqwthmk\"}},\"recoveryPointProperties\":{\"expiryTime\":\"ohsdtmcd\",\"ruleName\":\"ufcohdxbz\",\"isSoftDeleted\":true}}") - .toObject(AzureWorkloadSqlRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-26T11:06:15Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.FULL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("h", model.recoveryPointTierDetails().get(0).extendedInfo().get("kuyxoafg")); - Assertions.assertEquals(false, model.recoveryPointMoveReadinessInfo().get("jtotpvopvpbd").isReadyForMove()); - Assertions.assertEquals("mdtzfjltfvnzc", - model.recoveryPointMoveReadinessInfo().get("jtotpvopvpbd").additionalInfo()); - Assertions.assertEquals("ohsdtmcd", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("ufcohdxbz", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-19T00:45:52Z"), - model.extendedInfo().dataDirectoryTimeInUtc()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.extendedInfo().dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("glqgleoh", model.extendedInfo().dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("etnluankrrfx", model.extendedInfo().dataDirectoryPaths().get(0).logicalName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlRecoveryPoint model = new AzureWorkloadSqlRecoveryPoint() - .withRecoveryPointTimeInUtc(OffsetDateTime.parse("2021-01-26T11:06:15Z")) - .withType(RestorePointType.FULL) - .withRecoveryPointTierDetails(Arrays.asList( - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.HARDENED_RP) - .withStatus(RecoveryPointTierStatus.VALID) - .withExtendedInfo(mapOf("kuyxoafg", "h", "linmfgv", "oqltfae")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.INVALID) - .withStatus(RecoveryPointTierStatus.INVALID) - .withExtendedInfo(mapOf("yznuciqd", "iypoqeyhlqhykprl", "asiibmiybnnust", "mexiitdfuxt", "nmgixh", - "nlj", "oudorhcgyyp", "mavmq")), - new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.HARDENED_RP) - .withStatus(RecoveryPointTierStatus.DISABLED) - .withExtendedInfo(mapOf("xhugcm", "ndm", "vlgo", "k")))) - .withRecoveryPointMoveReadinessInfo(mapOf("jtotpvopvpbd", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("mdtzfjltfvnzc"), - "ibcysihsgqc", - new RecoveryPointMoveReadinessInfo().withIsReadyForMove(true).withAdditionalInfo("qqihedsvqwthmk"))) - .withRecoveryPointProperties(new RecoveryPointProperties().withExpiryTime("ohsdtmcd") - .withRuleName("ufcohdxbz") - .withIsSoftDeleted(true)) - .withExtendedInfo(new AzureWorkloadSqlRecoveryPointExtendedInfo() - .withDataDirectoryTimeInUtc(OffsetDateTime.parse("2021-04-19T00:45:52Z")) - .withDataDirectoryPaths(Arrays.asList( - new SqlDataDirectory().withType(SqlDataDirectoryType.LOG) - .withPath("glqgleoh") - .withLogicalName("etnluankrrfx"), - new SqlDataDirectory().withType(SqlDataDirectoryType.LOG) - .withPath("tijv") - .withLogicalName("vbmqzbqq")))); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlRecoveryPoint.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-26T11:06:15Z"), model.recoveryPointTimeInUtc()); - Assertions.assertEquals(RestorePointType.FULL, model.type()); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.recoveryPointTierDetails().get(0).type()); - Assertions.assertEquals(RecoveryPointTierStatus.VALID, model.recoveryPointTierDetails().get(0).status()); - Assertions.assertEquals("h", model.recoveryPointTierDetails().get(0).extendedInfo().get("kuyxoafg")); - Assertions.assertEquals(false, model.recoveryPointMoveReadinessInfo().get("jtotpvopvpbd").isReadyForMove()); - Assertions.assertEquals("mdtzfjltfvnzc", - model.recoveryPointMoveReadinessInfo().get("jtotpvopvpbd").additionalInfo()); - Assertions.assertEquals("ohsdtmcd", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("ufcohdxbz", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(true, model.recoveryPointProperties().isSoftDeleted()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-19T00:45:52Z"), - model.extendedInfo().dataDirectoryTimeInUtc()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.extendedInfo().dataDirectoryPaths().get(0).type()); - Assertions.assertEquals("glqgleoh", model.extendedInfo().dataDirectoryPaths().get(0).path()); - Assertions.assertEquals("etnluankrrfx", model.extendedInfo().dataDirectoryPaths().get(0).logicalName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRestoreRequestTests.java deleted file mode 100644 index 2b0efea1f65d5..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRestoreRequestTests.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryMapping; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlRestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlRestoreRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSQLRestoreRequest\",\"shouldUseAlternateTargetLocation\":false,\"isNonRecoverable\":false,\"alternateDirectoryPaths\":[{\"mappingType\":\"Log\",\"sourceLogicalName\":\"qjujeickpzvcp\",\"sourcePath\":\"mxelnwcltyjed\",\"targetPath\":\"xm\"},{\"mappingType\":\"Invalid\",\"sourceLogicalName\":\"qscazuawxtz\",\"sourcePath\":\"uamwabzxrvxc\",\"targetPath\":\"hsphaivmxyas\"},{\"mappingType\":\"Log\",\"sourceLogicalName\":\"sgzwywakoihknsm\",\"sourcePath\":\"lmljhlnymzotq\",\"targetPath\":\"yuzcbmqqvxmvw\"},{\"mappingType\":\"Data\",\"sourceLogicalName\":\"yxonsupe\",\"sourcePath\":\"lzqnhcvs\",\"targetPath\":\"tnzoibgsxgnxfy\"}],\"recoveryType\":\"Offline\",\"sourceResourceId\":\"p\",\"propertyBag\":{\"iiqbi\":\"wdofdbxiqx\",\"hfqpofv\":\"htmwwinh\"},\"targetInfo\":{\"overwriteOption\":\"Invalid\",\"containerId\":\"embnkbw\",\"databaseName\":\"vxkdivqihebwtswb\",\"targetDirectoryForFileRestore\":\"wfmdurage\"},\"recoveryMode\":\"WorkloadRecovery\",\"targetResourceGroupName\":\"cjfelisdjubgg\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"gkxkbsazgakg\",\"identityName\":\"yrcmjdmspofap\",\"userAssignedIdentityProperties\":{\"clientId\":\"rylniofrzg\",\"principalId\":\"jed\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":true,\"logPointInTimeForDBRecovery\":\"nlvxbcuii\"},\"targetVirtualMachineId\":\"ktwfa\",\"resourceGuardOperationRequests\":[\"v\"]}") - .toObject(AzureWorkloadSqlRestoreRequest.class); - Assertions.assertEquals("v", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("p", model.sourceResourceId()); - Assertions.assertEquals("wdofdbxiqx", model.propertyBag().get("iiqbi")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("embnkbw", model.targetInfo().containerId()); - Assertions.assertEquals("vxkdivqihebwtswb", model.targetInfo().databaseName()); - Assertions.assertEquals("wfmdurage", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.WORKLOAD_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("cjfelisdjubgg", model.targetResourceGroupName()); - Assertions.assertEquals("gkxkbsazgakg", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("yrcmjdmspofap", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("rylniofrzg", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("jed", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("nlvxbcuii", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("ktwfa", model.targetVirtualMachineId()); - Assertions.assertEquals(false, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(false, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("qjujeickpzvcp", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("mxelnwcltyjed", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("xm", model.alternateDirectoryPaths().get(0).targetPath()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlRestoreRequest model - = new AzureWorkloadSqlRestoreRequest().withResourceGuardOperationRequests(Arrays.asList("v")) - .withRecoveryType(RecoveryType.OFFLINE) - .withSourceResourceId("p") - .withPropertyBag(mapOf("iiqbi", "wdofdbxiqx", "hfqpofv", "htmwwinh")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.INVALID) - .withContainerId("embnkbw") - .withDatabaseName("vxkdivqihebwtswb") - .withTargetDirectoryForFileRestore("wfmdurage")) - .withRecoveryMode(RecoveryMode.WORKLOAD_RECOVERY) - .withTargetResourceGroupName("cjfelisdjubgg") - .withUserAssignedManagedIdentityDetails( - new UserAssignedManagedIdentityDetails().withIdentityArmId("gkxkbsazgakg") - .withIdentityName("yrcmjdmspofap") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("rylniofrzg").withPrincipalId("jed"))) - .withSnapshotRestoreParameters(new SnapshotRestoreParameters().withSkipAttachAndMount(true) - .withLogPointInTimeForDBRecovery("nlvxbcuii")) - .withTargetVirtualMachineId("ktwfa") - .withShouldUseAlternateTargetLocation(false) - .withIsNonRecoverable(false) - .withAlternateDirectoryPaths(Arrays.asList( - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.LOG) - .withSourceLogicalName("qjujeickpzvcp") - .withSourcePath("mxelnwcltyjed") - .withTargetPath("xm"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.INVALID) - .withSourceLogicalName("qscazuawxtz") - .withSourcePath("uamwabzxrvxc") - .withTargetPath("hsphaivmxyas"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.LOG) - .withSourceLogicalName("sgzwywakoihknsm") - .withSourcePath("lmljhlnymzotq") - .withTargetPath("yuzcbmqqvxmvw"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.DATA) - .withSourceLogicalName("yxonsupe") - .withSourcePath("lzqnhcvs") - .withTargetPath("tnzoibgsxgnxfy"))); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlRestoreRequest.class); - Assertions.assertEquals("v", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("p", model.sourceResourceId()); - Assertions.assertEquals("wdofdbxiqx", model.propertyBag().get("iiqbi")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("embnkbw", model.targetInfo().containerId()); - Assertions.assertEquals("vxkdivqihebwtswb", model.targetInfo().databaseName()); - Assertions.assertEquals("wfmdurage", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.WORKLOAD_RECOVERY, model.recoveryMode()); - Assertions.assertEquals("cjfelisdjubgg", model.targetResourceGroupName()); - Assertions.assertEquals("gkxkbsazgakg", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("yrcmjdmspofap", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("rylniofrzg", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("jed", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(true, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("nlvxbcuii", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("ktwfa", model.targetVirtualMachineId()); - Assertions.assertEquals(false, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(false, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("qjujeickpzvcp", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("mxelnwcltyjed", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("xm", model.alternateDirectoryPaths().get(0).targetPath()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRestoreWithRehydrateRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRestoreWithRehydrateRequestTests.java deleted file mode 100644 index 198413ca00cc3..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureWorkloadSqlRestoreWithRehydrateRequestTests.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureWorkloadSqlRestoreWithRehydrateRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointRehydrationInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriority; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryMapping; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AzureWorkloadSqlRestoreWithRehydrateRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureWorkloadSqlRestoreWithRehydrateRequest model = BinaryData.fromString( - "{\"objectType\":\"AzureWorkloadSQLRestoreWithRehydrateRequest\",\"recoveryPointRehydrationInfo\":{\"rehydrationRetentionDuration\":\"jhqkbiwetpozy\",\"rehydrationPriority\":\"High\"},\"shouldUseAlternateTargetLocation\":false,\"isNonRecoverable\":false,\"alternateDirectoryPaths\":[{\"mappingType\":\"Log\",\"sourceLogicalName\":\"zlex\",\"sourcePath\":\"fledynojpziu\",\"targetPath\":\"bzkkd\"},{\"mappingType\":\"Invalid\",\"sourceLogicalName\":\"sycljsel\",\"sourcePath\":\"pbafvafhlbylc\",\"targetPath\":\"evxrhyz\"}],\"recoveryType\":\"Offline\",\"sourceResourceId\":\"sofpltd\",\"propertyBag\":{\"fnrac\":\"irrhv\",\"g\":\"npq\",\"ouhdawsigrb\":\"uuj\",\"az\":\"bxsjybvitvqkj\"},\"targetInfo\":{\"overwriteOption\":\"Invalid\",\"containerId\":\"gmuwdchozfnkf\",\"databaseName\":\"lv\",\"targetDirectoryForFileRestore\":\"oakizvoai\"},\"recoveryMode\":\"SnapshotAttachAndRecover\",\"targetResourceGroupName\":\"lnuwiguy\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"kwph\",\"identityName\":\"zc\",\"userAssignedIdentityProperties\":{\"clientId\":\"mpe\",\"principalId\":\"lkexaonwivkcqh\"}},\"snapshotRestoreParameters\":{\"skipAttachAndMount\":false,\"logPointInTimeForDBRecovery\":\"nlccrm\"},\"targetVirtualMachineId\":\"yupiju\",\"resourceGuardOperationRequests\":[\"jfkakfqfrke\",\"yildudxjascow\",\"f\",\"jkpdxphlkksnm\"]}") - .toObject(AzureWorkloadSqlRestoreWithRehydrateRequest.class); - Assertions.assertEquals("jfkakfqfrke", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("sofpltd", model.sourceResourceId()); - Assertions.assertEquals("irrhv", model.propertyBag().get("fnrac")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("gmuwdchozfnkf", model.targetInfo().containerId()); - Assertions.assertEquals("lv", model.targetInfo().databaseName()); - Assertions.assertEquals("oakizvoai", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH_AND_RECOVER, model.recoveryMode()); - Assertions.assertEquals("lnuwiguy", model.targetResourceGroupName()); - Assertions.assertEquals("kwph", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("zc", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("mpe", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("lkexaonwivkcqh", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("nlccrm", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("yupiju", model.targetVirtualMachineId()); - Assertions.assertEquals(false, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(false, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("zlex", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("fledynojpziu", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("bzkkd", model.alternateDirectoryPaths().get(0).targetPath()); - Assertions.assertEquals("jhqkbiwetpozy", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureWorkloadSqlRestoreWithRehydrateRequest model = new AzureWorkloadSqlRestoreWithRehydrateRequest() - .withResourceGuardOperationRequests(Arrays.asList("jfkakfqfrke", "yildudxjascow", "f", "jkpdxphlkksnm")) - .withRecoveryType(RecoveryType.OFFLINE) - .withSourceResourceId("sofpltd") - .withPropertyBag(mapOf("fnrac", "irrhv", "g", "npq", "ouhdawsigrb", "uuj", "az", "bxsjybvitvqkj")) - .withTargetInfo(new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.INVALID) - .withContainerId("gmuwdchozfnkf") - .withDatabaseName("lv") - .withTargetDirectoryForFileRestore("oakizvoai")) - .withRecoveryMode(RecoveryMode.SNAPSHOT_ATTACH_AND_RECOVER) - .withTargetResourceGroupName("lnuwiguy") - .withUserAssignedManagedIdentityDetails(new UserAssignedManagedIdentityDetails().withIdentityArmId("kwph") - .withIdentityName("zc") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("mpe").withPrincipalId("lkexaonwivkcqh"))) - .withSnapshotRestoreParameters( - new SnapshotRestoreParameters().withSkipAttachAndMount(false).withLogPointInTimeForDBRecovery("nlccrm")) - .withTargetVirtualMachineId("yupiju") - .withShouldUseAlternateTargetLocation(false) - .withIsNonRecoverable(false) - .withAlternateDirectoryPaths(Arrays.asList( - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.LOG) - .withSourceLogicalName("zlex") - .withSourcePath("fledynojpziu") - .withTargetPath("bzkkd"), - new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.INVALID) - .withSourceLogicalName("sycljsel") - .withSourcePath("pbafvafhlbylc") - .withTargetPath("evxrhyz"))) - .withRecoveryPointRehydrationInfo( - new RecoveryPointRehydrationInfo().withRehydrationRetentionDuration("jhqkbiwetpozy") - .withRehydrationPriority(RehydrationPriority.HIGH)); - model = BinaryData.fromObject(model).toObject(AzureWorkloadSqlRestoreWithRehydrateRequest.class); - Assertions.assertEquals("jfkakfqfrke", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(RecoveryType.OFFLINE, model.recoveryType()); - Assertions.assertEquals("sofpltd", model.sourceResourceId()); - Assertions.assertEquals("irrhv", model.propertyBag().get("fnrac")); - Assertions.assertEquals(OverwriteOptions.INVALID, model.targetInfo().overwriteOption()); - Assertions.assertEquals("gmuwdchozfnkf", model.targetInfo().containerId()); - Assertions.assertEquals("lv", model.targetInfo().databaseName()); - Assertions.assertEquals("oakizvoai", model.targetInfo().targetDirectoryForFileRestore()); - Assertions.assertEquals(RecoveryMode.SNAPSHOT_ATTACH_AND_RECOVER, model.recoveryMode()); - Assertions.assertEquals("lnuwiguy", model.targetResourceGroupName()); - Assertions.assertEquals("kwph", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("zc", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("mpe", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("lkexaonwivkcqh", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - Assertions.assertEquals(false, model.snapshotRestoreParameters().skipAttachAndMount()); - Assertions.assertEquals("nlccrm", model.snapshotRestoreParameters().logPointInTimeForDBRecovery()); - Assertions.assertEquals("yupiju", model.targetVirtualMachineId()); - Assertions.assertEquals(false, model.shouldUseAlternateTargetLocation()); - Assertions.assertEquals(false, model.isNonRecoverable()); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.alternateDirectoryPaths().get(0).mappingType()); - Assertions.assertEquals("zlex", model.alternateDirectoryPaths().get(0).sourceLogicalName()); - Assertions.assertEquals("fledynojpziu", model.alternateDirectoryPaths().get(0).sourcePath()); - Assertions.assertEquals("bzkkd", model.alternateDirectoryPaths().get(0).targetPath()); - Assertions.assertEquals("jhqkbiwetpozy", model.recoveryPointRehydrationInfo().rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.recoveryPointRehydrationInfo().rehydrationPriority()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseResourceInnerTests.java deleted file mode 100644 index 217beaf5dbcb9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseResourceInnerTests.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupEngineBaseResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBase; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BackupEngineBaseResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupEngineBaseResourceInner model = BinaryData.fromString( - "{\"properties\":{\"backupEngineType\":\"BackupEngineBase\",\"friendlyName\":\"kfgohdneue\",\"backupManagementType\":\"DPM\",\"registrationStatus\":\"sdyhtozfikdowwq\",\"backupEngineState\":\"v\",\"healthStatus\":\"xclvit\",\"canReRegister\":true,\"backupEngineId\":\"o\",\"dpmVersion\":\"sg\",\"azureBackupAgentVersion\":\"hcohfwdsjnk\",\"isAzureBackupAgentUpgradeAvailable\":true,\"isDpmUpgradeAvailable\":true,\"extendedInfo\":{\"databaseName\":\"swacffgdkzz\",\"protectedItemsCount\":1258640156,\"protectedServersCount\":2137392775,\"diskCount\":1769895546,\"usedDiskSpace\":70.37932285828938,\"availableDiskSpace\":37.34096330096411,\"refreshedAt\":\"2021-02-08T12:34:09Z\",\"azureProtectedInstances\":1681889122}},\"eTag\":\"uflrwd\",\"location\":\"hdlxyjrxsagafcn\",\"tags\":{\"vq\":\"wqapnedgfbcvk\"},\"id\":\"pkeqdcvdrhvoo\",\"name\":\"sotbob\",\"type\":\"dopcjwvnh\"}") - .toObject(BackupEngineBaseResourceInner.class); - Assertions.assertEquals("hdlxyjrxsagafcn", model.location()); - Assertions.assertEquals("wqapnedgfbcvk", model.tags().get("vq")); - Assertions.assertEquals("kfgohdneue", model.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.properties().backupManagementType()); - Assertions.assertEquals("sdyhtozfikdowwq", model.properties().registrationStatus()); - Assertions.assertEquals("v", model.properties().backupEngineState()); - Assertions.assertEquals("xclvit", model.properties().healthStatus()); - Assertions.assertEquals(true, model.properties().canReRegister()); - Assertions.assertEquals("o", model.properties().backupEngineId()); - Assertions.assertEquals("sg", model.properties().dpmVersion()); - Assertions.assertEquals("hcohfwdsjnk", model.properties().azureBackupAgentVersion()); - Assertions.assertEquals(true, model.properties().isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(true, model.properties().isDpmUpgradeAvailable()); - Assertions.assertEquals("swacffgdkzz", model.properties().extendedInfo().databaseName()); - Assertions.assertEquals(1258640156, model.properties().extendedInfo().protectedItemsCount()); - Assertions.assertEquals(2137392775, model.properties().extendedInfo().protectedServersCount()); - Assertions.assertEquals(1769895546, model.properties().extendedInfo().diskCount()); - Assertions.assertEquals(70.37932285828938D, model.properties().extendedInfo().usedDiskSpace()); - Assertions.assertEquals(37.34096330096411D, model.properties().extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T12:34:09Z"), - model.properties().extendedInfo().refreshedAt()); - Assertions.assertEquals(1681889122, model.properties().extendedInfo().azureProtectedInstances()); - Assertions.assertEquals("uflrwd", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupEngineBaseResourceInner model = new BackupEngineBaseResourceInner().withLocation("hdlxyjrxsagafcn") - .withTags(mapOf("vq", "wqapnedgfbcvk")) - .withProperties(new BackupEngineBase().withFriendlyName("kfgohdneue") - .withBackupManagementType(BackupManagementType.DPM) - .withRegistrationStatus("sdyhtozfikdowwq") - .withBackupEngineState("v") - .withHealthStatus("xclvit") - .withCanReRegister(true) - .withBackupEngineId("o") - .withDpmVersion("sg") - .withAzureBackupAgentVersion("hcohfwdsjnk") - .withIsAzureBackupAgentUpgradeAvailable(true) - .withIsDpmUpgradeAvailable(true) - .withExtendedInfo(new BackupEngineExtendedInfo().withDatabaseName("swacffgdkzz") - .withProtectedItemsCount(1258640156) - .withProtectedServersCount(2137392775) - .withDiskCount(1769895546) - .withUsedDiskSpace(70.37932285828938D) - .withAvailableDiskSpace(37.34096330096411D) - .withRefreshedAt(OffsetDateTime.parse("2021-02-08T12:34:09Z")) - .withAzureProtectedInstances(1681889122))) - .withEtag("uflrwd"); - model = BinaryData.fromObject(model).toObject(BackupEngineBaseResourceInner.class); - Assertions.assertEquals("hdlxyjrxsagafcn", model.location()); - Assertions.assertEquals("wqapnedgfbcvk", model.tags().get("vq")); - Assertions.assertEquals("kfgohdneue", model.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.properties().backupManagementType()); - Assertions.assertEquals("sdyhtozfikdowwq", model.properties().registrationStatus()); - Assertions.assertEquals("v", model.properties().backupEngineState()); - Assertions.assertEquals("xclvit", model.properties().healthStatus()); - Assertions.assertEquals(true, model.properties().canReRegister()); - Assertions.assertEquals("o", model.properties().backupEngineId()); - Assertions.assertEquals("sg", model.properties().dpmVersion()); - Assertions.assertEquals("hcohfwdsjnk", model.properties().azureBackupAgentVersion()); - Assertions.assertEquals(true, model.properties().isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(true, model.properties().isDpmUpgradeAvailable()); - Assertions.assertEquals("swacffgdkzz", model.properties().extendedInfo().databaseName()); - Assertions.assertEquals(1258640156, model.properties().extendedInfo().protectedItemsCount()); - Assertions.assertEquals(2137392775, model.properties().extendedInfo().protectedServersCount()); - Assertions.assertEquals(1769895546, model.properties().extendedInfo().diskCount()); - Assertions.assertEquals(70.37932285828938D, model.properties().extendedInfo().usedDiskSpace()); - Assertions.assertEquals(37.34096330096411D, model.properties().extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T12:34:09Z"), - model.properties().extendedInfo().refreshedAt()); - Assertions.assertEquals(1681889122, model.properties().extendedInfo().azureProtectedInstances()); - Assertions.assertEquals("uflrwd", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseResourceListTests.java deleted file mode 100644 index 69e197d2133a9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseResourceListTests.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupEngineBaseResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBase; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBaseResourceList; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BackupEngineBaseResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupEngineBaseResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"backupEngineType\":\"BackupEngineBase\",\"friendlyName\":\"q\",\"backupManagementType\":\"AzureIaasVM\",\"registrationStatus\":\"mqtaruoujmkcjh\",\"backupEngineState\":\"ytjrybnwjewgdr\",\"healthStatus\":\"rvnaenqpeh\",\"canReRegister\":false,\"backupEngineId\":\"ygmi\",\"dpmVersion\":\"hnzdndslgnayqi\",\"azureBackupAgentVersion\":\"nduhavhqlkthum\",\"isAzureBackupAgentUpgradeAvailable\":true,\"isDpmUpgradeAvailable\":true,\"extendedInfo\":{\"databaseName\":\"cdui\",\"protectedItemsCount\":1108910411,\"protectedServersCount\":1393187057,\"diskCount\":178925296,\"usedDiskSpace\":63.86816695634684,\"availableDiskSpace\":0.14011937036747524,\"refreshedAt\":\"2021-01-19T21:06:36Z\",\"azureProtectedInstances\":245335843}},\"eTag\":\"fmmdnbbg\",\"location\":\"zpswiydmc\",\"tags\":{\"dbzm\":\"zdxss\",\"cblylpstdbhhxsr\":\"vdfznudaodvxzb\",\"erscdntne\":\"dzu\"},\"id\":\"fiwjmygtdssls\",\"name\":\"tmweriofzpyq\",\"type\":\"emwabnet\"},{\"properties\":{\"backupEngineType\":\"BackupEngineBase\",\"friendlyName\":\"szhedplvw\",\"backupManagementType\":\"Invalid\",\"registrationStatus\":\"mwmbes\",\"backupEngineState\":\"nkww\",\"healthStatus\":\"pjflcxogao\",\"canReRegister\":true,\"backupEngineId\":\"m\",\"dpmVersion\":\"ikvmkqzeqqk\",\"azureBackupAgentVersion\":\"tfz\",\"isAzureBackupAgentUpgradeAvailable\":false,\"isDpmUpgradeAvailable\":false,\"extendedInfo\":{\"databaseName\":\"ur\",\"protectedItemsCount\":191107441,\"protectedServersCount\":1245356368,\"diskCount\":1368192153,\"usedDiskSpace\":29.50996555933806,\"availableDiskSpace\":71.73574705933942,\"refreshedAt\":\"2021-02-24T08:44:41Z\",\"azureProtectedInstances\":1120938995}},\"eTag\":\"xwak\",\"location\":\"ogqxndlkzgxhuri\",\"tags\":{\"bxmubyynt\":\"podxunkb\",\"tkoievseotgq\":\"lrb\",\"tmuwlauwzi\":\"l\",\"cjefuzmu\":\"xbmp\"},\"id\":\"pbttdum\",\"name\":\"rp\",\"type\":\"xe\"}],\"nextLink\":\"nzbtbhj\"}") - .toObject(BackupEngineBaseResourceList.class); - Assertions.assertEquals("nzbtbhj", model.nextLink()); - Assertions.assertEquals("zpswiydmc", model.value().get(0).location()); - Assertions.assertEquals("zdxss", model.value().get(0).tags().get("dbzm")); - Assertions.assertEquals("q", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_IAAS_VM, - model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("mqtaruoujmkcjh", model.value().get(0).properties().registrationStatus()); - Assertions.assertEquals("ytjrybnwjewgdr", model.value().get(0).properties().backupEngineState()); - Assertions.assertEquals("rvnaenqpeh", model.value().get(0).properties().healthStatus()); - Assertions.assertEquals(false, model.value().get(0).properties().canReRegister()); - Assertions.assertEquals("ygmi", model.value().get(0).properties().backupEngineId()); - Assertions.assertEquals("hnzdndslgnayqi", model.value().get(0).properties().dpmVersion()); - Assertions.assertEquals("nduhavhqlkthum", model.value().get(0).properties().azureBackupAgentVersion()); - Assertions.assertEquals(true, model.value().get(0).properties().isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(true, model.value().get(0).properties().isDpmUpgradeAvailable()); - Assertions.assertEquals("cdui", model.value().get(0).properties().extendedInfo().databaseName()); - Assertions.assertEquals(1108910411, model.value().get(0).properties().extendedInfo().protectedItemsCount()); - Assertions.assertEquals(1393187057, model.value().get(0).properties().extendedInfo().protectedServersCount()); - Assertions.assertEquals(178925296, model.value().get(0).properties().extendedInfo().diskCount()); - Assertions.assertEquals(63.86816695634684D, model.value().get(0).properties().extendedInfo().usedDiskSpace()); - Assertions.assertEquals(0.14011937036747524D, - model.value().get(0).properties().extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-19T21:06:36Z"), - model.value().get(0).properties().extendedInfo().refreshedAt()); - Assertions.assertEquals(245335843, model.value().get(0).properties().extendedInfo().azureProtectedInstances()); - Assertions.assertEquals("fmmdnbbg", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupEngineBaseResourceList model = new BackupEngineBaseResourceList().withNextLink("nzbtbhj") - .withValue(Arrays.asList( - new BackupEngineBaseResourceInner().withLocation("zpswiydmc") - .withTags(mapOf("dbzm", "zdxss", "cblylpstdbhhxsr", "vdfznudaodvxzb", "erscdntne", "dzu")) - .withProperties(new BackupEngineBase().withFriendlyName("q") - .withBackupManagementType(BackupManagementType.AZURE_IAAS_VM) - .withRegistrationStatus("mqtaruoujmkcjh") - .withBackupEngineState("ytjrybnwjewgdr") - .withHealthStatus("rvnaenqpeh") - .withCanReRegister(false) - .withBackupEngineId("ygmi") - .withDpmVersion("hnzdndslgnayqi") - .withAzureBackupAgentVersion("nduhavhqlkthum") - .withIsAzureBackupAgentUpgradeAvailable(true) - .withIsDpmUpgradeAvailable(true) - .withExtendedInfo(new BackupEngineExtendedInfo().withDatabaseName("cdui") - .withProtectedItemsCount(1108910411) - .withProtectedServersCount(1393187057) - .withDiskCount(178925296) - .withUsedDiskSpace(63.86816695634684D) - .withAvailableDiskSpace(0.14011937036747524D) - .withRefreshedAt(OffsetDateTime.parse("2021-01-19T21:06:36Z")) - .withAzureProtectedInstances(245335843))) - .withEtag("fmmdnbbg"), - new BackupEngineBaseResourceInner().withLocation("ogqxndlkzgxhuri") - .withTags( - mapOf("bxmubyynt", "podxunkb", "tkoievseotgq", "lrb", "tmuwlauwzi", "l", "cjefuzmu", "xbmp")) - .withProperties(new BackupEngineBase().withFriendlyName("szhedplvw") - .withBackupManagementType(BackupManagementType.INVALID) - .withRegistrationStatus("mwmbes") - .withBackupEngineState("nkww") - .withHealthStatus("pjflcxogao") - .withCanReRegister(true) - .withBackupEngineId("m") - .withDpmVersion("ikvmkqzeqqk") - .withAzureBackupAgentVersion("tfz") - .withIsAzureBackupAgentUpgradeAvailable(false) - .withIsDpmUpgradeAvailable(false) - .withExtendedInfo(new BackupEngineExtendedInfo().withDatabaseName("ur") - .withProtectedItemsCount(191107441) - .withProtectedServersCount(1245356368) - .withDiskCount(1368192153) - .withUsedDiskSpace(29.50996555933806D) - .withAvailableDiskSpace(71.73574705933942D) - .withRefreshedAt(OffsetDateTime.parse("2021-02-24T08:44:41Z")) - .withAzureProtectedInstances(1120938995))) - .withEtag("xwak"))); - model = BinaryData.fromObject(model).toObject(BackupEngineBaseResourceList.class); - Assertions.assertEquals("nzbtbhj", model.nextLink()); - Assertions.assertEquals("zpswiydmc", model.value().get(0).location()); - Assertions.assertEquals("zdxss", model.value().get(0).tags().get("dbzm")); - Assertions.assertEquals("q", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_IAAS_VM, - model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("mqtaruoujmkcjh", model.value().get(0).properties().registrationStatus()); - Assertions.assertEquals("ytjrybnwjewgdr", model.value().get(0).properties().backupEngineState()); - Assertions.assertEquals("rvnaenqpeh", model.value().get(0).properties().healthStatus()); - Assertions.assertEquals(false, model.value().get(0).properties().canReRegister()); - Assertions.assertEquals("ygmi", model.value().get(0).properties().backupEngineId()); - Assertions.assertEquals("hnzdndslgnayqi", model.value().get(0).properties().dpmVersion()); - Assertions.assertEquals("nduhavhqlkthum", model.value().get(0).properties().azureBackupAgentVersion()); - Assertions.assertEquals(true, model.value().get(0).properties().isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(true, model.value().get(0).properties().isDpmUpgradeAvailable()); - Assertions.assertEquals("cdui", model.value().get(0).properties().extendedInfo().databaseName()); - Assertions.assertEquals(1108910411, model.value().get(0).properties().extendedInfo().protectedItemsCount()); - Assertions.assertEquals(1393187057, model.value().get(0).properties().extendedInfo().protectedServersCount()); - Assertions.assertEquals(178925296, model.value().get(0).properties().extendedInfo().diskCount()); - Assertions.assertEquals(63.86816695634684D, model.value().get(0).properties().extendedInfo().usedDiskSpace()); - Assertions.assertEquals(0.14011937036747524D, - model.value().get(0).properties().extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-19T21:06:36Z"), - model.value().get(0).properties().extendedInfo().refreshedAt()); - Assertions.assertEquals(245335843, model.value().get(0).properties().extendedInfo().azureProtectedInstances()); - Assertions.assertEquals("fmmdnbbg", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseTests.java deleted file mode 100644 index 66909cc0446a0..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineBaseTests.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBase; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class BackupEngineBaseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupEngineBase model = BinaryData.fromString( - "{\"backupEngineType\":\"BackupEngineBase\",\"friendlyName\":\"d\",\"backupManagementType\":\"DPM\",\"registrationStatus\":\"cxrslpmutwuoe\",\"backupEngineState\":\"pkhjwni\",\"healthStatus\":\"sluicpdggkzz\",\"canReRegister\":true,\"backupEngineId\":\"mpaxmodfvuefywsb\",\"dpmVersion\":\"vmwy\",\"azureBackupAgentVersion\":\"fouyf\",\"isAzureBackupAgentUpgradeAvailable\":false,\"isDpmUpgradeAvailable\":false,\"extendedInfo\":{\"databaseName\":\"iyzvqtmnub\",\"protectedItemsCount\":908407782,\"protectedServersCount\":1989438546,\"diskCount\":1254452597,\"usedDiskSpace\":36.0989535057045,\"availableDiskSpace\":69.75703157384325,\"refreshedAt\":\"2021-10-31T06:50:30Z\",\"azureProtectedInstances\":1083170526}}") - .toObject(BackupEngineBase.class); - Assertions.assertEquals("d", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.backupManagementType()); - Assertions.assertEquals("cxrslpmutwuoe", model.registrationStatus()); - Assertions.assertEquals("pkhjwni", model.backupEngineState()); - Assertions.assertEquals("sluicpdggkzz", model.healthStatus()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("mpaxmodfvuefywsb", model.backupEngineId()); - Assertions.assertEquals("vmwy", model.dpmVersion()); - Assertions.assertEquals("fouyf", model.azureBackupAgentVersion()); - Assertions.assertEquals(false, model.isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(false, model.isDpmUpgradeAvailable()); - Assertions.assertEquals("iyzvqtmnub", model.extendedInfo().databaseName()); - Assertions.assertEquals(908407782, model.extendedInfo().protectedItemsCount()); - Assertions.assertEquals(1989438546, model.extendedInfo().protectedServersCount()); - Assertions.assertEquals(1254452597, model.extendedInfo().diskCount()); - Assertions.assertEquals(36.0989535057045D, model.extendedInfo().usedDiskSpace()); - Assertions.assertEquals(69.75703157384325D, model.extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T06:50:30Z"), model.extendedInfo().refreshedAt()); - Assertions.assertEquals(1083170526, model.extendedInfo().azureProtectedInstances()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupEngineBase model = new BackupEngineBase().withFriendlyName("d") - .withBackupManagementType(BackupManagementType.DPM) - .withRegistrationStatus("cxrslpmutwuoe") - .withBackupEngineState("pkhjwni") - .withHealthStatus("sluicpdggkzz") - .withCanReRegister(true) - .withBackupEngineId("mpaxmodfvuefywsb") - .withDpmVersion("vmwy") - .withAzureBackupAgentVersion("fouyf") - .withIsAzureBackupAgentUpgradeAvailable(false) - .withIsDpmUpgradeAvailable(false) - .withExtendedInfo(new BackupEngineExtendedInfo().withDatabaseName("iyzvqtmnub") - .withProtectedItemsCount(908407782) - .withProtectedServersCount(1989438546) - .withDiskCount(1254452597) - .withUsedDiskSpace(36.0989535057045D) - .withAvailableDiskSpace(69.75703157384325D) - .withRefreshedAt(OffsetDateTime.parse("2021-10-31T06:50:30Z")) - .withAzureProtectedInstances(1083170526)); - model = BinaryData.fromObject(model).toObject(BackupEngineBase.class); - Assertions.assertEquals("d", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.backupManagementType()); - Assertions.assertEquals("cxrslpmutwuoe", model.registrationStatus()); - Assertions.assertEquals("pkhjwni", model.backupEngineState()); - Assertions.assertEquals("sluicpdggkzz", model.healthStatus()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("mpaxmodfvuefywsb", model.backupEngineId()); - Assertions.assertEquals("vmwy", model.dpmVersion()); - Assertions.assertEquals("fouyf", model.azureBackupAgentVersion()); - Assertions.assertEquals(false, model.isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(false, model.isDpmUpgradeAvailable()); - Assertions.assertEquals("iyzvqtmnub", model.extendedInfo().databaseName()); - Assertions.assertEquals(908407782, model.extendedInfo().protectedItemsCount()); - Assertions.assertEquals(1989438546, model.extendedInfo().protectedServersCount()); - Assertions.assertEquals(1254452597, model.extendedInfo().diskCount()); - Assertions.assertEquals(36.0989535057045D, model.extendedInfo().usedDiskSpace()); - Assertions.assertEquals(69.75703157384325D, model.extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T06:50:30Z"), model.extendedInfo().refreshedAt()); - Assertions.assertEquals(1083170526, model.extendedInfo().azureProtectedInstances()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineExtendedInfoTests.java deleted file mode 100644 index 25fd9db6fb5e7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEngineExtendedInfoTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineExtendedInfo; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class BackupEngineExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupEngineExtendedInfo model = BinaryData.fromString( - "{\"databaseName\":\"pomgkopkwhojvp\",\"protectedItemsCount\":996289807,\"protectedServersCount\":1448079009,\"diskCount\":1647253865,\"usedDiskSpace\":90.65906932086332,\"availableDiskSpace\":11.146404494926331,\"refreshedAt\":\"2021-01-31T00:19:35Z\",\"azureProtectedInstances\":484454898}") - .toObject(BackupEngineExtendedInfo.class); - Assertions.assertEquals("pomgkopkwhojvp", model.databaseName()); - Assertions.assertEquals(996289807, model.protectedItemsCount()); - Assertions.assertEquals(1448079009, model.protectedServersCount()); - Assertions.assertEquals(1647253865, model.diskCount()); - Assertions.assertEquals(90.65906932086332D, model.usedDiskSpace()); - Assertions.assertEquals(11.146404494926331D, model.availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T00:19:35Z"), model.refreshedAt()); - Assertions.assertEquals(484454898, model.azureProtectedInstances()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupEngineExtendedInfo model = new BackupEngineExtendedInfo().withDatabaseName("pomgkopkwhojvp") - .withProtectedItemsCount(996289807) - .withProtectedServersCount(1448079009) - .withDiskCount(1647253865) - .withUsedDiskSpace(90.65906932086332D) - .withAvailableDiskSpace(11.146404494926331D) - .withRefreshedAt(OffsetDateTime.parse("2021-01-31T00:19:35Z")) - .withAzureProtectedInstances(484454898); - model = BinaryData.fromObject(model).toObject(BackupEngineExtendedInfo.class); - Assertions.assertEquals("pomgkopkwhojvp", model.databaseName()); - Assertions.assertEquals(996289807, model.protectedItemsCount()); - Assertions.assertEquals(1448079009, model.protectedServersCount()); - Assertions.assertEquals(1647253865, model.diskCount()); - Assertions.assertEquals(90.65906932086332D, model.usedDiskSpace()); - Assertions.assertEquals(11.146404494926331D, model.availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T00:19:35Z"), model.refreshedAt()); - Assertions.assertEquals(484454898, model.azureProtectedInstances()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesGetWithResponseMockTests.java deleted file mode 100644 index 0357f99e15d10..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesGetWithResponseMockTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBaseResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupEnginesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"backupEngineType\":\"BackupEngineBase\",\"friendlyName\":\"mxsnxocuul\",\"backupManagementType\":\"DefaultBackup\",\"registrationStatus\":\"poy\",\"backupEngineState\":\"wwdjuxdbdl\",\"healthStatus\":\"gdyrcvuqbsgzl\",\"canReRegister\":false,\"backupEngineId\":\"jnqogdxwbsfpyx\",\"dpmVersion\":\"jlf\",\"azureBackupAgentVersion\":\"cominxojjluxx\",\"isAzureBackupAgentUpgradeAvailable\":false,\"isDpmUpgradeAvailable\":true,\"extendedInfo\":{\"databaseName\":\"zzqjmu\",\"protectedItemsCount\":497820595,\"protectedServersCount\":1574150340,\"diskCount\":326247810,\"usedDiskSpace\":92.35988752571616,\"availableDiskSpace\":78.57405679376929,\"refreshedAt\":\"2021-11-17T07:54:34Z\",\"azureProtectedInstances\":938147510}},\"eTag\":\"wtaznkcqw\",\"location\":\"xwjyofgwhnk\",\"tags\":{\"ssmctsnl\":\"wl\",\"s\":\"kpwolg\"},\"id\":\"bxbteogfgfiijry\",\"name\":\"wlefksxqceazfpxg\",\"type\":\"m\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BackupEngineBaseResource response = manager.backupEngines() - .getWithResponse("lokhueoijyzcqyp", "qzufgsyfejyvdwt", "xptpqaya", "k", "cf", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("xwjyofgwhnk", response.location()); - Assertions.assertEquals("wl", response.tags().get("ssmctsnl")); - Assertions.assertEquals("mxsnxocuul", response.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, response.properties().backupManagementType()); - Assertions.assertEquals("poy", response.properties().registrationStatus()); - Assertions.assertEquals("wwdjuxdbdl", response.properties().backupEngineState()); - Assertions.assertEquals("gdyrcvuqbsgzl", response.properties().healthStatus()); - Assertions.assertEquals(false, response.properties().canReRegister()); - Assertions.assertEquals("jnqogdxwbsfpyx", response.properties().backupEngineId()); - Assertions.assertEquals("jlf", response.properties().dpmVersion()); - Assertions.assertEquals("cominxojjluxx", response.properties().azureBackupAgentVersion()); - Assertions.assertEquals(false, response.properties().isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(true, response.properties().isDpmUpgradeAvailable()); - Assertions.assertEquals("zzqjmu", response.properties().extendedInfo().databaseName()); - Assertions.assertEquals(497820595, response.properties().extendedInfo().protectedItemsCount()); - Assertions.assertEquals(1574150340, response.properties().extendedInfo().protectedServersCount()); - Assertions.assertEquals(326247810, response.properties().extendedInfo().diskCount()); - Assertions.assertEquals(92.35988752571616D, response.properties().extendedInfo().usedDiskSpace()); - Assertions.assertEquals(78.57405679376929D, response.properties().extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-17T07:54:34Z"), - response.properties().extendedInfo().refreshedAt()); - Assertions.assertEquals(938147510, response.properties().extendedInfo().azureProtectedInstances()); - Assertions.assertEquals("wtaznkcqw", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesListMockTests.java deleted file mode 100644 index 4c9966f36cba6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupEnginesListMockTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineBaseResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupEnginesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"backupEngineType\":\"BackupEngineBase\",\"friendlyName\":\"bwxgoooxzpra\",\"backupManagementType\":\"DefaultBackup\",\"registrationStatus\":\"xknpdgz\",\"backupEngineState\":\"jsugswhgs\",\"healthStatus\":\"dkwwn\",\"canReRegister\":false,\"backupEngineId\":\"ctohzhaquvwsxbgn\",\"dpmVersion\":\"ervqchoadhrsxqvz\",\"azureBackupAgentVersion\":\"pabdsrg\",\"isAzureBackupAgentUpgradeAvailable\":true,\"isDpmUpgradeAvailable\":false,\"extendedInfo\":{\"databaseName\":\"subklr\",\"protectedItemsCount\":1397650583,\"protectedServersCount\":601653470,\"diskCount\":1816417082,\"usedDiskSpace\":84.32223243327167,\"availableDiskSpace\":14.897106796206582,\"refreshedAt\":\"2021-11-13T22:31:32Z\",\"azureProtectedInstances\":653737620}},\"eTag\":\"qkwaruwd\",\"location\":\"vqzxoebwg\",\"tags\":{\"upwtz\":\"ibanb\",\"ozkxbzrpejplss\":\"pak\"},\"id\":\"nbtttkgsuxu\",\"name\":\"rswgkpjhboyikeb\",\"type\":\"uhkslg\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.backupEngines() - .list("zduewihapfjii", "njdiqfliejhpcl", "iedfsbwcei", "bv", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("vqzxoebwg", response.iterator().next().location()); - Assertions.assertEquals("ibanb", response.iterator().next().tags().get("upwtz")); - Assertions.assertEquals("bwxgoooxzpra", response.iterator().next().properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, - response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("xknpdgz", response.iterator().next().properties().registrationStatus()); - Assertions.assertEquals("jsugswhgs", response.iterator().next().properties().backupEngineState()); - Assertions.assertEquals("dkwwn", response.iterator().next().properties().healthStatus()); - Assertions.assertEquals(false, response.iterator().next().properties().canReRegister()); - Assertions.assertEquals("ctohzhaquvwsxbgn", response.iterator().next().properties().backupEngineId()); - Assertions.assertEquals("ervqchoadhrsxqvz", response.iterator().next().properties().dpmVersion()); - Assertions.assertEquals("pabdsrg", response.iterator().next().properties().azureBackupAgentVersion()); - Assertions.assertEquals(true, response.iterator().next().properties().isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(false, response.iterator().next().properties().isDpmUpgradeAvailable()); - Assertions.assertEquals("subklr", response.iterator().next().properties().extendedInfo().databaseName()); - Assertions.assertEquals(1397650583, - response.iterator().next().properties().extendedInfo().protectedItemsCount()); - Assertions.assertEquals(601653470, - response.iterator().next().properties().extendedInfo().protectedServersCount()); - Assertions.assertEquals(1816417082, response.iterator().next().properties().extendedInfo().diskCount()); - Assertions.assertEquals(84.32223243327167D, - response.iterator().next().properties().extendedInfo().usedDiskSpace()); - Assertions.assertEquals(14.897106796206582D, - response.iterator().next().properties().extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T22:31:32Z"), - response.iterator().next().properties().extendedInfo().refreshedAt()); - Assertions.assertEquals(653737620, - response.iterator().next().properties().extendedInfo().azureProtectedInstances()); - Assertions.assertEquals("qkwaruwd", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupJobsListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupJobsListMockTests.java deleted file mode 100644 index 762ca7cfa3800..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupJobsListMockTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.JobResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupJobsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"jobType\":\"Job\",\"entityFriendlyName\":\"vrbnyrukoil\",\"backupManagementType\":\"DefaultBackup\",\"operation\":\"uwj\",\"status\":\"ipjlhwyxpzruz\",\"startTime\":\"2021-11-02T20:00:35Z\",\"endTime\":\"2021-02-24T23:49:38Z\",\"activityId\":\"whbgxvellvul\"},\"eTag\":\"d\",\"location\":\"nitmujdtvmclyymf\",\"tags\":{\"xfzuvrzmzqmzj\":\"jpddn\",\"pv\":\"rb\",\"pglaoh\":\"mdyfoebojtj\"},\"id\":\"qk\",\"name\":\"jtnqjil\",\"type\":\"ywkdcwmqsy\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.backupJobs() - .list("thvmaxgnuyeamcmh", "dfjeceho", "wcpqtwl", "esq", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("nitmujdtvmclyymf", response.iterator().next().location()); - Assertions.assertEquals("jpddn", response.iterator().next().tags().get("xfzuvrzmzqmzj")); - Assertions.assertEquals("vrbnyrukoil", response.iterator().next().properties().entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, - response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("uwj", response.iterator().next().properties().operation()); - Assertions.assertEquals("ipjlhwyxpzruz", response.iterator().next().properties().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-02T20:00:35Z"), - response.iterator().next().properties().startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-24T23:49:38Z"), - response.iterator().next().properties().endTime()); - Assertions.assertEquals("whbgxvellvul", response.iterator().next().properties().activityId()); - Assertions.assertEquals("d", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupManagementUsageInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupManagementUsageInnerTests.java deleted file mode 100644 index c5097447961ca..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupManagementUsageInnerTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupManagementUsageInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.NameInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UsagesUnit; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class BackupManagementUsageInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupManagementUsageInner model = BinaryData.fromString( - "{\"unit\":\"Count\",\"quotaPeriod\":\"dvkaozw\",\"nextResetTime\":\"2021-02-22T11:39:16Z\",\"currentValue\":4625530429549295340,\"limit\":4205096906528038378,\"name\":{\"value\":\"k\",\"localizedValue\":\"yxolniwp\"}}") - .toObject(BackupManagementUsageInner.class); - Assertions.assertEquals(UsagesUnit.COUNT, model.unit()); - Assertions.assertEquals("dvkaozw", model.quotaPeriod()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-22T11:39:16Z"), model.nextResetTime()); - Assertions.assertEquals(4625530429549295340L, model.currentValue()); - Assertions.assertEquals(4205096906528038378L, model.limit()); - Assertions.assertEquals("k", model.name().value()); - Assertions.assertEquals("yxolniwp", model.name().localizedValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupManagementUsageInner model = new BackupManagementUsageInner().withUnit(UsagesUnit.COUNT) - .withQuotaPeriod("dvkaozw") - .withNextResetTime(OffsetDateTime.parse("2021-02-22T11:39:16Z")) - .withCurrentValue(4625530429549295340L) - .withLimit(4205096906528038378L) - .withName(new NameInfo().withValue("k").withLocalizedValue("yxolniwp")); - model = BinaryData.fromObject(model).toObject(BackupManagementUsageInner.class); - Assertions.assertEquals(UsagesUnit.COUNT, model.unit()); - Assertions.assertEquals("dvkaozw", model.quotaPeriod()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-22T11:39:16Z"), model.nextResetTime()); - Assertions.assertEquals(4625530429549295340L, model.currentValue()); - Assertions.assertEquals(4205096906528038378L, model.limit()); - Assertions.assertEquals("k", model.name().value()); - Assertions.assertEquals("yxolniwp", model.name().localizedValue()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupManagementUsageListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupManagementUsageListTests.java deleted file mode 100644 index ddb8075a7c0a6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupManagementUsageListTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupManagementUsageInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementUsageList; -import com.azure.resourcemanager.recoveryservicesbackup.models.NameInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.UsagesUnit; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class BackupManagementUsageListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupManagementUsageList model = BinaryData.fromString( - "{\"value\":[{\"unit\":\"Percent\",\"quotaPeriod\":\"ouskcqvkocrc\",\"nextResetTime\":\"2021-02-11T18:18:15Z\",\"currentValue\":5768373522529510794,\"limit\":104740040232311726,\"name\":{\"value\":\"biksq\",\"localizedValue\":\"lssai\"}},{\"unit\":\"CountPerSecond\",\"quotaPeriod\":\"wnzlljfmppeeb\",\"nextResetTime\":\"2021-11-23T16:03:48Z\",\"currentValue\":8457329254467091392,\"limit\":1088287690642884629,\"name\":{\"value\":\"uujitcjc\",\"localizedValue\":\"zevndhkrwpdappds\"}},{\"unit\":\"Percent\",\"quotaPeriod\":\"wrwjfeu\",\"nextResetTime\":\"2021-11-14T12:39:29Z\",\"currentValue\":5558562364469410639,\"limit\":7488631932267615574,\"name\":{\"value\":\"ldhugjzzdatqxh\",\"localizedValue\":\"dgeablgphu\"}}]}") - .toObject(BackupManagementUsageList.class); - Assertions.assertEquals(UsagesUnit.PERCENT, model.value().get(0).unit()); - Assertions.assertEquals("ouskcqvkocrc", model.value().get(0).quotaPeriod()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-11T18:18:15Z"), model.value().get(0).nextResetTime()); - Assertions.assertEquals(5768373522529510794L, model.value().get(0).currentValue()); - Assertions.assertEquals(104740040232311726L, model.value().get(0).limit()); - Assertions.assertEquals("biksq", model.value().get(0).name().value()); - Assertions.assertEquals("lssai", model.value().get(0).name().localizedValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupManagementUsageList model = new BackupManagementUsageList().withValue(Arrays.asList( - new BackupManagementUsageInner().withUnit(UsagesUnit.PERCENT) - .withQuotaPeriod("ouskcqvkocrc") - .withNextResetTime(OffsetDateTime.parse("2021-02-11T18:18:15Z")) - .withCurrentValue(5768373522529510794L) - .withLimit(104740040232311726L) - .withName(new NameInfo().withValue("biksq").withLocalizedValue("lssai")), - new BackupManagementUsageInner().withUnit(UsagesUnit.COUNT_PER_SECOND) - .withQuotaPeriod("wnzlljfmppeeb") - .withNextResetTime(OffsetDateTime.parse("2021-11-23T16:03:48Z")) - .withCurrentValue(8457329254467091392L) - .withLimit(1088287690642884629L) - .withName(new NameInfo().withValue("uujitcjc").withLocalizedValue("zevndhkrwpdappds")), - new BackupManagementUsageInner().withUnit(UsagesUnit.PERCENT) - .withQuotaPeriod("wrwjfeu") - .withNextResetTime(OffsetDateTime.parse("2021-11-14T12:39:29Z")) - .withCurrentValue(5558562364469410639L) - .withLimit(7488631932267615574L) - .withName(new NameInfo().withValue("ldhugjzzdatqxh").withLocalizedValue("dgeablgphu")))); - model = BinaryData.fromObject(model).toObject(BackupManagementUsageList.class); - Assertions.assertEquals(UsagesUnit.PERCENT, model.value().get(0).unit()); - Assertions.assertEquals("ouskcqvkocrc", model.value().get(0).quotaPeriod()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-11T18:18:15Z"), model.value().get(0).nextResetTime()); - Assertions.assertEquals(5768373522529510794L, model.value().get(0).currentValue()); - Assertions.assertEquals(104740040232311726L, model.value().get(0).limit()); - Assertions.assertEquals("biksq", model.value().get(0).name().value()); - Assertions.assertEquals("lssai", model.value().get(0).name().localizedValue()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index 492fdd4ab953c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.backupOperationResults() - .getWithResponse("ejuwyqwdqigmghgi", "z", "xlujkhnjcm", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupPoliciesListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupPoliciesListMockTests.java deleted file mode 100644 index 1a6e3e4900f96..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupPoliciesListMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupPoliciesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":977312743,\"resourceGuardOperationRequests\":[\"imbyqe\",\"r\",\"odlikcdrdaasax\",\"obsmf\"]},\"eTag\":\"iyjvz\",\"location\":\"ko\",\"tags\":{\"zm\":\"awn\",\"oywsxvjabjqqaxu\":\"n\"},\"id\":\"vym\",\"name\":\"nudn\",\"type\":\"oabhjxwxqweuip\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.backupPolicies().list("kbqsjhbtqqvyfscy", "fwbivqvo", "fuy", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ko", response.iterator().next().location()); - Assertions.assertEquals("awn", response.iterator().next().tags().get("zm")); - Assertions.assertEquals(977312743, response.iterator().next().properties().protectedItemsCount()); - Assertions.assertEquals("imbyqe", - response.iterator().next().properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("iyjvz", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectableItemsListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectableItemsListMockTests.java deleted file mode 100644 index daa8ca9ee80fd..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectableItemsListMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItemResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupProtectableItemsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"protectableItemType\":\"WorkloadProtectableItem\",\"backupManagementType\":\"ekpt\",\"workloadType\":\"aydb\",\"friendlyName\":\"c\",\"protectionState\":\"ProtectionFailed\"},\"eTag\":\"cfnzhmhsurlgw\",\"location\":\"kpmmz\",\"tags\":{\"momsgvvj\":\"auolawiu\",\"dfl\":\"vvlrlohewjjmajn\",\"eq\":\"ionsw\",\"xjoshohtotryegpk\":\"zfz\"},\"id\":\"xrmexznlw\",\"name\":\"bfokxkhu\",\"type\":\"ze\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.backupProtectableItems() - .list("neerzztrknsj", "lugdybnhrxlelf", "hkeizcp", "htdm", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("kpmmz", response.iterator().next().location()); - Assertions.assertEquals("auolawiu", response.iterator().next().tags().get("momsgvvj")); - Assertions.assertEquals("ekpt", response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("aydb", response.iterator().next().properties().workloadType()); - Assertions.assertEquals("c", response.iterator().next().properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, - response.iterator().next().properties().protectionState()); - Assertions.assertEquals("cfnzhmhsurlgw", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectedItemsListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectedItemsListMockTests.java deleted file mode 100644 index 4e0339867a42a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectedItemsListMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupProtectedItemsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"AzureSql\",\"workloadType\":\"SQLDB\",\"containerName\":\"hqet\",\"sourceResourceId\":\"qrtvaoznqni\",\"policyId\":\"ezeagmceituuge\",\"lastRecoveryPoint\":\"2021-10-04T20:29:19Z\",\"backupSetName\":\"jstlzmblsyj\",\"createMode\":\"Recover\",\"deferredDeleteTimeInUTC\":\"2020-12-23T16:02:01Z\",\"isScheduledForDeferredDelete\":true,\"deferredDeleteTimeRemaining\":\"bfsyrledjcustb\",\"isDeferredDeleteScheduleUpcoming\":false,\"isRehydrate\":true,\"resourceGuardOperationRequests\":[\"zvsgeafgfosehxlz\",\"xezppk\",\"waaeskyfjl\"],\"isArchiveEnabled\":false,\"policyName\":\"toyrplixlajml\",\"softDeleteRetentionPeriodInDays\":1773397214,\"vaultId\":\"evhamfowg\"},\"eTag\":\"tmk\",\"location\":\"kxpkzwaq\",\"tags\":{\"vf\":\"qovchiqbp\",\"gmsfepxyi\":\"dusztekxby\"},\"id\":\"pqadagrhrdicxdwy\",\"name\":\"fowxwyovcxjsgbi\",\"type\":\"cu\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.backupProtectedItems() - .list("bectvtfjmskdch", "aiubavlzwpvgmfa", "kzaz", "gokedgjqafkm", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("kxpkzwaq", response.iterator().next().location()); - Assertions.assertEquals("qovchiqbp", response.iterator().next().tags().get("vf")); - Assertions.assertEquals("hqet", response.iterator().next().properties().containerName()); - Assertions.assertEquals("qrtvaoznqni", response.iterator().next().properties().sourceResourceId()); - Assertions.assertEquals("ezeagmceituuge", response.iterator().next().properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-04T20:29:19Z"), - response.iterator().next().properties().lastRecoveryPoint()); - Assertions.assertEquals("jstlzmblsyj", response.iterator().next().properties().backupSetName()); - Assertions.assertEquals(CreateMode.RECOVER, response.iterator().next().properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T16:02:01Z"), - response.iterator().next().properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(true, response.iterator().next().properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("bfsyrledjcustb", - response.iterator().next().properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(false, response.iterator().next().properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, response.iterator().next().properties().isRehydrate()); - Assertions.assertEquals("zvsgeafgfosehxlz", - response.iterator().next().properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, response.iterator().next().properties().isArchiveEnabled()); - Assertions.assertEquals("toyrplixlajml", response.iterator().next().properties().policyName()); - Assertions.assertEquals(1773397214, response.iterator().next().properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("tmk", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionContainersListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionContainersListMockTests.java deleted file mode 100644 index 320f43712fe5e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionContainersListMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupProtectionContainersListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"dfqnhttwdowrczfj\",\"backupManagementType\":\"DPM\",\"registrationStatus\":\"xxrkkmh\",\"healthStatus\":\"ulwempdc\",\"protectableObjectType\":\"rhjul\"},\"eTag\":\"u\",\"location\":\"wzpflusnaw\",\"tags\":{\"xxyxhighctxbxm\":\"gzotfriyrgkoekvz\"},\"id\":\"lpcqydeykvskic\",\"name\":\"dfrjeizik\",\"type\":\"qaboohxbms\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.backupProtectionContainers() - .list("ufgjblcdr", "yfcemftz", "yykyalu", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("wzpflusnaw", response.iterator().next().location()); - Assertions.assertEquals("gzotfriyrgkoekvz", response.iterator().next().tags().get("xxyxhighctxbxm")); - Assertions.assertEquals("dfqnhttwdowrczfj", response.iterator().next().properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, - response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("xxrkkmh", response.iterator().next().properties().registrationStatus()); - Assertions.assertEquals("ulwempdc", response.iterator().next().properties().healthStatus()); - Assertions.assertEquals("rhjul", response.iterator().next().properties().protectableObjectType()); - Assertions.assertEquals("u", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionIntentsListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionIntentsListMockTests.java deleted file mode 100644 index 14729ce309010..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupProtectionIntentsListMockTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntentResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupProtectionIntentsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"protectionIntentItemType\":\"ProtectionIntent\",\"backupManagementType\":\"DefaultBackup\",\"sourceResourceId\":\"dsaeuzanhsfnh\",\"itemId\":\"nwph\",\"policyId\":\"fngq\",\"protectionState\":\"Protected\"},\"eTag\":\"dftujwjjufwbeqr\",\"location\":\"uorhtssruqnmdvh\",\"tags\":{\"rzw\":\"vjytiqswbq\"},\"id\":\"iytxt\",\"name\":\"gukvlbpkt\",\"type\":\"dstyouam\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.backupProtectionIntents() - .list("ktpv", "xqcsehch", "hufmpq", "mqyjgy", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("uorhtssruqnmdvh", response.iterator().next().location()); - Assertions.assertEquals("vjytiqswbq", response.iterator().next().tags().get("rzw")); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, - response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("dsaeuzanhsfnh", response.iterator().next().properties().sourceResourceId()); - Assertions.assertEquals("nwph", response.iterator().next().properties().itemId()); - Assertions.assertEquals("fngq", response.iterator().next().properties().policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, response.iterator().next().properties().protectionState()); - Assertions.assertEquals("dftujwjjufwbeqr", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupRequestResourceTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupRequestResourceTests.java deleted file mode 100644 index 12b4d623cb58a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupRequestResourceTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupRequestResource; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BackupRequestResourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupRequestResource model = BinaryData.fromString( - "{\"properties\":{\"objectType\":\"BackupRequest\"},\"eTag\":\"pnqi\",\"location\":\"vinvkj\",\"tags\":{\"hmlwpaztzpo\":\"xrbuukzclew\",\"fz\":\"ncckw\",\"feqztppriol\":\"whxxbuyqax\"},\"id\":\"or\",\"name\":\"altol\",\"type\":\"ncwsob\"}") - .toObject(BackupRequestResource.class); - Assertions.assertEquals("vinvkj", model.location()); - Assertions.assertEquals("xrbuukzclew", model.tags().get("hmlwpaztzpo")); - Assertions.assertEquals("pnqi", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupRequestResource model = new BackupRequestResource().withLocation("vinvkj") - .withTags(mapOf("hmlwpaztzpo", "xrbuukzclew", "fz", "ncckw", "feqztppriol", "whxxbuyqax")) - .withProperties(new BackupRequest()) - .withEtag("pnqi"); - model = BinaryData.fromObject(model).toObject(BackupRequestResource.class); - Assertions.assertEquals("vinvkj", model.location()); - Assertions.assertEquals("xrbuukzclew", model.tags().get("hmlwpaztzpo")); - Assertions.assertEquals("pnqi", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupRequestTests.java deleted file mode 100644 index a6d9e486f8993..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupRequestTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupRequest; - -public final class BackupRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupRequest model = BinaryData.fromString("{\"objectType\":\"BackupRequest\"}").toObject(BackupRequest.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupRequest model = new BackupRequest(); - model = BinaryData.fromObject(model).toObject(BackupRequest.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceConfigResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceConfigResourceInnerTests.java deleted file mode 100644 index b7144283bc81c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceConfigResourceInnerTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceConfigResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.DedupState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import com.azure.resourcemanager.recoveryservicesbackup.models.XcoolState; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BackupResourceConfigResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupResourceConfigResourceInner model = BinaryData.fromString( - "{\"properties\":{\"storageModelType\":\"Invalid\",\"storageType\":\"ZoneRedundant\",\"storageTypeState\":\"Invalid\",\"crossRegionRestoreFlag\":false,\"dedupState\":\"Invalid\",\"xcoolState\":\"Disabled\"},\"eTag\":\"m\",\"location\":\"hmtzopbsphrup\",\"tags\":{\"ycm\":\"sybbejhph\",\"htbmuf\":\"xaobhdxbmtqioqjz\",\"rxybqsoq\":\"ownoizhw\"},\"id\":\"jgkdmbpazlobcu\",\"name\":\"pdznrbtcqqjnqgl\",\"type\":\"qgn\"}") - .toObject(BackupResourceConfigResourceInner.class); - Assertions.assertEquals("hmtzopbsphrup", model.location()); - Assertions.assertEquals("sybbejhph", model.tags().get("ycm")); - Assertions.assertEquals(StorageType.INVALID, model.properties().storageModelType()); - Assertions.assertEquals(StorageType.ZONE_REDUNDANT, model.properties().storageType()); - Assertions.assertEquals(StorageTypeState.INVALID, model.properties().storageTypeState()); - Assertions.assertEquals(false, model.properties().crossRegionRestoreFlag()); - Assertions.assertEquals(DedupState.INVALID, model.properties().dedupState()); - Assertions.assertEquals(XcoolState.DISABLED, model.properties().xcoolState()); - Assertions.assertEquals("m", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupResourceConfigResourceInner model = new BackupResourceConfigResourceInner().withLocation("hmtzopbsphrup") - .withTags(mapOf("ycm", "sybbejhph", "htbmuf", "xaobhdxbmtqioqjz", "rxybqsoq", "ownoizhw")) - .withProperties(new BackupResourceConfig().withStorageModelType(StorageType.INVALID) - .withStorageType(StorageType.ZONE_REDUNDANT) - .withStorageTypeState(StorageTypeState.INVALID) - .withCrossRegionRestoreFlag(false) - .withDedupState(DedupState.INVALID) - .withXcoolState(XcoolState.DISABLED)) - .withEtag("m"); - model = BinaryData.fromObject(model).toObject(BackupResourceConfigResourceInner.class); - Assertions.assertEquals("hmtzopbsphrup", model.location()); - Assertions.assertEquals("sybbejhph", model.tags().get("ycm")); - Assertions.assertEquals(StorageType.INVALID, model.properties().storageModelType()); - Assertions.assertEquals(StorageType.ZONE_REDUNDANT, model.properties().storageType()); - Assertions.assertEquals(StorageTypeState.INVALID, model.properties().storageTypeState()); - Assertions.assertEquals(false, model.properties().crossRegionRestoreFlag()); - Assertions.assertEquals(DedupState.INVALID, model.properties().dedupState()); - Assertions.assertEquals(XcoolState.DISABLED, model.properties().xcoolState()); - Assertions.assertEquals("m", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceConfigTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceConfigTests.java deleted file mode 100644 index f034d00b3eb30..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceConfigTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.DedupState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import com.azure.resourcemanager.recoveryservicesbackup.models.XcoolState; -import org.junit.jupiter.api.Assertions; - -public final class BackupResourceConfigTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupResourceConfig model = BinaryData.fromString( - "{\"storageModelType\":\"Invalid\",\"storageType\":\"GeoRedundant\",\"storageTypeState\":\"Unlocked\",\"crossRegionRestoreFlag\":true,\"dedupState\":\"Enabled\",\"xcoolState\":\"Invalid\"}") - .toObject(BackupResourceConfig.class); - Assertions.assertEquals(StorageType.INVALID, model.storageModelType()); - Assertions.assertEquals(StorageType.GEO_REDUNDANT, model.storageType()); - Assertions.assertEquals(StorageTypeState.UNLOCKED, model.storageTypeState()); - Assertions.assertEquals(true, model.crossRegionRestoreFlag()); - Assertions.assertEquals(DedupState.ENABLED, model.dedupState()); - Assertions.assertEquals(XcoolState.INVALID, model.xcoolState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupResourceConfig model = new BackupResourceConfig().withStorageModelType(StorageType.INVALID) - .withStorageType(StorageType.GEO_REDUNDANT) - .withStorageTypeState(StorageTypeState.UNLOCKED) - .withCrossRegionRestoreFlag(true) - .withDedupState(DedupState.ENABLED) - .withXcoolState(XcoolState.INVALID); - model = BinaryData.fromObject(model).toObject(BackupResourceConfig.class); - Assertions.assertEquals(StorageType.INVALID, model.storageModelType()); - Assertions.assertEquals(StorageType.GEO_REDUNDANT, model.storageType()); - Assertions.assertEquals(StorageTypeState.UNLOCKED, model.storageTypeState()); - Assertions.assertEquals(true, model.crossRegionRestoreFlag()); - Assertions.assertEquals(DedupState.ENABLED, model.dedupState()); - Assertions.assertEquals(XcoolState.INVALID, model.xcoolState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsGetWithResponseMockTests.java deleted file mode 100644 index 567072264de5c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsGetWithResponseMockTests.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfigResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.DedupState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import com.azure.resourcemanager.recoveryservicesbackup.models.XcoolState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupResourceStorageConfigsNonCrrsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"storageModelType\":\"ReadAccessGeoZoneRedundant\",\"storageType\":\"LocallyRedundant\",\"storageTypeState\":\"Locked\",\"crossRegionRestoreFlag\":true,\"dedupState\":\"Enabled\",\"xcoolState\":\"Invalid\"},\"eTag\":\"wlpjfelqerppt\",\"location\":\"bgqnz\",\"tags\":{\"gckbb\":\"iilialwc\"},\"id\":\"ccgzpraoxnyu\",\"name\":\"fa\",\"type\":\"sgftipwc\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BackupResourceConfigResource response = manager.backupResourceStorageConfigsNonCrrs() - .getWithResponse("ycsjmlbem", "ej", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("bgqnz", response.location()); - Assertions.assertEquals("iilialwc", response.tags().get("gckbb")); - Assertions.assertEquals(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT, response.properties().storageModelType()); - Assertions.assertEquals(StorageType.LOCALLY_REDUNDANT, response.properties().storageType()); - Assertions.assertEquals(StorageTypeState.LOCKED, response.properties().storageTypeState()); - Assertions.assertEquals(true, response.properties().crossRegionRestoreFlag()); - Assertions.assertEquals(DedupState.ENABLED, response.properties().dedupState()); - Assertions.assertEquals(XcoolState.INVALID, response.properties().xcoolState()); - Assertions.assertEquals("wlpjfelqerppt", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsPatchWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsPatchWithResponseMockTests.java deleted file mode 100644 index d5f0e4d4151e9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsPatchWithResponseMockTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceConfigResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.DedupState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import com.azure.resourcemanager.recoveryservicesbackup.models.XcoolState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupResourceStorageConfigsNonCrrsPatchWithResponseMockTests { - @Test - public void testPatchWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 204, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.backupResourceStorageConfigsNonCrrs() - .patchWithResponse("r", "jb", - new BackupResourceConfigResourceInner().withLocation("v") - .withTags(mapOf("uliyslpkcv", "bwbqamt", "auxxepmyw", "w", "ijqpkzfbojxjmcs", "ormcqmic")) - .withProperties(new BackupResourceConfig().withStorageModelType(StorageType.ZONE_REDUNDANT) - .withStorageType(StorageType.LOCALLY_REDUNDANT) - .withStorageTypeState(StorageTypeState.LOCKED) - .withCrossRegionRestoreFlag(true) - .withDedupState(DedupState.ENABLED) - .withXcoolState(XcoolState.ENABLED)) - .withEtag("w"), - com.azure.core.util.Context.NONE); - - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsUpdateWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsUpdateWithResponseMockTests.java deleted file mode 100644 index cd6e42f5f5a8f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceStorageConfigsNonCrrsUpdateWithResponseMockTests.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceConfigResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceConfigResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.DedupState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import com.azure.resourcemanager.recoveryservicesbackup.models.XcoolState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupResourceStorageConfigsNonCrrsUpdateWithResponseMockTests { - @Test - public void testUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"storageModelType\":\"Invalid\",\"storageType\":\"Invalid\",\"storageTypeState\":\"Unlocked\",\"crossRegionRestoreFlag\":true,\"dedupState\":\"Enabled\",\"xcoolState\":\"Enabled\"},\"eTag\":\"qdurelyujlfyoum\",\"location\":\"ckyeclcdigpta\",\"tags\":{\"oclxiut\":\"zmqxucyci\"},\"id\":\"jc\",\"name\":\"z\",\"type\":\"zjd\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BackupResourceConfigResource response = manager.backupResourceStorageConfigsNonCrrs() - .updateWithResponse("byubhiqdxyurnpn", "hza", - new BackupResourceConfigResourceInner().withLocation("rkdlb") - .withTags(mapOf("hzlwxaea", "xvhcs", "ndsbdw", "vurex", "t", "aderzmw", "tmvmmagoaqylkjz", "pag")) - .withProperties(new BackupResourceConfig().withStorageModelType(StorageType.GEO_REDUNDANT) - .withStorageType(StorageType.LOCALLY_REDUNDANT) - .withStorageTypeState(StorageTypeState.INVALID) - .withCrossRegionRestoreFlag(false) - .withDedupState(DedupState.ENABLED) - .withXcoolState(XcoolState.DISABLED)) - .withEtag("gvxvatv"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ckyeclcdigpta", response.location()); - Assertions.assertEquals("zmqxucyci", response.tags().get("oclxiut")); - Assertions.assertEquals(StorageType.INVALID, response.properties().storageModelType()); - Assertions.assertEquals(StorageType.INVALID, response.properties().storageType()); - Assertions.assertEquals(StorageTypeState.UNLOCKED, response.properties().storageTypeState()); - Assertions.assertEquals(true, response.properties().crossRegionRestoreFlag()); - Assertions.assertEquals(DedupState.ENABLED, response.properties().dedupState()); - Assertions.assertEquals(XcoolState.ENABLED, response.properties().xcoolState()); - Assertions.assertEquals("qdurelyujlfyoum", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigResourceInnerTests.java deleted file mode 100644 index ff6a059f26d3e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigResourceInnerTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceVaultConfigResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.EnhancedSecurityState; -import com.azure.resourcemanager.recoveryservicesbackup.models.SoftDeleteFeatureState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BackupResourceVaultConfigResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupResourceVaultConfigResourceInner model = BinaryData.fromString( - "{\"properties\":{\"storageModelType\":\"Invalid\",\"storageType\":\"ReadAccessGeoZoneRedundant\",\"storageTypeState\":\"Invalid\",\"enhancedSecurityState\":\"Invalid\",\"softDeleteFeatureState\":\"AlwaysON\",\"softDeleteRetentionPeriodInDays\":1491222167,\"resourceGuardOperationRequests\":[\"zaqsqsycbkbfk\",\"ukdkexxppofmxa\",\"c\",\"jpgd\"],\"isSoftDeleteFeatureStateEditable\":true},\"eTag\":\"jjxhvpmo\",\"location\":\"exhd\",\"tags\":{\"jnxqbzvddntwn\":\"bqe\"},\"id\":\"eic\",\"name\":\"twnpzaoqvuhrhcf\",\"type\":\"cyddglmjthjqk\"}") - .toObject(BackupResourceVaultConfigResourceInner.class); - Assertions.assertEquals("exhd", model.location()); - Assertions.assertEquals("bqe", model.tags().get("jnxqbzvddntwn")); - Assertions.assertEquals(StorageType.INVALID, model.properties().storageModelType()); - Assertions.assertEquals(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT, model.properties().storageType()); - Assertions.assertEquals(StorageTypeState.INVALID, model.properties().storageTypeState()); - Assertions.assertEquals(EnhancedSecurityState.INVALID, model.properties().enhancedSecurityState()); - Assertions.assertEquals(SoftDeleteFeatureState.ALWAYS_ON, model.properties().softDeleteFeatureState()); - Assertions.assertEquals(1491222167, model.properties().softDeleteRetentionPeriodInDays()); - Assertions.assertEquals("zaqsqsycbkbfk", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, model.properties().isSoftDeleteFeatureStateEditable()); - Assertions.assertEquals("jjxhvpmo", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupResourceVaultConfigResourceInner model = new BackupResourceVaultConfigResourceInner().withLocation("exhd") - .withTags(mapOf("jnxqbzvddntwn", "bqe")) - .withProperties(new BackupResourceVaultConfig().withStorageModelType(StorageType.INVALID) - .withStorageType(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT) - .withStorageTypeState(StorageTypeState.INVALID) - .withEnhancedSecurityState(EnhancedSecurityState.INVALID) - .withSoftDeleteFeatureState(SoftDeleteFeatureState.ALWAYS_ON) - .withSoftDeleteRetentionPeriodInDays(1491222167) - .withResourceGuardOperationRequests(Arrays.asList("zaqsqsycbkbfk", "ukdkexxppofmxa", "c", "jpgd")) - .withIsSoftDeleteFeatureStateEditable(true)) - .withEtag("jjxhvpmo"); - model = BinaryData.fromObject(model).toObject(BackupResourceVaultConfigResourceInner.class); - Assertions.assertEquals("exhd", model.location()); - Assertions.assertEquals("bqe", model.tags().get("jnxqbzvddntwn")); - Assertions.assertEquals(StorageType.INVALID, model.properties().storageModelType()); - Assertions.assertEquals(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT, model.properties().storageType()); - Assertions.assertEquals(StorageTypeState.INVALID, model.properties().storageTypeState()); - Assertions.assertEquals(EnhancedSecurityState.INVALID, model.properties().enhancedSecurityState()); - Assertions.assertEquals(SoftDeleteFeatureState.ALWAYS_ON, model.properties().softDeleteFeatureState()); - Assertions.assertEquals(1491222167, model.properties().softDeleteRetentionPeriodInDays()); - Assertions.assertEquals("zaqsqsycbkbfk", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, model.properties().isSoftDeleteFeatureStateEditable()); - Assertions.assertEquals("jjxhvpmo", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigTests.java deleted file mode 100644 index 87c3d5430772e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.EnhancedSecurityState; -import com.azure.resourcemanager.recoveryservicesbackup.models.SoftDeleteFeatureState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class BackupResourceVaultConfigTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupResourceVaultConfig model = BinaryData.fromString( - "{\"storageModelType\":\"Invalid\",\"storageType\":\"ReadAccessGeoZoneRedundant\",\"storageTypeState\":\"Invalid\",\"enhancedSecurityState\":\"Invalid\",\"softDeleteFeatureState\":\"Enabled\",\"softDeleteRetentionPeriodInDays\":102046613,\"resourceGuardOperationRequests\":[\"khixuigdtopbo\"],\"isSoftDeleteFeatureStateEditable\":false}") - .toObject(BackupResourceVaultConfig.class); - Assertions.assertEquals(StorageType.INVALID, model.storageModelType()); - Assertions.assertEquals(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT, model.storageType()); - Assertions.assertEquals(StorageTypeState.INVALID, model.storageTypeState()); - Assertions.assertEquals(EnhancedSecurityState.INVALID, model.enhancedSecurityState()); - Assertions.assertEquals(SoftDeleteFeatureState.ENABLED, model.softDeleteFeatureState()); - Assertions.assertEquals(102046613, model.softDeleteRetentionPeriodInDays()); - Assertions.assertEquals("khixuigdtopbo", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isSoftDeleteFeatureStateEditable()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupResourceVaultConfig model = new BackupResourceVaultConfig().withStorageModelType(StorageType.INVALID) - .withStorageType(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT) - .withStorageTypeState(StorageTypeState.INVALID) - .withEnhancedSecurityState(EnhancedSecurityState.INVALID) - .withSoftDeleteFeatureState(SoftDeleteFeatureState.ENABLED) - .withSoftDeleteRetentionPeriodInDays(102046613) - .withResourceGuardOperationRequests(Arrays.asList("khixuigdtopbo")) - .withIsSoftDeleteFeatureStateEditable(false); - model = BinaryData.fromObject(model).toObject(BackupResourceVaultConfig.class); - Assertions.assertEquals(StorageType.INVALID, model.storageModelType()); - Assertions.assertEquals(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT, model.storageType()); - Assertions.assertEquals(StorageTypeState.INVALID, model.storageTypeState()); - Assertions.assertEquals(EnhancedSecurityState.INVALID, model.enhancedSecurityState()); - Assertions.assertEquals(SoftDeleteFeatureState.ENABLED, model.softDeleteFeatureState()); - Assertions.assertEquals(102046613, model.softDeleteRetentionPeriodInDays()); - Assertions.assertEquals("khixuigdtopbo", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isSoftDeleteFeatureStateEditable()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsGetWithResponseMockTests.java deleted file mode 100644 index 9cf1e7afcaae4..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsGetWithResponseMockTests.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfigResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.EnhancedSecurityState; -import com.azure.resourcemanager.recoveryservicesbackup.models.SoftDeleteFeatureState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupResourceVaultConfigsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"storageModelType\":\"GeoRedundant\",\"storageType\":\"Invalid\",\"storageTypeState\":\"Locked\",\"enhancedSecurityState\":\"Enabled\",\"softDeleteFeatureState\":\"AlwaysON\",\"softDeleteRetentionPeriodInDays\":171157881,\"resourceGuardOperationRequests\":[\"wuowhlxlnwy\",\"mouvbl\"],\"isSoftDeleteFeatureStateEditable\":false},\"eTag\":\"zkltrfowtdvrfmv\",\"location\":\"ih\",\"tags\":{\"jidhftu\":\"drqc\",\"bfqz\":\"vhdxlwyo\",\"xmbjroum\":\"kfnjyixhafrat\",\"l\":\"znv\"},\"id\":\"jrhuzgf\",\"name\":\"on\",\"type\":\"tpusllywp\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BackupResourceVaultConfigResource response = manager.backupResourceVaultConfigs() - .getWithResponse("d", "wrxwhydtl", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ih", response.location()); - Assertions.assertEquals("drqc", response.tags().get("jidhftu")); - Assertions.assertEquals(StorageType.GEO_REDUNDANT, response.properties().storageModelType()); - Assertions.assertEquals(StorageType.INVALID, response.properties().storageType()); - Assertions.assertEquals(StorageTypeState.LOCKED, response.properties().storageTypeState()); - Assertions.assertEquals(EnhancedSecurityState.ENABLED, response.properties().enhancedSecurityState()); - Assertions.assertEquals(SoftDeleteFeatureState.ALWAYS_ON, response.properties().softDeleteFeatureState()); - Assertions.assertEquals(171157881, response.properties().softDeleteRetentionPeriodInDays()); - Assertions.assertEquals("wuowhlxlnwy", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, response.properties().isSoftDeleteFeatureStateEditable()); - Assertions.assertEquals("zkltrfowtdvrfmv", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsPutWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsPutWithResponseMockTests.java deleted file mode 100644 index f7d2cb08b4636..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsPutWithResponseMockTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceVaultConfigResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfigResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.EnhancedSecurityState; -import com.azure.resourcemanager.recoveryservicesbackup.models.SoftDeleteFeatureState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupResourceVaultConfigsPutWithResponseMockTests { - @Test - public void testPutWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"storageModelType\":\"GeoRedundant\",\"storageType\":\"LocallyRedundant\",\"storageTypeState\":\"Invalid\",\"enhancedSecurityState\":\"Enabled\",\"softDeleteFeatureState\":\"Disabled\",\"softDeleteRetentionPeriodInDays\":1101568024,\"resourceGuardOperationRequests\":[\"rhcekxgnly\"],\"isSoftDeleteFeatureStateEditable\":true},\"eTag\":\"pwzvmdoksqdti\",\"location\":\"lwxlboncqbazq\",\"tags\":{\"ubdpkxyqvgxi\":\"chygtvxbyjane\",\"tvo\":\"od\"},\"id\":\"kxdxuwsaifmcwn\",\"name\":\"s\",\"type\":\"zlehgcvkbcknjolg\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BackupResourceVaultConfigResource response = manager.backupResourceVaultConfigs() - .putWithResponse("rxtd", "sn", new BackupResourceVaultConfigResourceInner().withLocation("e") - .withTags( - mapOf("chjhgemuowak", "ukaobrlbpgsnbag", "hjym", "wa", "rclsso", "cgqtag", "gjco", "jomevtfycnlb")) - .withProperties( - new BackupResourceVaultConfig().withStorageModelType(StorageType.READ_ACCESS_GEO_ZONE_REDUNDANT) - .withStorageType(StorageType.GEO_REDUNDANT) - .withStorageTypeState(StorageTypeState.UNLOCKED) - .withEnhancedSecurityState(EnhancedSecurityState.DISABLED) - .withSoftDeleteFeatureState(SoftDeleteFeatureState.ENABLED) - .withSoftDeleteRetentionPeriodInDays(1455894662) - .withResourceGuardOperationRequests(Arrays.asList("wwtjfdoesxxhmwc", "bckyoikxk", "hnegknj")) - .withIsSoftDeleteFeatureStateEditable(true)) - .withEtag("t"), com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("lwxlboncqbazq", response.location()); - Assertions.assertEquals("chygtvxbyjane", response.tags().get("ubdpkxyqvgxi")); - Assertions.assertEquals(StorageType.GEO_REDUNDANT, response.properties().storageModelType()); - Assertions.assertEquals(StorageType.LOCALLY_REDUNDANT, response.properties().storageType()); - Assertions.assertEquals(StorageTypeState.INVALID, response.properties().storageTypeState()); - Assertions.assertEquals(EnhancedSecurityState.ENABLED, response.properties().enhancedSecurityState()); - Assertions.assertEquals(SoftDeleteFeatureState.DISABLED, response.properties().softDeleteFeatureState()); - Assertions.assertEquals(1101568024, response.properties().softDeleteRetentionPeriodInDays()); - Assertions.assertEquals("rhcekxgnly", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, response.properties().isSoftDeleteFeatureStateEditable()); - Assertions.assertEquals("pwzvmdoksqdti", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsUpdateWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsUpdateWithResponseMockTests.java deleted file mode 100644 index 6c765b58addd9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupResourceVaultConfigsUpdateWithResponseMockTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.BackupResourceVaultConfigResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfig; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupResourceVaultConfigResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.EnhancedSecurityState; -import com.azure.resourcemanager.recoveryservicesbackup.models.SoftDeleteFeatureState; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageType; -import com.azure.resourcemanager.recoveryservicesbackup.models.StorageTypeState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupResourceVaultConfigsUpdateWithResponseMockTests { - @Test - public void testUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"storageModelType\":\"Invalid\",\"storageType\":\"Invalid\",\"storageTypeState\":\"Unlocked\",\"enhancedSecurityState\":\"Invalid\",\"softDeleteFeatureState\":\"Disabled\",\"softDeleteRetentionPeriodInDays\":1413939702,\"resourceGuardOperationRequests\":[\"cpxdazvd\",\"ctmmkoszudbl\",\"s\"],\"isSoftDeleteFeatureStateEditable\":true},\"eTag\":\"caqkiofk\",\"location\":\"tfmhklbnldpvcb\",\"tags\":{\"usqxutrpbrr\":\"zyqu\",\"lbnwtpcpahp\":\"yuuatvlmbjwcolbm\"},\"id\":\"z\",\"name\":\"vxhmtfhocnxzcmj\",\"type\":\"ngxno\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BackupResourceVaultConfigResource response = manager.backupResourceVaultConfigs() - .updateWithResponse("tiotzb", "d", - new BackupResourceVaultConfigResourceInner().withLocation("koswoqiqazugamxz") - .withTags(mapOf("u", "coiisbamnppcce", "f", "tdsbezax")) - .withProperties(new BackupResourceVaultConfig().withStorageModelType(StorageType.ZONE_REDUNDANT) - .withStorageType(StorageType.ZONE_REDUNDANT) - .withStorageTypeState(StorageTypeState.LOCKED) - .withEnhancedSecurityState(EnhancedSecurityState.DISABLED) - .withSoftDeleteFeatureState(SoftDeleteFeatureState.DISABLED) - .withSoftDeleteRetentionPeriodInDays(66656756) - .withResourceGuardOperationRequests(Arrays.asList("owsocnequygdjbo", "grmtqjk", "evadrmmwiu")) - .withIsSoftDeleteFeatureStateEditable(true)) - .withEtag("mjzkxiidiscz"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("tfmhklbnldpvcb", response.location()); - Assertions.assertEquals("zyqu", response.tags().get("usqxutrpbrr")); - Assertions.assertEquals(StorageType.INVALID, response.properties().storageModelType()); - Assertions.assertEquals(StorageType.INVALID, response.properties().storageType()); - Assertions.assertEquals(StorageTypeState.UNLOCKED, response.properties().storageTypeState()); - Assertions.assertEquals(EnhancedSecurityState.INVALID, response.properties().enhancedSecurityState()); - Assertions.assertEquals(SoftDeleteFeatureState.DISABLED, response.properties().softDeleteFeatureState()); - Assertions.assertEquals(1413939702, response.properties().softDeleteRetentionPeriodInDays()); - Assertions.assertEquals("cpxdazvd", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, response.properties().isSoftDeleteFeatureStateEditable()); - Assertions.assertEquals("caqkiofk", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupStatusRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupStatusRequestTests.java deleted file mode 100644 index ac0f6f61d73e4..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupStatusRequestTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupStatusRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType; -import org.junit.jupiter.api.Assertions; - -public final class BackupStatusRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BackupStatusRequest model - = BinaryData.fromString("{\"resourceType\":\"VM\",\"resourceId\":\"dkfo\",\"poLogicalName\":\"nygj\"}") - .toObject(BackupStatusRequest.class); - Assertions.assertEquals(DataSourceType.VM, model.resourceType()); - Assertions.assertEquals("dkfo", model.resourceId()); - Assertions.assertEquals("nygj", model.poLogicalName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BackupStatusRequest model = new BackupStatusRequest().withResourceType(DataSourceType.VM) - .withResourceId("dkfo") - .withPoLogicalName("nygj"); - model = BinaryData.fromObject(model).toObject(BackupStatusRequest.class); - Assertions.assertEquals(DataSourceType.VM, model.resourceType()); - Assertions.assertEquals("dkfo", model.resourceId()); - Assertions.assertEquals("nygj", model.poLogicalName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupUsageSummariesListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupUsageSummariesListMockTests.java deleted file mode 100644 index 8427b19cb9931..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupUsageSummariesListMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementUsage; -import com.azure.resourcemanager.recoveryservicesbackup.models.UsagesUnit; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupUsageSummariesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"unit\":\"CountPerSecond\",\"quotaPeriod\":\"gijiitnspxlzd\",\"nextResetTime\":\"2021-08-31T17:26:18Z\",\"currentValue\":6495524474457353023,\"limit\":303813991586774149,\"name\":{\"value\":\"fanraybfu\",\"localizedValue\":\"frojsydgr\"}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.backupUsageSummaries().list("ewres", "moweg", "mut", "yxey", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(UsagesUnit.COUNT_PER_SECOND, response.iterator().next().unit()); - Assertions.assertEquals("gijiitnspxlzd", response.iterator().next().quotaPeriod()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-31T17:26:18Z"), - response.iterator().next().nextResetTime()); - Assertions.assertEquals(6495524474457353023L, response.iterator().next().currentValue()); - Assertions.assertEquals(303813991586774149L, response.iterator().next().limit()); - Assertions.assertEquals("fanraybfu", response.iterator().next().name().value()); - Assertions.assertEquals("frojsydgr", response.iterator().next().name().localizedValue()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupWorkloadItemsListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupWorkloadItemsListMockTests.java deleted file mode 100644 index a23b3dedf0469..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupWorkloadItemsListMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItemResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupWorkloadItemsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"workloadItemType\":\"WorkloadItem\",\"backupManagementType\":\"srwrsnrhpqati\",\"workloadType\":\"kvyanxkvvc\",\"friendlyName\":\"msvuvdjkqxetq\",\"protectionState\":\"ProtectionFailed\"},\"eTag\":\"vrjjxnw\",\"location\":\"dchpojxlehzl\",\"tags\":{\"cerwkwbpjxljtxbu\":\"fquwzpwiibel\",\"bdgzpagsecnad\":\"qtbxxniuisdzh\"},\"id\":\"u\",\"name\":\"qrgxf\",\"type\":\"lmqiynezoel\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.backupWorkloadItems() - .list("rulfuct", "jrthcfjzhx", "yubqjr", "stvrjeqmt", "zbeqrztrxa", "xrd", - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("dchpojxlehzl", response.iterator().next().location()); - Assertions.assertEquals("fquwzpwiibel", response.iterator().next().tags().get("cerwkwbpjxljtxbu")); - Assertions.assertEquals("srwrsnrhpqati", response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("kvyanxkvvc", response.iterator().next().properties().workloadType()); - Assertions.assertEquals("msvuvdjkqxetq", response.iterator().next().properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, - response.iterator().next().properties().protectionState()); - Assertions.assertEquals("vrjjxnw", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupsTriggerWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupsTriggerWithResponseMockTests.java deleted file mode 100644 index f4f17866f8eae..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BackupsTriggerWithResponseMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupRequestResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BackupsTriggerWithResponseMockTests { - @Test - public void testTriggerWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.backups() - .triggerWithResponse("ayfluiyuosnu", "dtelvhyibdrqrs", "hbuubpy", "owtjo", "ztfwfqchvcz", - new BackupRequestResource().withLocation("qpemh") - .withTags( - mapOf("xqabckmzeoxi", "krepdqhqyhwqwem", "pceeznzangprbf", "hgreohtwhlpuz", "bcip", "xyxz")) - .withProperties(new BackupRequest()) - .withEtag("nnctagfyvrt"), - com.azure.core.util.Context.NONE); - - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BmsPrepareDataMoveOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BmsPrepareDataMoveOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index b11950766df3e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/BmsPrepareDataMoveOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultStorageConfigOperationResultResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BmsPrepareDataMoveOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr = "{\"objectType\":\"VaultStorageConfigOperationResultResponse\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - VaultStorageConfigOperationResultResponse response = manager.bmsPrepareDataMoveOperationResults() - .getWithResponse("jkgv", "nmx", "ursqf", com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryDisplayTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryDisplayTests.java deleted file mode 100644 index aecb58c197fa4..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryDisplayTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryDisplay; -import org.junit.jupiter.api.Assertions; - -public final class ClientDiscoveryDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientDiscoveryDisplay model = BinaryData.fromString( - "{\"provider\":\"srp\",\"resource\":\"zidnsezcxtbzsgfy\",\"operation\":\"sne\",\"description\":\"dwzjeiach\"}") - .toObject(ClientDiscoveryDisplay.class); - Assertions.assertEquals("srp", model.provider()); - Assertions.assertEquals("zidnsezcxtbzsgfy", model.resource()); - Assertions.assertEquals("sne", model.operation()); - Assertions.assertEquals("dwzjeiach", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientDiscoveryDisplay model = new ClientDiscoveryDisplay().withProvider("srp") - .withResource("zidnsezcxtbzsgfy") - .withOperation("sne") - .withDescription("dwzjeiach"); - model = BinaryData.fromObject(model).toObject(ClientDiscoveryDisplay.class); - Assertions.assertEquals("srp", model.provider()); - Assertions.assertEquals("zidnsezcxtbzsgfy", model.resource()); - Assertions.assertEquals("sne", model.operation()); - Assertions.assertEquals("dwzjeiach", model.description()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForLogSpecificationTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForLogSpecificationTests.java deleted file mode 100644 index 79a444aa70839..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForLogSpecificationTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForLogSpecification; -import org.junit.jupiter.api.Assertions; - -public final class ClientDiscoveryForLogSpecificationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientDiscoveryForLogSpecification model - = BinaryData.fromString("{\"name\":\"mexgstxgcp\",\"displayName\":\"gmaajrm\",\"blobDuration\":\"jwzrl\"}") - .toObject(ClientDiscoveryForLogSpecification.class); - Assertions.assertEquals("mexgstxgcp", model.name()); - Assertions.assertEquals("gmaajrm", model.displayName()); - Assertions.assertEquals("jwzrl", model.blobDuration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientDiscoveryForLogSpecification model = new ClientDiscoveryForLogSpecification().withName("mexgstxgcp") - .withDisplayName("gmaajrm") - .withBlobDuration("jwzrl"); - model = BinaryData.fromObject(model).toObject(ClientDiscoveryForLogSpecification.class); - Assertions.assertEquals("mexgstxgcp", model.name()); - Assertions.assertEquals("gmaajrm", model.displayName()); - Assertions.assertEquals("jwzrl", model.blobDuration()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForPropertiesTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForPropertiesTests.java deleted file mode 100644 index a5de4eabc45a2..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForPropertiesTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForLogSpecification; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForServiceSpecification; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ClientDiscoveryForPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientDiscoveryForProperties model = BinaryData.fromString( - "{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"lnrosfqp\",\"displayName\":\"ehzzvypyqrim\",\"blobDuration\":\"npvswjdkirso\"},{\"name\":\"qxhcrmn\",\"displayName\":\"jtckwhdso\",\"blobDuration\":\"iy\"},{\"name\":\"jxsqwpgrjbz\",\"displayName\":\"rcjxvsnbyxqabn\",\"blobDuration\":\"cpc\"}]}}") - .toObject(ClientDiscoveryForProperties.class); - Assertions.assertEquals("lnrosfqp", model.serviceSpecification().logSpecifications().get(0).name()); - Assertions.assertEquals("ehzzvypyqrim", model.serviceSpecification().logSpecifications().get(0).displayName()); - Assertions.assertEquals("npvswjdkirso", model.serviceSpecification().logSpecifications().get(0).blobDuration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientDiscoveryForProperties model = new ClientDiscoveryForProperties() - .withServiceSpecification(new ClientDiscoveryForServiceSpecification().withLogSpecifications(Arrays.asList( - new ClientDiscoveryForLogSpecification().withName("lnrosfqp") - .withDisplayName("ehzzvypyqrim") - .withBlobDuration("npvswjdkirso"), - new ClientDiscoveryForLogSpecification().withName("qxhcrmn") - .withDisplayName("jtckwhdso") - .withBlobDuration("iy"), - new ClientDiscoveryForLogSpecification().withName("jxsqwpgrjbz") - .withDisplayName("rcjxvsnbyxqabn") - .withBlobDuration("cpc")))); - model = BinaryData.fromObject(model).toObject(ClientDiscoveryForProperties.class); - Assertions.assertEquals("lnrosfqp", model.serviceSpecification().logSpecifications().get(0).name()); - Assertions.assertEquals("ehzzvypyqrim", model.serviceSpecification().logSpecifications().get(0).displayName()); - Assertions.assertEquals("npvswjdkirso", model.serviceSpecification().logSpecifications().get(0).blobDuration()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForServiceSpecificationTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForServiceSpecificationTests.java deleted file mode 100644 index 9afd9c680ff1f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryForServiceSpecificationTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForLogSpecification; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForServiceSpecification; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ClientDiscoveryForServiceSpecificationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientDiscoveryForServiceSpecification model = BinaryData.fromString( - "{\"logSpecifications\":[{\"name\":\"rzafbljjgpbtoqcj\",\"displayName\":\"ljavbqid\",\"blobDuration\":\"ajzyul\"},{\"name\":\"u\",\"displayName\":\"krlkhbzhfepg\",\"blobDuration\":\"qex\"},{\"name\":\"ocxscpaierhhbcs\",\"displayName\":\"ummajtjaod\",\"blobDuration\":\"bnbdxkqpxokajion\"}]}") - .toObject(ClientDiscoveryForServiceSpecification.class); - Assertions.assertEquals("rzafbljjgpbtoqcj", model.logSpecifications().get(0).name()); - Assertions.assertEquals("ljavbqid", model.logSpecifications().get(0).displayName()); - Assertions.assertEquals("ajzyul", model.logSpecifications().get(0).blobDuration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientDiscoveryForServiceSpecification model - = new ClientDiscoveryForServiceSpecification().withLogSpecifications(Arrays.asList( - new ClientDiscoveryForLogSpecification().withName("rzafbljjgpbtoqcj") - .withDisplayName("ljavbqid") - .withBlobDuration("ajzyul"), - new ClientDiscoveryForLogSpecification().withName("u") - .withDisplayName("krlkhbzhfepg") - .withBlobDuration("qex"), - new ClientDiscoveryForLogSpecification().withName("ocxscpaierhhbcs") - .withDisplayName("ummajtjaod") - .withBlobDuration("bnbdxkqpxokajion"))); - model = BinaryData.fromObject(model).toObject(ClientDiscoveryForServiceSpecification.class); - Assertions.assertEquals("rzafbljjgpbtoqcj", model.logSpecifications().get(0).name()); - Assertions.assertEquals("ljavbqid", model.logSpecifications().get(0).displayName()); - Assertions.assertEquals("ajzyul", model.logSpecifications().get(0).blobDuration()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryResponseTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryResponseTests.java deleted file mode 100644 index 06c6fb049dfee..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryResponseTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ClientDiscoveryValueForSingleApiInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryDisplay; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForLogSpecification; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForServiceSpecification; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryResponse; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ClientDiscoveryResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientDiscoveryResponse model = BinaryData.fromString( - "{\"value\":[{\"name\":\"cph\",\"display\":{\"provider\":\"ot\",\"resource\":\"qgoulznd\",\"operation\":\"kwy\",\"description\":\"gfgibm\"},\"origin\":\"gakeqsr\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{},{},{},{}]}}},{\"name\":\"e\",\"display\":{\"provider\":\"tbciqfouflmm\",\"resource\":\"zsm\",\"operation\":\"mglougpbkw\",\"description\":\"utduqktapspwgcu\"},\"origin\":\"tumkdosvqwhbm\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{},{},{}]}}},{\"name\":\"ddgmb\",\"display\":{\"provider\":\"xppbhtqqro\",\"resource\":\"p\",\"operation\":\"s\",\"description\":\"gbquxigj\"},\"origin\":\"gzjaoyfhrtxilne\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{},{},{}]}}}],\"nextLink\":\"vlejuvfqa\"}") - .toObject(ClientDiscoveryResponse.class); - Assertions.assertEquals("cph", model.value().get(0).name()); - Assertions.assertEquals("ot", model.value().get(0).display().provider()); - Assertions.assertEquals("qgoulznd", model.value().get(0).display().resource()); - Assertions.assertEquals("kwy", model.value().get(0).display().operation()); - Assertions.assertEquals("gfgibm", model.value().get(0).display().description()); - Assertions.assertEquals("gakeqsr", model.value().get(0).origin()); - Assertions.assertEquals("vlejuvfqa", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientDiscoveryResponse model = new ClientDiscoveryResponse() - .withValue(Arrays - .asList( - new ClientDiscoveryValueForSingleApiInner() - .withName("cph") - .withDisplay(new ClientDiscoveryDisplay().withProvider("ot") - .withResource("qgoulznd") - .withOperation("kwy") - .withDescription("gfgibm")) - .withOrigin("gakeqsr") - .withProperties(new ClientDiscoveryForProperties() - .withServiceSpecification(new ClientDiscoveryForServiceSpecification() - .withLogSpecifications(Arrays.asList(new ClientDiscoveryForLogSpecification(), - new ClientDiscoveryForLogSpecification(), new ClientDiscoveryForLogSpecification(), - new ClientDiscoveryForLogSpecification())))), - new ClientDiscoveryValueForSingleApiInner().withName("e") - .withDisplay(new ClientDiscoveryDisplay().withProvider("tbciqfouflmm") - .withResource("zsm") - .withOperation("mglougpbkw") - .withDescription("utduqktapspwgcu")) - .withOrigin("tumkdosvqwhbm") - .withProperties(new ClientDiscoveryForProperties() - .withServiceSpecification(new ClientDiscoveryForServiceSpecification() - .withLogSpecifications(Arrays.asList(new ClientDiscoveryForLogSpecification(), - new ClientDiscoveryForLogSpecification(), - new ClientDiscoveryForLogSpecification())))), - new ClientDiscoveryValueForSingleApiInner().withName("ddgmb") - .withDisplay(new ClientDiscoveryDisplay().withProvider("xppbhtqqro") - .withResource("p") - .withOperation("s") - .withDescription("gbquxigj")) - .withOrigin("gzjaoyfhrtxilne") - .withProperties(new ClientDiscoveryForProperties().withServiceSpecification( - new ClientDiscoveryForServiceSpecification().withLogSpecifications(Arrays.asList( - new ClientDiscoveryForLogSpecification(), new ClientDiscoveryForLogSpecification(), - new ClientDiscoveryForLogSpecification())))))) - .withNextLink("vlejuvfqa"); - model = BinaryData.fromObject(model).toObject(ClientDiscoveryResponse.class); - Assertions.assertEquals("cph", model.value().get(0).name()); - Assertions.assertEquals("ot", model.value().get(0).display().provider()); - Assertions.assertEquals("qgoulznd", model.value().get(0).display().resource()); - Assertions.assertEquals("kwy", model.value().get(0).display().operation()); - Assertions.assertEquals("gfgibm", model.value().get(0).display().description()); - Assertions.assertEquals("gakeqsr", model.value().get(0).origin()); - Assertions.assertEquals("vlejuvfqa", model.nextLink()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryValueForSingleApiInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryValueForSingleApiInnerTests.java deleted file mode 100644 index 94baf0672b06d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientDiscoveryValueForSingleApiInnerTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ClientDiscoveryValueForSingleApiInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryDisplay; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForLogSpecification; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryForServiceSpecification; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ClientDiscoveryValueForSingleApiInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientDiscoveryValueForSingleApiInner model = BinaryData.fromString( - "{\"name\":\"lyxwjkcprbnwbx\",\"display\":{\"provider\":\"tbvpysszdnru\",\"resource\":\"guhmuouqfpr\",\"operation\":\"wbnguitnwui\",\"description\":\"a\"},\"origin\":\"ufizuckyf\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"fvzwdzuhty\",\"displayName\":\"isdkfthwxmnteiw\",\"blobDuration\":\"pvkmijcmmxdcuf\"}]}}}") - .toObject(ClientDiscoveryValueForSingleApiInner.class); - Assertions.assertEquals("lyxwjkcprbnwbx", model.name()); - Assertions.assertEquals("tbvpysszdnru", model.display().provider()); - Assertions.assertEquals("guhmuouqfpr", model.display().resource()); - Assertions.assertEquals("wbnguitnwui", model.display().operation()); - Assertions.assertEquals("a", model.display().description()); - Assertions.assertEquals("ufizuckyf", model.origin()); - Assertions.assertEquals("fvzwdzuhty", - model.properties().serviceSpecification().logSpecifications().get(0).name()); - Assertions.assertEquals("isdkfthwxmnteiw", - model.properties().serviceSpecification().logSpecifications().get(0).displayName()); - Assertions.assertEquals("pvkmijcmmxdcuf", - model.properties().serviceSpecification().logSpecifications().get(0).blobDuration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientDiscoveryValueForSingleApiInner model - = new ClientDiscoveryValueForSingleApiInner().withName("lyxwjkcprbnwbx") - .withDisplay(new ClientDiscoveryDisplay().withProvider("tbvpysszdnru") - .withResource("guhmuouqfpr") - .withOperation("wbnguitnwui") - .withDescription("a")) - .withOrigin("ufizuckyf") - .withProperties(new ClientDiscoveryForProperties() - .withServiceSpecification(new ClientDiscoveryForServiceSpecification().withLogSpecifications( - Arrays.asList(new ClientDiscoveryForLogSpecification().withName("fvzwdzuhty") - .withDisplayName("isdkfthwxmnteiw") - .withBlobDuration("pvkmijcmmxdcuf"))))); - model = BinaryData.fromObject(model).toObject(ClientDiscoveryValueForSingleApiInner.class); - Assertions.assertEquals("lyxwjkcprbnwbx", model.name()); - Assertions.assertEquals("tbvpysszdnru", model.display().provider()); - Assertions.assertEquals("guhmuouqfpr", model.display().resource()); - Assertions.assertEquals("wbnguitnwui", model.display().operation()); - Assertions.assertEquals("a", model.display().description()); - Assertions.assertEquals("ufizuckyf", model.origin()); - Assertions.assertEquals("fvzwdzuhty", - model.properties().serviceSpecification().logSpecifications().get(0).name()); - Assertions.assertEquals("isdkfthwxmnteiw", - model.properties().serviceSpecification().logSpecifications().get(0).displayName()); - Assertions.assertEquals("pvkmijcmmxdcuf", - model.properties().serviceSpecification().logSpecifications().get(0).blobDuration()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientScriptForConnectTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientScriptForConnectTests.java deleted file mode 100644 index 0d6419c465ac6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ClientScriptForConnectTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientScriptForConnect; -import org.junit.jupiter.api.Assertions; - -public final class ClientScriptForConnectTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientScriptForConnect model = BinaryData.fromString( - "{\"scriptContent\":\"qkkyihztgeqmg\",\"scriptExtension\":\"gwldo\",\"osType\":\"hillce\",\"url\":\"ehuwaoa\",\"scriptNameSuffix\":\"h\"}") - .toObject(ClientScriptForConnect.class); - Assertions.assertEquals("qkkyihztgeqmg", model.scriptContent()); - Assertions.assertEquals("gwldo", model.scriptExtension()); - Assertions.assertEquals("hillce", model.osType()); - Assertions.assertEquals("ehuwaoa", model.url()); - Assertions.assertEquals("h", model.scriptNameSuffix()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientScriptForConnect model = new ClientScriptForConnect().withScriptContent("qkkyihztgeqmg") - .withScriptExtension("gwldo") - .withOsType("hillce") - .withUrl("ehuwaoa") - .withScriptNameSuffix("h"); - model = BinaryData.fromObject(model).toObject(ClientScriptForConnect.class); - Assertions.assertEquals("qkkyihztgeqmg", model.scriptContent()); - Assertions.assertEquals("gwldo", model.scriptExtension()); - Assertions.assertEquals("hillce", model.osType()); - Assertions.assertEquals("ehuwaoa", model.url()); - Assertions.assertEquals("h", model.scriptNameSuffix()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ContainerIdentityInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ContainerIdentityInfoTests.java deleted file mode 100644 index ff409b452cae7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ContainerIdentityInfoTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ContainerIdentityInfo; -import org.junit.jupiter.api.Assertions; - -public final class ContainerIdentityInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ContainerIdentityInfo model = BinaryData.fromString( - "{\"uniqueName\":\"qllizstac\",\"aadTenantId\":\"vhrweftkwqejpmv\",\"servicePrincipalClientId\":\"ehaepwamcxtc\",\"audience\":\"upeuknijduyye\"}") - .toObject(ContainerIdentityInfo.class); - Assertions.assertEquals("qllizstac", model.uniqueName()); - Assertions.assertEquals("vhrweftkwqejpmv", model.aadTenantId()); - Assertions.assertEquals("ehaepwamcxtc", model.servicePrincipalClientId()); - Assertions.assertEquals("upeuknijduyye", model.audience()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ContainerIdentityInfo model = new ContainerIdentityInfo().withUniqueName("qllizstac") - .withAadTenantId("vhrweftkwqejpmv") - .withServicePrincipalClientId("ehaepwamcxtc") - .withAudience("upeuknijduyye"); - model = BinaryData.fromObject(model).toObject(ContainerIdentityInfo.class); - Assertions.assertEquals("qllizstac", model.uniqueName()); - Assertions.assertEquals("vhrweftkwqejpmv", model.aadTenantId()); - Assertions.assertEquals("ehaepwamcxtc", model.servicePrincipalClientId()); - Assertions.assertEquals("upeuknijduyye", model.audience()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyRetentionFormatTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyRetentionFormatTests.java deleted file mode 100644 index 852951c10b647..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyRetentionFormatTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.Day; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DailyRetentionFormatTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DailyRetentionFormat model = BinaryData - .fromString( - "{\"daysOfTheMonth\":[{\"date\":1173398556,\"isLast\":true},{\"date\":433399705,\"isLast\":false}]}") - .toObject(DailyRetentionFormat.class); - Assertions.assertEquals(1173398556, model.daysOfTheMonth().get(0).date()); - Assertions.assertEquals(true, model.daysOfTheMonth().get(0).isLast()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DailyRetentionFormat model = new DailyRetentionFormat().withDaysOfTheMonth(Arrays - .asList(new Day().withDate(1173398556).withIsLast(true), new Day().withDate(433399705).withIsLast(false))); - model = BinaryData.fromObject(model).toObject(DailyRetentionFormat.class); - Assertions.assertEquals(1173398556, model.daysOfTheMonth().get(0).date()); - Assertions.assertEquals(true, model.daysOfTheMonth().get(0).isLast()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyRetentionScheduleTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyRetentionScheduleTests.java deleted file mode 100644 index 7bad3cfcafc99..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyRetentionScheduleTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionSchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DailyRetentionScheduleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DailyRetentionSchedule model = BinaryData.fromString( - "{\"retentionTimes\":[\"2021-08-08T18:46:08Z\",\"2021-03-16T15:49:25Z\",\"2021-08-22T14:03:47Z\"],\"retentionDuration\":{\"count\":743676437,\"durationType\":\"Weeks\"}}") - .toObject(DailyRetentionSchedule.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-08T18:46:08Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(743676437, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.retentionDuration().durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DailyRetentionSchedule model = new DailyRetentionSchedule() - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-08-08T18:46:08Z"), - OffsetDateTime.parse("2021-03-16T15:49:25Z"), OffsetDateTime.parse("2021-08-22T14:03:47Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(743676437).withDurationType(RetentionDurationType.WEEKS)); - model = BinaryData.fromObject(model).toObject(DailyRetentionSchedule.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-08T18:46:08Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(743676437, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.retentionDuration().durationType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyScheduleTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyScheduleTests.java deleted file mode 100644 index 389c19ad1370e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DailyScheduleTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailySchedule; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DailyScheduleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DailySchedule model = BinaryData - .fromString( - "{\"scheduleRunTimes\":[\"2021-05-24T05:56:39Z\",\"2021-06-12T21:55:21Z\",\"2021-01-21T17:56:30Z\"]}") - .toObject(DailySchedule.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-24T05:56:39Z"), model.scheduleRunTimes().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DailySchedule model - = new DailySchedule().withScheduleRunTimes(Arrays.asList(OffsetDateTime.parse("2021-05-24T05:56:39Z"), - OffsetDateTime.parse("2021-06-12T21:55:21Z"), OffsetDateTime.parse("2021-01-21T17:56:30Z"))); - model = BinaryData.fromObject(model).toObject(DailySchedule.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-24T05:56:39Z"), model.scheduleRunTimes().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DayTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DayTests.java deleted file mode 100644 index b78f2b952b1b6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DayTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.Day; -import org.junit.jupiter.api.Assertions; - -public final class DayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Day model = BinaryData.fromString("{\"date\":2124653269,\"isLast\":true}").toObject(Day.class); - Assertions.assertEquals(2124653269, model.date()); - Assertions.assertEquals(true, model.isLast()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Day model = new Day().withDate(2124653269).withIsLast(true); - model = BinaryData.fromObject(model).toObject(Day.class); - Assertions.assertEquals(2124653269, model.date()); - Assertions.assertEquals(true, model.isLast()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DeletedProtectionContainersListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DeletedProtectionContainersListMockTests.java deleted file mode 100644 index c2884cafcf35c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DeletedProtectionContainersListMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DeletedProtectionContainersListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"pjhgejkb\",\"backupManagementType\":\"AzureStorage\",\"registrationStatus\":\"aurghooxa\",\"healthStatus\":\"bkhxj\",\"protectableObjectType\":\"oez\"},\"eTag\":\"xrkdknkobektm\",\"location\":\"o\",\"tags\":{\"cdgzseznux\":\"tzamicbig\"},\"id\":\"euairaabmdlqjb\",\"name\":\"dp\",\"type\":\"ixlhupm\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.deletedProtectionContainers().list("ycqsxr", "d", "ewuyqa", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("o", response.iterator().next().location()); - Assertions.assertEquals("tzamicbig", response.iterator().next().tags().get("cdgzseznux")); - Assertions.assertEquals("pjhgejkb", response.iterator().next().properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, - response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("aurghooxa", response.iterator().next().properties().registrationStatus()); - Assertions.assertEquals("bkhxj", response.iterator().next().properties().healthStatus()); - Assertions.assertEquals("oez", response.iterator().next().properties().protectableObjectType()); - Assertions.assertEquals("xrkdknkobektm", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DiskExclusionPropertiesTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DiskExclusionPropertiesTests.java deleted file mode 100644 index 4b864329d081f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DiskExclusionPropertiesTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DiskExclusionProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DiskExclusionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DiskExclusionProperties model - = BinaryData.fromString("{\"diskLunList\":[1917702529,1138704794],\"isInclusionList\":false}") - .toObject(DiskExclusionProperties.class); - Assertions.assertEquals(1917702529, model.diskLunList().get(0)); - Assertions.assertEquals(false, model.isInclusionList()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DiskExclusionProperties model - = new DiskExclusionProperties().withDiskLunList(Arrays.asList(1917702529, 1138704794)) - .withIsInclusionList(false); - model = BinaryData.fromObject(model).toObject(DiskExclusionProperties.class); - Assertions.assertEquals(1917702529, model.diskLunList().get(0)); - Assertions.assertEquals(false, model.isInclusionList()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DiskInformationTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DiskInformationTests.java deleted file mode 100644 index 1ca5a8a4c3be4..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DiskInformationTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DiskInformation; -import org.junit.jupiter.api.Assertions; - -public final class DiskInformationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DiskInformation model - = BinaryData.fromString("{\"lun\":262075273,\"name\":\"elfwy\"}").toObject(DiskInformation.class); - Assertions.assertEquals(262075273, model.lun()); - Assertions.assertEquals("elfwy", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DiskInformation model = new DiskInformation().withLun(262075273).withName("elfwy"); - model = BinaryData.fromObject(model).toObject(DiskInformation.class); - Assertions.assertEquals(262075273, model.lun()); - Assertions.assertEquals("elfwy", model.name()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmBackupEngineTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmBackupEngineTests.java deleted file mode 100644 index 749bcdba365ef..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmBackupEngineTests.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupEngineExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmBackupEngine; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class DpmBackupEngineTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmBackupEngine model = BinaryData.fromString( - "{\"backupEngineType\":\"DpmBackupEngine\",\"friendlyName\":\"ydjfb\",\"backupManagementType\":\"AzureBackupServer\",\"registrationStatus\":\"hhulrtywikdm\",\"backupEngineState\":\"akuflgbhgauacdix\",\"healthStatus\":\"ufr\",\"canReRegister\":false,\"backupEngineId\":\"qg\",\"dpmVersion\":\"fnozoeoqbvjh\",\"azureBackupAgentVersion\":\"f\",\"isAzureBackupAgentUpgradeAvailable\":false,\"isDpmUpgradeAvailable\":false,\"extendedInfo\":{\"databaseName\":\"hntasfaymx\",\"protectedItemsCount\":2018726025,\"protectedServersCount\":529745015,\"diskCount\":1379725969,\"usedDiskSpace\":4.6356914864929655,\"availableDiskSpace\":54.77226942032251,\"refreshedAt\":\"2021-01-29T15:00:54Z\",\"azureProtectedInstances\":1976793148}}") - .toObject(DpmBackupEngine.class); - Assertions.assertEquals("ydjfb", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, model.backupManagementType()); - Assertions.assertEquals("hhulrtywikdm", model.registrationStatus()); - Assertions.assertEquals("akuflgbhgauacdix", model.backupEngineState()); - Assertions.assertEquals("ufr", model.healthStatus()); - Assertions.assertEquals(false, model.canReRegister()); - Assertions.assertEquals("qg", model.backupEngineId()); - Assertions.assertEquals("fnozoeoqbvjh", model.dpmVersion()); - Assertions.assertEquals("f", model.azureBackupAgentVersion()); - Assertions.assertEquals(false, model.isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(false, model.isDpmUpgradeAvailable()); - Assertions.assertEquals("hntasfaymx", model.extendedInfo().databaseName()); - Assertions.assertEquals(2018726025, model.extendedInfo().protectedItemsCount()); - Assertions.assertEquals(529745015, model.extendedInfo().protectedServersCount()); - Assertions.assertEquals(1379725969, model.extendedInfo().diskCount()); - Assertions.assertEquals(4.6356914864929655D, model.extendedInfo().usedDiskSpace()); - Assertions.assertEquals(54.77226942032251D, model.extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-29T15:00:54Z"), model.extendedInfo().refreshedAt()); - Assertions.assertEquals(1976793148, model.extendedInfo().azureProtectedInstances()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmBackupEngine model = new DpmBackupEngine().withFriendlyName("ydjfb") - .withBackupManagementType(BackupManagementType.AZURE_BACKUP_SERVER) - .withRegistrationStatus("hhulrtywikdm") - .withBackupEngineState("akuflgbhgauacdix") - .withHealthStatus("ufr") - .withCanReRegister(false) - .withBackupEngineId("qg") - .withDpmVersion("fnozoeoqbvjh") - .withAzureBackupAgentVersion("f") - .withIsAzureBackupAgentUpgradeAvailable(false) - .withIsDpmUpgradeAvailable(false) - .withExtendedInfo(new BackupEngineExtendedInfo().withDatabaseName("hntasfaymx") - .withProtectedItemsCount(2018726025) - .withProtectedServersCount(529745015) - .withDiskCount(1379725969) - .withUsedDiskSpace(4.6356914864929655D) - .withAvailableDiskSpace(54.77226942032251D) - .withRefreshedAt(OffsetDateTime.parse("2021-01-29T15:00:54Z")) - .withAzureProtectedInstances(1976793148)); - model = BinaryData.fromObject(model).toObject(DpmBackupEngine.class); - Assertions.assertEquals("ydjfb", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, model.backupManagementType()); - Assertions.assertEquals("hhulrtywikdm", model.registrationStatus()); - Assertions.assertEquals("akuflgbhgauacdix", model.backupEngineState()); - Assertions.assertEquals("ufr", model.healthStatus()); - Assertions.assertEquals(false, model.canReRegister()); - Assertions.assertEquals("qg", model.backupEngineId()); - Assertions.assertEquals("fnozoeoqbvjh", model.dpmVersion()); - Assertions.assertEquals("f", model.azureBackupAgentVersion()); - Assertions.assertEquals(false, model.isAzureBackupAgentUpgradeAvailable()); - Assertions.assertEquals(false, model.isDpmUpgradeAvailable()); - Assertions.assertEquals("hntasfaymx", model.extendedInfo().databaseName()); - Assertions.assertEquals(2018726025, model.extendedInfo().protectedItemsCount()); - Assertions.assertEquals(529745015, model.extendedInfo().protectedServersCount()); - Assertions.assertEquals(1379725969, model.extendedInfo().diskCount()); - Assertions.assertEquals(4.6356914864929655D, model.extendedInfo().usedDiskSpace()); - Assertions.assertEquals(54.77226942032251D, model.extendedInfo().availableDiskSpace()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-29T15:00:54Z"), model.extendedInfo().refreshedAt()); - Assertions.assertEquals(1976793148, model.extendedInfo().azureProtectedInstances()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmContainerExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmContainerExtendedInfoTests.java deleted file mode 100644 index 44cd6a9d33e7a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmContainerExtendedInfoTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmContainerExtendedInfo; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class DpmContainerExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmContainerExtendedInfo model = BinaryData.fromString("{\"lastRefreshedAt\":\"2021-07-14T15:45:07Z\"}") - .toObject(DpmContainerExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-14T15:45:07Z"), model.lastRefreshedAt()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmContainerExtendedInfo model - = new DpmContainerExtendedInfo().withLastRefreshedAt(OffsetDateTime.parse("2021-07-14T15:45:07Z")); - model = BinaryData.fromObject(model).toObject(DpmContainerExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-14T15:45:07Z"), model.lastRefreshedAt()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmContainerTests.java deleted file mode 100644 index 7fcd34de65749..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmContainerTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmContainerExtendedInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DpmContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmContainer model = BinaryData.fromString( - "{\"containerType\":\"DPMContainer\",\"canReRegister\":true,\"containerId\":\"eofiz\",\"protectedItemCount\":2729674054207787435,\"dpmAgentVersion\":\"mjm\",\"dpmServers\":[\"yzgib\",\"kujrllfojui\",\"jpu\"],\"upgradeAvailable\":true,\"protectionStatus\":\"c\",\"extendedInfo\":{\"lastRefreshedAt\":\"2021-10-25T06:21:32Z\"},\"friendlyName\":\"oeo\",\"backupManagementType\":\"AzureStorage\",\"registrationStatus\":\"ejetjklntik\",\"healthStatus\":\"uzk\",\"protectableObjectType\":\"qzolxrzvhqjw\"}") - .toObject(DpmContainer.class); - Assertions.assertEquals("oeo", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, model.backupManagementType()); - Assertions.assertEquals("ejetjklntik", model.registrationStatus()); - Assertions.assertEquals("uzk", model.healthStatus()); - Assertions.assertEquals("qzolxrzvhqjw", model.protectableObjectType()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("eofiz", model.containerId()); - Assertions.assertEquals(2729674054207787435L, model.protectedItemCount()); - Assertions.assertEquals("mjm", model.dpmAgentVersion()); - Assertions.assertEquals("yzgib", model.dpmServers().get(0)); - Assertions.assertEquals(true, model.upgradeAvailable()); - Assertions.assertEquals("c", model.protectionStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T06:21:32Z"), model.extendedInfo().lastRefreshedAt()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmContainer model = new DpmContainer().withFriendlyName("oeo") - .withBackupManagementType(BackupManagementType.AZURE_STORAGE) - .withRegistrationStatus("ejetjklntik") - .withHealthStatus("uzk") - .withProtectableObjectType("qzolxrzvhqjw") - .withCanReRegister(true) - .withContainerId("eofiz") - .withProtectedItemCount(2729674054207787435L) - .withDpmAgentVersion("mjm") - .withDpmServers(Arrays.asList("yzgib", "kujrllfojui", "jpu")) - .withUpgradeAvailable(true) - .withProtectionStatus("c") - .withExtendedInfo( - new DpmContainerExtendedInfo().withLastRefreshedAt(OffsetDateTime.parse("2021-10-25T06:21:32Z"))); - model = BinaryData.fromObject(model).toObject(DpmContainer.class); - Assertions.assertEquals("oeo", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, model.backupManagementType()); - Assertions.assertEquals("ejetjklntik", model.registrationStatus()); - Assertions.assertEquals("uzk", model.healthStatus()); - Assertions.assertEquals("qzolxrzvhqjw", model.protectableObjectType()); - Assertions.assertEquals(true, model.canReRegister()); - Assertions.assertEquals("eofiz", model.containerId()); - Assertions.assertEquals(2729674054207787435L, model.protectedItemCount()); - Assertions.assertEquals("mjm", model.dpmAgentVersion()); - Assertions.assertEquals("yzgib", model.dpmServers().get(0)); - Assertions.assertEquals(true, model.upgradeAvailable()); - Assertions.assertEquals("c", model.protectionStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T06:21:32Z"), model.extendedInfo().lastRefreshedAt()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmErrorInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmErrorInfoTests.java deleted file mode 100644 index 06e0648373743..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmErrorInfoTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmErrorInfo; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DpmErrorInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmErrorInfo model = BinaryData - .fromString( - "{\"errorString\":\"ztcmwq\",\"recommendations\":[\"cxwaxfewz\",\"kjexfdeqvhp\",\"ylkkshkbffmbm\"]}") - .toObject(DpmErrorInfo.class); - Assertions.assertEquals("ztcmwq", model.errorString()); - Assertions.assertEquals("cxwaxfewz", model.recommendations().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmErrorInfo model = new DpmErrorInfo().withErrorString("ztcmwq") - .withRecommendations(Arrays.asList("cxwaxfewz", "kjexfdeqvhp", "ylkkshkbffmbm")); - model = BinaryData.fromObject(model).toObject(DpmErrorInfo.class); - Assertions.assertEquals("ztcmwq", model.errorString()); - Assertions.assertEquals("cxwaxfewz", model.recommendations().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobExtendedInfoTests.java deleted file mode 100644 index a6713a8c52f2e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobExtendedInfoTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmJobExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmJobTaskDetails; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DpmJobExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmJobExtendedInfo model = BinaryData.fromString( - "{\"tasksList\":[{\"taskId\":\"qtobaxkjeyt\",\"startTime\":\"2021-10-31T09:27:21Z\",\"endTime\":\"2021-07-22T08:57:15Z\",\"duration\":\"PT40H53M57S\",\"status\":\"rusnk\"},{\"taskId\":\"hsyrqunj\",\"startTime\":\"2021-06-10T18:51:05Z\",\"endTime\":\"2021-04-30T12:14:16Z\",\"duration\":\"PT90H56M59S\",\"status\":\"l\"},{\"taskId\":\"akdkifmjnnawtqab\",\"startTime\":\"2021-06-23T13:06:59Z\",\"endTime\":\"2021-05-18T06:32:42Z\",\"duration\":\"PT68H55M51S\",\"status\":\"qoweyirdhl\"}],\"propertyBag\":{\"mpizru\":\"gwflq\",\"qxpxiwfcngjsaa\":\"n\",\"kv\":\"iixtmkzj\",\"ra\":\"irhgfgrwsdp\"},\"dynamicErrorMessage\":\"vzbglbyvi\"}") - .toObject(DpmJobExtendedInfo.class); - Assertions.assertEquals("qtobaxkjeyt", model.tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T09:27:21Z"), model.tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-22T08:57:15Z"), model.tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT40H53M57S"), model.tasksList().get(0).duration()); - Assertions.assertEquals("rusnk", model.tasksList().get(0).status()); - Assertions.assertEquals("gwflq", model.propertyBag().get("mpizru")); - Assertions.assertEquals("vzbglbyvi", model.dynamicErrorMessage()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmJobExtendedInfo model = new DpmJobExtendedInfo() - .withTasksList(Arrays.asList( - new DpmJobTaskDetails().withTaskId("qtobaxkjeyt") - .withStartTime(OffsetDateTime.parse("2021-10-31T09:27:21Z")) - .withEndTime(OffsetDateTime.parse("2021-07-22T08:57:15Z")) - .withDuration(Duration.parse("PT40H53M57S")) - .withStatus("rusnk"), - new DpmJobTaskDetails().withTaskId("hsyrqunj") - .withStartTime(OffsetDateTime.parse("2021-06-10T18:51:05Z")) - .withEndTime(OffsetDateTime.parse("2021-04-30T12:14:16Z")) - .withDuration(Duration.parse("PT90H56M59S")) - .withStatus("l"), - new DpmJobTaskDetails().withTaskId("akdkifmjnnawtqab") - .withStartTime(OffsetDateTime.parse("2021-06-23T13:06:59Z")) - .withEndTime(OffsetDateTime.parse("2021-05-18T06:32:42Z")) - .withDuration(Duration.parse("PT68H55M51S")) - .withStatus("qoweyirdhl"))) - .withPropertyBag(mapOf("mpizru", "gwflq", "qxpxiwfcngjsaa", "n", "kv", "iixtmkzj", "ra", "irhgfgrwsdp")) - .withDynamicErrorMessage("vzbglbyvi"); - model = BinaryData.fromObject(model).toObject(DpmJobExtendedInfo.class); - Assertions.assertEquals("qtobaxkjeyt", model.tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T09:27:21Z"), model.tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-22T08:57:15Z"), model.tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT40H53M57S"), model.tasksList().get(0).duration()); - Assertions.assertEquals("rusnk", model.tasksList().get(0).status()); - Assertions.assertEquals("gwflq", model.propertyBag().get("mpizru")); - Assertions.assertEquals("vzbglbyvi", model.dynamicErrorMessage()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobTaskDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobTaskDetailsTests.java deleted file mode 100644 index 7ab18f252c378..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobTaskDetailsTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmJobTaskDetails; -import java.time.Duration; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class DpmJobTaskDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmJobTaskDetails model = BinaryData.fromString( - "{\"taskId\":\"ctbrxkjzwrgxffm\",\"startTime\":\"2021-08-27T19:17:59Z\",\"endTime\":\"2021-08-28T12:30:32Z\",\"duration\":\"PT140H50M53S\",\"status\":\"ozxwopd\"}") - .toObject(DpmJobTaskDetails.class); - Assertions.assertEquals("ctbrxkjzwrgxffm", model.taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-27T19:17:59Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-28T12:30:32Z"), model.endTime()); - Assertions.assertEquals(Duration.parse("PT140H50M53S"), model.duration()); - Assertions.assertEquals("ozxwopd", model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmJobTaskDetails model = new DpmJobTaskDetails().withTaskId("ctbrxkjzwrgxffm") - .withStartTime(OffsetDateTime.parse("2021-08-27T19:17:59Z")) - .withEndTime(OffsetDateTime.parse("2021-08-28T12:30:32Z")) - .withDuration(Duration.parse("PT140H50M53S")) - .withStatus("ozxwopd"); - model = BinaryData.fromObject(model).toObject(DpmJobTaskDetails.class); - Assertions.assertEquals("ctbrxkjzwrgxffm", model.taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-27T19:17:59Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-28T12:30:32Z"), model.endTime()); - Assertions.assertEquals(Duration.parse("PT140H50M53S"), model.duration()); - Assertions.assertEquals("ozxwopd", model.status()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobTests.java deleted file mode 100644 index f6adcc325daa3..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmJobTests.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmErrorInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmJob; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmJobExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmJobTaskDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.JobSupportedAction; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DpmJobTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmJob model = BinaryData.fromString( - "{\"jobType\":\"DpmJob\",\"duration\":\"PT177H19M41S\",\"dpmServerName\":\"gywwpgjxs\",\"containerName\":\"tf\",\"containerType\":\"gicgaaoepttaq\",\"workloadType\":\"dewemxswv\",\"actionsInfo\":[\"Invalid\",\"Invalid\",\"Retriable\"],\"errorDetails\":[{\"errorString\":\"hkfkimrtixokf\",\"recommendations\":[\"inljqepqwhixmo\",\"stshiy\"]},{\"errorString\":\"velfcldu\",\"recommendations\":[\"irdsvuwcob\",\"egstmninwjizci\",\"nghgshej\",\"tbxqmuluxlxq\"]},{\"errorString\":\"nersb\",\"recommendations\":[\"crwnamikz\",\"brqbsmswzi\"]},{\"errorString\":\"fuhok\",\"recommendations\":[\"swhvhczznvfbycj\",\"xjww\",\"xzv\",\"mwmxqhndvnoamld\"]}],\"extendedInfo\":{\"tasksList\":[{\"taskId\":\"hdjhhflz\",\"startTime\":\"2021-09-01T03:30:12Z\",\"endTime\":\"2021-01-13T01:47:16Z\",\"duration\":\"PT140H9M21S\",\"status\":\"lnjetaglt\"},{\"taskId\":\"oatftgzpnpbswvef\",\"startTime\":\"2021-04-22T04:47:20Z\",\"endTime\":\"2021-01-31T21:33:12Z\",\"duration\":\"PT230H41M15S\",\"status\":\"zihmipgawtxxpky\"}],\"propertyBag\":{\"pcycilrmcaykg\":\"cjxgrytf\",\"pndfcpfnznt\":\"noxuztrksx\",\"xuzvoamktcqi\":\"jtwkjaos\",\"rtltla\":\"smgbzahgxqdl\"},\"dynamicErrorMessage\":\"ltzkatbhjmznnb\"},\"entityFriendlyName\":\"qeqala\",\"backupManagementType\":\"MAB\",\"operation\":\"gunbtgfebwlnbm\",\"status\":\"reeudzqavb\",\"startTime\":\"2021-04-18T03:24:53Z\",\"endTime\":\"2021-05-03T15:28:46Z\",\"activityId\":\"lyyzglgouwtlmjj\"}") - .toObject(DpmJob.class); - Assertions.assertEquals("qeqala", model.entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("gunbtgfebwlnbm", model.operation()); - Assertions.assertEquals("reeudzqavb", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-18T03:24:53Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T15:28:46Z"), model.endTime()); - Assertions.assertEquals("lyyzglgouwtlmjj", model.activityId()); - Assertions.assertEquals(Duration.parse("PT177H19M41S"), model.duration()); - Assertions.assertEquals("gywwpgjxs", model.dpmServerName()); - Assertions.assertEquals("tf", model.containerName()); - Assertions.assertEquals("gicgaaoepttaq", model.containerType()); - Assertions.assertEquals("dewemxswv", model.workloadType()); - Assertions.assertEquals(JobSupportedAction.INVALID, model.actionsInfo().get(0)); - Assertions.assertEquals("hkfkimrtixokf", model.errorDetails().get(0).errorString()); - Assertions.assertEquals("inljqepqwhixmo", model.errorDetails().get(0).recommendations().get(0)); - Assertions.assertEquals("hdjhhflz", model.extendedInfo().tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-01T03:30:12Z"), - model.extendedInfo().tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-13T01:47:16Z"), - model.extendedInfo().tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT140H9M21S"), model.extendedInfo().tasksList().get(0).duration()); - Assertions.assertEquals("lnjetaglt", model.extendedInfo().tasksList().get(0).status()); - Assertions.assertEquals("cjxgrytf", model.extendedInfo().propertyBag().get("pcycilrmcaykg")); - Assertions.assertEquals("ltzkatbhjmznnb", model.extendedInfo().dynamicErrorMessage()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmJob model = new DpmJob().withEntityFriendlyName("qeqala") - .withBackupManagementType(BackupManagementType.MAB) - .withOperation("gunbtgfebwlnbm") - .withStatus("reeudzqavb") - .withStartTime(OffsetDateTime.parse("2021-04-18T03:24:53Z")) - .withEndTime(OffsetDateTime.parse("2021-05-03T15:28:46Z")) - .withActivityId("lyyzglgouwtlmjj") - .withDuration(Duration.parse("PT177H19M41S")) - .withDpmServerName("gywwpgjxs") - .withContainerName("tf") - .withContainerType("gicgaaoepttaq") - .withWorkloadType("dewemxswv") - .withActionsInfo( - Arrays.asList(JobSupportedAction.INVALID, JobSupportedAction.INVALID, JobSupportedAction.RETRIABLE)) - .withErrorDetails(Arrays.asList( - new DpmErrorInfo().withErrorString("hkfkimrtixokf") - .withRecommendations(Arrays.asList("inljqepqwhixmo", "stshiy")), - new DpmErrorInfo().withErrorString("velfcldu") - .withRecommendations(Arrays.asList("irdsvuwcob", "egstmninwjizci", "nghgshej", "tbxqmuluxlxq")), - new DpmErrorInfo().withErrorString("nersb") - .withRecommendations(Arrays.asList("crwnamikz", "brqbsmswzi")), - new DpmErrorInfo().withErrorString("fuhok") - .withRecommendations(Arrays.asList("swhvhczznvfbycj", "xjww", "xzv", "mwmxqhndvnoamld")))) - .withExtendedInfo(new DpmJobExtendedInfo() - .withTasksList(Arrays.asList( - new DpmJobTaskDetails().withTaskId("hdjhhflz") - .withStartTime(OffsetDateTime.parse("2021-09-01T03:30:12Z")) - .withEndTime(OffsetDateTime.parse("2021-01-13T01:47:16Z")) - .withDuration(Duration.parse("PT140H9M21S")) - .withStatus("lnjetaglt"), - new DpmJobTaskDetails().withTaskId("oatftgzpnpbswvef") - .withStartTime(OffsetDateTime.parse("2021-04-22T04:47:20Z")) - .withEndTime(OffsetDateTime.parse("2021-01-31T21:33:12Z")) - .withDuration(Duration.parse("PT230H41M15S")) - .withStatus("zihmipgawtxxpky"))) - .withPropertyBag(mapOf("pcycilrmcaykg", "cjxgrytf", "pndfcpfnznt", "noxuztrksx", "xuzvoamktcqi", - "jtwkjaos", "rtltla", "smgbzahgxqdl")) - .withDynamicErrorMessage("ltzkatbhjmznnb")); - model = BinaryData.fromObject(model).toObject(DpmJob.class); - Assertions.assertEquals("qeqala", model.entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("gunbtgfebwlnbm", model.operation()); - Assertions.assertEquals("reeudzqavb", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-18T03:24:53Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T15:28:46Z"), model.endTime()); - Assertions.assertEquals("lyyzglgouwtlmjj", model.activityId()); - Assertions.assertEquals(Duration.parse("PT177H19M41S"), model.duration()); - Assertions.assertEquals("gywwpgjxs", model.dpmServerName()); - Assertions.assertEquals("tf", model.containerName()); - Assertions.assertEquals("gicgaaoepttaq", model.containerType()); - Assertions.assertEquals("dewemxswv", model.workloadType()); - Assertions.assertEquals(JobSupportedAction.INVALID, model.actionsInfo().get(0)); - Assertions.assertEquals("hkfkimrtixokf", model.errorDetails().get(0).errorString()); - Assertions.assertEquals("inljqepqwhixmo", model.errorDetails().get(0).recommendations().get(0)); - Assertions.assertEquals("hdjhhflz", model.extendedInfo().tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-01T03:30:12Z"), - model.extendedInfo().tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-13T01:47:16Z"), - model.extendedInfo().tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT140H9M21S"), model.extendedInfo().tasksList().get(0).duration()); - Assertions.assertEquals("lnjetaglt", model.extendedInfo().tasksList().get(0).status()); - Assertions.assertEquals("cjxgrytf", model.extendedInfo().propertyBag().get("pcycilrmcaykg")); - Assertions.assertEquals("ltzkatbhjmznnb", model.extendedInfo().dynamicErrorMessage()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmProtectedItemExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmProtectedItemExtendedInfoTests.java deleted file mode 100644 index 645d191bdd080..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmProtectedItemExtendedInfoTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmProtectedItemExtendedInfo; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DpmProtectedItemExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmProtectedItemExtendedInfo model = BinaryData.fromString( - "{\"protectableObjectLoadPath\":{\"vkfvxcnqmxqpswok\":\"dfuyd\",\"kzsz\":\"vkhlggdhbemz\",\"fpgpicrmnzhrgm\":\"wiwtglxxhl\",\"qcbfrmbodths\":\"gjsxv\"},\"protected\":true,\"isPresentOnCloud\":true,\"lastBackupStatus\":\"i\",\"lastRefreshedAt\":\"2021-01-20T04:23:32Z\",\"oldestRecoveryPoint\":\"2021-06-17T12:23:54Z\",\"recoveryPointCount\":47418436,\"onPremiseOldestRecoveryPoint\":\"2021-05-28T16:52:57Z\",\"onPremiseLatestRecoveryPoint\":\"2021-11-04T08:18:17Z\",\"onPremiseRecoveryPointCount\":1419015231,\"isCollocated\":true,\"protectionGroupName\":\"au\",\"diskStorageUsedInBytes\":\"wvsgmwohqfzizvu\",\"totalDiskStorageSizeInBytes\":\"mk\"}") - .toObject(DpmProtectedItemExtendedInfo.class); - Assertions.assertEquals("dfuyd", model.protectableObjectLoadPath().get("vkfvxcnqmxqpswok")); - Assertions.assertEquals(true, model.protectedProperty()); - Assertions.assertEquals(true, model.isPresentOnCloud()); - Assertions.assertEquals("i", model.lastBackupStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-20T04:23:32Z"), model.lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T12:23:54Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(47418436, model.recoveryPointCount()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T16:52:57Z"), model.onPremiseOldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T08:18:17Z"), model.onPremiseLatestRecoveryPoint()); - Assertions.assertEquals(1419015231, model.onPremiseRecoveryPointCount()); - Assertions.assertEquals(true, model.isCollocated()); - Assertions.assertEquals("au", model.protectionGroupName()); - Assertions.assertEquals("wvsgmwohqfzizvu", model.diskStorageUsedInBytes()); - Assertions.assertEquals("mk", model.totalDiskStorageSizeInBytes()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmProtectedItemExtendedInfo model = new DpmProtectedItemExtendedInfo() - .withProtectableObjectLoadPath(mapOf("vkfvxcnqmxqpswok", "dfuyd", "kzsz", "vkhlggdhbemz", "fpgpicrmnzhrgm", - "wiwtglxxhl", "qcbfrmbodths", "gjsxv")) - .withProtectedProperty(true) - .withIsPresentOnCloud(true) - .withLastBackupStatus("i") - .withLastRefreshedAt(OffsetDateTime.parse("2021-01-20T04:23:32Z")) - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-06-17T12:23:54Z")) - .withRecoveryPointCount(47418436) - .withOnPremiseOldestRecoveryPoint(OffsetDateTime.parse("2021-05-28T16:52:57Z")) - .withOnPremiseLatestRecoveryPoint(OffsetDateTime.parse("2021-11-04T08:18:17Z")) - .withOnPremiseRecoveryPointCount(1419015231) - .withIsCollocated(true) - .withProtectionGroupName("au") - .withDiskStorageUsedInBytes("wvsgmwohqfzizvu") - .withTotalDiskStorageSizeInBytes("mk"); - model = BinaryData.fromObject(model).toObject(DpmProtectedItemExtendedInfo.class); - Assertions.assertEquals("dfuyd", model.protectableObjectLoadPath().get("vkfvxcnqmxqpswok")); - Assertions.assertEquals(true, model.protectedProperty()); - Assertions.assertEquals(true, model.isPresentOnCloud()); - Assertions.assertEquals("i", model.lastBackupStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-20T04:23:32Z"), model.lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T12:23:54Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(47418436, model.recoveryPointCount()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T16:52:57Z"), model.onPremiseOldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T08:18:17Z"), model.onPremiseLatestRecoveryPoint()); - Assertions.assertEquals(1419015231, model.onPremiseRecoveryPointCount()); - Assertions.assertEquals(true, model.isCollocated()); - Assertions.assertEquals("au", model.protectionGroupName()); - Assertions.assertEquals("wvsgmwohqfzizvu", model.diskStorageUsedInBytes()); - Assertions.assertEquals("mk", model.totalDiskStorageSizeInBytes()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmProtectedItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmProtectedItemTests.java deleted file mode 100644 index 0684f79f1a54f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/DpmProtectedItemTests.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmProtectedItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.DpmProtectedItemExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemState; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DpmProtectedItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DpmProtectedItem model = BinaryData.fromString( - "{\"protectedItemType\":\"DPMProtectedItem\",\"friendlyName\":\"dpizq\",\"backupEngineName\":\"lnapxbiygn\",\"protectionState\":\"IRPending\",\"extendedInfo\":{\"protectableObjectLoadPath\":{\"oiquvrehmrnjhvs\":\"smfcttuxuuyilfl\",\"w\":\"jztczytqj\",\"mr\":\"auunfprnjletlx\",\"amowaziynknlqwzd\":\"ddoui\"},\"protected\":true,\"isPresentOnCloud\":true,\"lastBackupStatus\":\"qszdtmaajquhuxyl\",\"lastRefreshedAt\":\"2021-10-25T23:02:29Z\",\"oldestRecoveryPoint\":\"2021-06-06T18:03:06Z\",\"recoveryPointCount\":202362209,\"onPremiseOldestRecoveryPoint\":\"2021-06-24T06:43:33Z\",\"onPremiseLatestRecoveryPoint\":\"2021-03-27T05:29:46Z\",\"onPremiseRecoveryPointCount\":417013973,\"isCollocated\":false,\"protectionGroupName\":\"p\",\"diskStorageUsedInBytes\":\"c\",\"totalDiskStorageSizeInBytes\":\"kyjpmspbps\"},\"backupManagementType\":\"AzureStorage\",\"workloadType\":\"Client\",\"containerName\":\"ogtieyujtvczkcny\",\"sourceResourceId\":\"x\",\"policyId\":\"njdxvglnkvxl\",\"lastRecoveryPoint\":\"2021-11-26T09:48:43Z\",\"backupSetName\":\"lqivbgkcv\",\"createMode\":\"Default\",\"deferredDeleteTimeInUTC\":\"2020-12-28T02:44:39Z\",\"isScheduledForDeferredDelete\":false,\"deferredDeleteTimeRemaining\":\"fl\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":false,\"resourceGuardOperationRequests\":[\"pubcpzgpxtivhjk\",\"idibgqjxgpn\",\"hgovfgp\"],\"isArchiveEnabled\":false,\"policyName\":\"hh\",\"softDeleteRetentionPeriodInDays\":1307435225,\"vaultId\":\"rmzvupo\"}") - .toObject(DpmProtectedItem.class); - Assertions.assertEquals("ogtieyujtvczkcny", model.containerName()); - Assertions.assertEquals("x", model.sourceResourceId()); - Assertions.assertEquals("njdxvglnkvxl", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-26T09:48:43Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("lqivbgkcv", model.backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-28T02:44:39Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("fl", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(false, model.isRehydrate()); - Assertions.assertEquals("pubcpzgpxtivhjk", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isArchiveEnabled()); - Assertions.assertEquals("hh", model.policyName()); - Assertions.assertEquals(1307435225, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("dpizq", model.friendlyName()); - Assertions.assertEquals("lnapxbiygn", model.backupEngineName()); - Assertions.assertEquals(ProtectedItemState.IRPENDING, model.protectionState()); - Assertions.assertEquals("smfcttuxuuyilfl", - model.extendedInfo().protectableObjectLoadPath().get("oiquvrehmrnjhvs")); - Assertions.assertEquals(true, model.extendedInfo().protectedProperty()); - Assertions.assertEquals(true, model.extendedInfo().isPresentOnCloud()); - Assertions.assertEquals("qszdtmaajquhuxyl", model.extendedInfo().lastBackupStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T23:02:29Z"), model.extendedInfo().lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-06T18:03:06Z"), - model.extendedInfo().oldestRecoveryPoint()); - Assertions.assertEquals(202362209, model.extendedInfo().recoveryPointCount()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-24T06:43:33Z"), - model.extendedInfo().onPremiseOldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-27T05:29:46Z"), - model.extendedInfo().onPremiseLatestRecoveryPoint()); - Assertions.assertEquals(417013973, model.extendedInfo().onPremiseRecoveryPointCount()); - Assertions.assertEquals(false, model.extendedInfo().isCollocated()); - Assertions.assertEquals("p", model.extendedInfo().protectionGroupName()); - Assertions.assertEquals("c", model.extendedInfo().diskStorageUsedInBytes()); - Assertions.assertEquals("kyjpmspbps", model.extendedInfo().totalDiskStorageSizeInBytes()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DpmProtectedItem model = new DpmProtectedItem().withContainerName("ogtieyujtvczkcny") - .withSourceResourceId("x") - .withPolicyId("njdxvglnkvxl") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-11-26T09:48:43Z")) - .withBackupSetName("lqivbgkcv") - .withCreateMode(CreateMode.DEFAULT) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2020-12-28T02:44:39Z")) - .withIsScheduledForDeferredDelete(false) - .withDeferredDeleteTimeRemaining("fl") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(false) - .withResourceGuardOperationRequests(Arrays.asList("pubcpzgpxtivhjk", "idibgqjxgpn", "hgovfgp")) - .withIsArchiveEnabled(false) - .withPolicyName("hh") - .withSoftDeleteRetentionPeriod(1307435225) - .withFriendlyName("dpizq") - .withBackupEngineName("lnapxbiygn") - .withProtectionState(ProtectedItemState.IRPENDING) - .withExtendedInfo(new DpmProtectedItemExtendedInfo() - .withProtectableObjectLoadPath(mapOf("oiquvrehmrnjhvs", "smfcttuxuuyilfl", "w", "jztczytqj", "mr", - "auunfprnjletlx", "amowaziynknlqwzd", "ddoui")) - .withProtectedProperty(true) - .withIsPresentOnCloud(true) - .withLastBackupStatus("qszdtmaajquhuxyl") - .withLastRefreshedAt(OffsetDateTime.parse("2021-10-25T23:02:29Z")) - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-06-06T18:03:06Z")) - .withRecoveryPointCount(202362209) - .withOnPremiseOldestRecoveryPoint(OffsetDateTime.parse("2021-06-24T06:43:33Z")) - .withOnPremiseLatestRecoveryPoint(OffsetDateTime.parse("2021-03-27T05:29:46Z")) - .withOnPremiseRecoveryPointCount(417013973) - .withIsCollocated(false) - .withProtectionGroupName("p") - .withDiskStorageUsedInBytes("c") - .withTotalDiskStorageSizeInBytes("kyjpmspbps")); - model = BinaryData.fromObject(model).toObject(DpmProtectedItem.class); - Assertions.assertEquals("ogtieyujtvczkcny", model.containerName()); - Assertions.assertEquals("x", model.sourceResourceId()); - Assertions.assertEquals("njdxvglnkvxl", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-26T09:48:43Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("lqivbgkcv", model.backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-28T02:44:39Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("fl", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(false, model.isRehydrate()); - Assertions.assertEquals("pubcpzgpxtivhjk", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isArchiveEnabled()); - Assertions.assertEquals("hh", model.policyName()); - Assertions.assertEquals(1307435225, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("dpizq", model.friendlyName()); - Assertions.assertEquals("lnapxbiygn", model.backupEngineName()); - Assertions.assertEquals(ProtectedItemState.IRPENDING, model.protectionState()); - Assertions.assertEquals("smfcttuxuuyilfl", - model.extendedInfo().protectableObjectLoadPath().get("oiquvrehmrnjhvs")); - Assertions.assertEquals(true, model.extendedInfo().protectedProperty()); - Assertions.assertEquals(true, model.extendedInfo().isPresentOnCloud()); - Assertions.assertEquals("qszdtmaajquhuxyl", model.extendedInfo().lastBackupStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T23:02:29Z"), model.extendedInfo().lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-06T18:03:06Z"), - model.extendedInfo().oldestRecoveryPoint()); - Assertions.assertEquals(202362209, model.extendedInfo().recoveryPointCount()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-24T06:43:33Z"), - model.extendedInfo().onPremiseOldestRecoveryPoint()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-27T05:29:46Z"), - model.extendedInfo().onPremiseLatestRecoveryPoint()); - Assertions.assertEquals(417013973, model.extendedInfo().onPremiseRecoveryPointCount()); - Assertions.assertEquals(false, model.extendedInfo().isCollocated()); - Assertions.assertEquals("p", model.extendedInfo().protectionGroupName()); - Assertions.assertEquals("c", model.extendedInfo().diskStorageUsedInBytes()); - Assertions.assertEquals("kyjpmspbps", model.extendedInfo().totalDiskStorageSizeInBytes()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExtendedLocationTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExtendedLocationTests.java deleted file mode 100644 index db077e04e7ddc..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExtendedLocationTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ExtendedLocation; -import org.junit.jupiter.api.Assertions; - -public final class ExtendedLocationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExtendedLocation model - = BinaryData.fromString("{\"name\":\"ntkwcegy\",\"type\":\"lbnseqac\"}").toObject(ExtendedLocation.class); - Assertions.assertEquals("ntkwcegy", model.name()); - Assertions.assertEquals("lbnseqac", model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExtendedLocation model = new ExtendedLocation().withName("ntkwcegy").withType("lbnseqac"); - model = BinaryData.fromObject(model).toObject(ExtendedLocation.class); - Assertions.assertEquals("ntkwcegy", model.name()); - Assertions.assertEquals("lbnseqac", model.type()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExtendedPropertiesTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExtendedPropertiesTests.java deleted file mode 100644 index 0ef96f992033f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ExtendedPropertiesTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DiskExclusionProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.ExtendedProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ExtendedPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExtendedProperties model = BinaryData.fromString( - "{\"diskExclusionProperties\":{\"diskLunList\":[930110171,785261284,567909298,1272205160],\"isInclusionList\":true},\"linuxVmApplicationName\":\"wpklvxw\"}") - .toObject(ExtendedProperties.class); - Assertions.assertEquals(930110171, model.diskExclusionProperties().diskLunList().get(0)); - Assertions.assertEquals(true, model.diskExclusionProperties().isInclusionList()); - Assertions.assertEquals("wpklvxw", model.linuxVmApplicationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExtendedProperties model = new ExtendedProperties().withDiskExclusionProperties( - new DiskExclusionProperties().withDiskLunList(Arrays.asList(930110171, 785261284, 567909298, 1272205160)) - .withIsInclusionList(true)) - .withLinuxVmApplicationName("wpklvxw"); - model = BinaryData.fromObject(model).toObject(ExtendedProperties.class); - Assertions.assertEquals(930110171, model.diskExclusionProperties().diskLunList().get(0)); - Assertions.assertEquals(true, model.diskExclusionProperties().isInclusionList()); - Assertions.assertEquals("wpklvxw", model.linuxVmApplicationName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportRequestTests.java deleted file mode 100644 index 8f7f10d8b8a34..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportRequestTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.FeatureSupportRequest; - -public final class FeatureSupportRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FeatureSupportRequest model = BinaryData.fromString("{\"featureType\":\"FeatureSupportRequest\"}") - .toObject(FeatureSupportRequest.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FeatureSupportRequest model = new FeatureSupportRequest(); - model = BinaryData.fromObject(model).toObject(FeatureSupportRequest.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportsValidateWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportsValidateWithResponseMockTests.java deleted file mode 100644 index 51aeea7aa62b7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FeatureSupportsValidateWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.AzureVMResourceFeatureSupportResponse; -import com.azure.resourcemanager.recoveryservicesbackup.models.FeatureSupportRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.SupportStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class FeatureSupportsValidateWithResponseMockTests { - @Test - public void testValidateWithResponse() throws Exception { - String responseStr = "{\"supportStatus\":\"DefaultOFF\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AzureVMResourceFeatureSupportResponse response = manager.featureSupports() - .validateWithResponse("onhpcz", new FeatureSupportRequest(), com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(SupportStatus.DEFAULT_OFF, response.supportStatus()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostInfoForRehydrationRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostInfoForRehydrationRequestTests.java deleted file mode 100644 index 6c36e6c44c8bc..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostInfoForRehydrationRequestTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostInfoForRehydrationRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriority; -import org.junit.jupiter.api.Assertions; - -public final class FetchTieringCostInfoForRehydrationRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FetchTieringCostInfoForRehydrationRequest model = BinaryData.fromString( - "{\"objectType\":\"FetchTieringCostInfoForRehydrationRequest\",\"containerName\":\"pkpztrg\",\"protectedItemName\":\"gxvcoqrasw\",\"recoveryPointId\":\"gyxpqit\",\"rehydrationPriority\":\"High\",\"sourceTierType\":\"InstantRP\",\"targetTierType\":\"InstantRP\"}") - .toObject(FetchTieringCostInfoForRehydrationRequest.class); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.targetTierType()); - Assertions.assertEquals("pkpztrg", model.containerName()); - Assertions.assertEquals("gxvcoqrasw", model.protectedItemName()); - Assertions.assertEquals("gyxpqit", model.recoveryPointId()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.rehydrationPriority()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FetchTieringCostInfoForRehydrationRequest model - = new FetchTieringCostInfoForRehydrationRequest().withSourceTierType(RecoveryPointTierType.INSTANT_RP) - .withTargetTierType(RecoveryPointTierType.INSTANT_RP) - .withContainerName("pkpztrg") - .withProtectedItemName("gxvcoqrasw") - .withRecoveryPointId("gyxpqit") - .withRehydrationPriority(RehydrationPriority.HIGH); - model = BinaryData.fromObject(model).toObject(FetchTieringCostInfoForRehydrationRequest.class); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.targetTierType()); - Assertions.assertEquals("pkpztrg", model.containerName()); - Assertions.assertEquals("gxvcoqrasw", model.protectedItemName()); - Assertions.assertEquals("gyxpqit", model.recoveryPointId()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.rehydrationPriority()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostInfoRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostInfoRequestTests.java deleted file mode 100644 index d83a3164e73c6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostInfoRequestTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostInfoRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import org.junit.jupiter.api.Assertions; - -public final class FetchTieringCostInfoRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FetchTieringCostInfoRequest model = BinaryData.fromString( - "{\"objectType\":\"FetchTieringCostInfoRequest\",\"sourceTierType\":\"Invalid\",\"targetTierType\":\"InstantRP\"}") - .toObject(FetchTieringCostInfoRequest.class); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.targetTierType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FetchTieringCostInfoRequest model - = new FetchTieringCostInfoRequest().withSourceTierType(RecoveryPointTierType.INVALID) - .withTargetTierType(RecoveryPointTierType.INSTANT_RP); - model = BinaryData.fromObject(model).toObject(FetchTieringCostInfoRequest.class); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.targetTierType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForPolicyRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForPolicyRequestTests.java deleted file mode 100644 index 95ca0362969a6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForPolicyRequestTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostSavingsInfoForPolicyRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import org.junit.jupiter.api.Assertions; - -public final class FetchTieringCostSavingsInfoForPolicyRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FetchTieringCostSavingsInfoForPolicyRequest model = BinaryData.fromString( - "{\"objectType\":\"FetchTieringCostSavingsInfoForPolicyRequest\",\"policyName\":\"qtyltcoqcujp\",\"sourceTierType\":\"HardenedRP\",\"targetTierType\":\"Invalid\"}") - .toObject(FetchTieringCostSavingsInfoForPolicyRequest.class); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.targetTierType()); - Assertions.assertEquals("qtyltcoqcujp", model.policyName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FetchTieringCostSavingsInfoForPolicyRequest model - = new FetchTieringCostSavingsInfoForPolicyRequest().withSourceTierType(RecoveryPointTierType.HARDENED_RP) - .withTargetTierType(RecoveryPointTierType.INVALID) - .withPolicyName("qtyltcoqcujp"); - model = BinaryData.fromObject(model).toObject(FetchTieringCostSavingsInfoForPolicyRequest.class); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.targetTierType()); - Assertions.assertEquals("qtyltcoqcujp", model.policyName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForProtectedItemRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForProtectedItemRequestTests.java deleted file mode 100644 index 7cf5a943da27b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForProtectedItemRequestTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostSavingsInfoForProtectedItemRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import org.junit.jupiter.api.Assertions; - -public final class FetchTieringCostSavingsInfoForProtectedItemRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FetchTieringCostSavingsInfoForProtectedItemRequest model = BinaryData.fromString( - "{\"objectType\":\"FetchTieringCostSavingsInfoForProtectedItemRequest\",\"containerName\":\"zakuejk\",\"protectedItemName\":\"vbiztjofqcv\",\"sourceTierType\":\"HardenedRP\",\"targetTierType\":\"Invalid\"}") - .toObject(FetchTieringCostSavingsInfoForProtectedItemRequest.class); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.targetTierType()); - Assertions.assertEquals("zakuejk", model.containerName()); - Assertions.assertEquals("vbiztjofqcv", model.protectedItemName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FetchTieringCostSavingsInfoForProtectedItemRequest model - = new FetchTieringCostSavingsInfoForProtectedItemRequest() - .withSourceTierType(RecoveryPointTierType.HARDENED_RP) - .withTargetTierType(RecoveryPointTierType.INVALID) - .withContainerName("zakuejk") - .withProtectedItemName("vbiztjofqcv"); - model = BinaryData.fromObject(model).toObject(FetchTieringCostSavingsInfoForProtectedItemRequest.class); - Assertions.assertEquals(RecoveryPointTierType.HARDENED_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.targetTierType()); - Assertions.assertEquals("zakuejk", model.containerName()); - Assertions.assertEquals("vbiztjofqcv", model.protectedItemName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForVaultRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForVaultRequestTests.java deleted file mode 100644 index 7409d212b262f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostSavingsInfoForVaultRequestTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostSavingsInfoForVaultRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import org.junit.jupiter.api.Assertions; - -public final class FetchTieringCostSavingsInfoForVaultRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FetchTieringCostSavingsInfoForVaultRequest model = BinaryData.fromString( - "{\"objectType\":\"FetchTieringCostSavingsInfoForVaultRequest\",\"sourceTierType\":\"Invalid\",\"targetTierType\":\"Invalid\"}") - .toObject(FetchTieringCostSavingsInfoForVaultRequest.class); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.targetTierType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FetchTieringCostSavingsInfoForVaultRequest model - = new FetchTieringCostSavingsInfoForVaultRequest().withSourceTierType(RecoveryPointTierType.INVALID) - .withTargetTierType(RecoveryPointTierType.INVALID); - model = BinaryData.fromObject(model).toObject(FetchTieringCostSavingsInfoForVaultRequest.class); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INVALID, model.targetTierType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostsPostMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostsPostMockTests.java deleted file mode 100644 index a6efd104a08cd..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/FetchTieringCostsPostMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.FetchTieringCostInfoRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostInfo; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class FetchTieringCostsPostMockTests { - @Test - public void testPost() throws Exception { - String responseStr = "{\"objectType\":\"TieringCostInfo\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - TieringCostInfo response = manager.fetchTieringCosts() - .post("esocwiqbuou", "mpyzgleo", - new FetchTieringCostInfoRequest().withSourceTierType(RecoveryPointTierType.INVALID) - .withTargetTierType(RecoveryPointTierType.ARCHIVED_RP), - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericContainerExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericContainerExtendedInfoTests.java deleted file mode 100644 index cf2abd0312613..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericContainerExtendedInfoTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ContainerIdentityInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.GenericContainerExtendedInfo; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class GenericContainerExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GenericContainerExtendedInfo model = BinaryData.fromString( - "{\"rawCertData\":\"mbltoo\",\"containerIdentityInfo\":{\"uniqueName\":\"fqlwxldykalsy\",\"aadTenantId\":\"olnjpnnbmjksibj\",\"servicePrincipalClientId\":\"jjxxahmrnadzyqe\",\"audience\":\"yi\"},\"serviceEndpoints\":{\"wbjijkgq\":\"nbm\",\"jauj\":\"nhmbkez\"}}") - .toObject(GenericContainerExtendedInfo.class); - Assertions.assertEquals("mbltoo", model.rawCertData()); - Assertions.assertEquals("fqlwxldykalsy", model.containerIdentityInfo().uniqueName()); - Assertions.assertEquals("olnjpnnbmjksibj", model.containerIdentityInfo().aadTenantId()); - Assertions.assertEquals("jjxxahmrnadzyqe", model.containerIdentityInfo().servicePrincipalClientId()); - Assertions.assertEquals("yi", model.containerIdentityInfo().audience()); - Assertions.assertEquals("nbm", model.serviceEndpoints().get("wbjijkgq")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GenericContainerExtendedInfo model = new GenericContainerExtendedInfo().withRawCertData("mbltoo") - .withContainerIdentityInfo(new ContainerIdentityInfo().withUniqueName("fqlwxldykalsy") - .withAadTenantId("olnjpnnbmjksibj") - .withServicePrincipalClientId("jjxxahmrnadzyqe") - .withAudience("yi")) - .withServiceEndpoints(mapOf("wbjijkgq", "nbm", "jauj", "nhmbkez")); - model = BinaryData.fromObject(model).toObject(GenericContainerExtendedInfo.class); - Assertions.assertEquals("mbltoo", model.rawCertData()); - Assertions.assertEquals("fqlwxldykalsy", model.containerIdentityInfo().uniqueName()); - Assertions.assertEquals("olnjpnnbmjksibj", model.containerIdentityInfo().aadTenantId()); - Assertions.assertEquals("jjxxahmrnadzyqe", model.containerIdentityInfo().servicePrincipalClientId()); - Assertions.assertEquals("yi", model.containerIdentityInfo().audience()); - Assertions.assertEquals("nbm", model.serviceEndpoints().get("wbjijkgq")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericContainerTests.java deleted file mode 100644 index 1270d3e35d29b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericContainerTests.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ContainerIdentityInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.GenericContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.GenericContainerExtendedInfo; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class GenericContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GenericContainer model = BinaryData.fromString( - "{\"containerType\":\"GenericContainer\",\"fabricName\":\"fkmbtsuahxsgxj\",\"extendedInformation\":{\"rawCertData\":\"zrrscub\",\"containerIdentityInfo\":{\"uniqueName\":\"drnpxqwodiff\",\"aadTenantId\":\"cjrmmua\",\"servicePrincipalClientId\":\"ibvjogjonmcy\",\"audience\":\"oyzbamwineofvf\"},\"serviceEndpoints\":{\"t\":\"pol\",\"ttxpnrupza\":\"evboclzhzjknyuxg\",\"swyskbruffg\":\"mrdixtreki\"}},\"friendlyName\":\"ukkutvl\",\"backupManagementType\":\"DPM\",\"registrationStatus\":\"qhvmblcouqe\",\"healthStatus\":\"hbcdsziry\",\"protectableObjectType\":\"ndo\"}") - .toObject(GenericContainer.class); - Assertions.assertEquals("ukkutvl", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.backupManagementType()); - Assertions.assertEquals("qhvmblcouqe", model.registrationStatus()); - Assertions.assertEquals("hbcdsziry", model.healthStatus()); - Assertions.assertEquals("ndo", model.protectableObjectType()); - Assertions.assertEquals("fkmbtsuahxsgxj", model.fabricName()); - Assertions.assertEquals("zrrscub", model.extendedInformation().rawCertData()); - Assertions.assertEquals("drnpxqwodiff", model.extendedInformation().containerIdentityInfo().uniqueName()); - Assertions.assertEquals("cjrmmua", model.extendedInformation().containerIdentityInfo().aadTenantId()); - Assertions.assertEquals("ibvjogjonmcy", - model.extendedInformation().containerIdentityInfo().servicePrincipalClientId()); - Assertions.assertEquals("oyzbamwineofvf", model.extendedInformation().containerIdentityInfo().audience()); - Assertions.assertEquals("pol", model.extendedInformation().serviceEndpoints().get("t")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GenericContainer model = new GenericContainer().withFriendlyName("ukkutvl") - .withBackupManagementType(BackupManagementType.DPM) - .withRegistrationStatus("qhvmblcouqe") - .withHealthStatus("hbcdsziry") - .withProtectableObjectType("ndo") - .withFabricName("fkmbtsuahxsgxj") - .withExtendedInformation(new GenericContainerExtendedInfo().withRawCertData("zrrscub") - .withContainerIdentityInfo(new ContainerIdentityInfo().withUniqueName("drnpxqwodiff") - .withAadTenantId("cjrmmua") - .withServicePrincipalClientId("ibvjogjonmcy") - .withAudience("oyzbamwineofvf")) - .withServiceEndpoints( - mapOf("t", "pol", "ttxpnrupza", "evboclzhzjknyuxg", "swyskbruffg", "mrdixtreki"))); - model = BinaryData.fromObject(model).toObject(GenericContainer.class); - Assertions.assertEquals("ukkutvl", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.DPM, model.backupManagementType()); - Assertions.assertEquals("qhvmblcouqe", model.registrationStatus()); - Assertions.assertEquals("hbcdsziry", model.healthStatus()); - Assertions.assertEquals("ndo", model.protectableObjectType()); - Assertions.assertEquals("fkmbtsuahxsgxj", model.fabricName()); - Assertions.assertEquals("zrrscub", model.extendedInformation().rawCertData()); - Assertions.assertEquals("drnpxqwodiff", model.extendedInformation().containerIdentityInfo().uniqueName()); - Assertions.assertEquals("cjrmmua", model.extendedInformation().containerIdentityInfo().aadTenantId()); - Assertions.assertEquals("ibvjogjonmcy", - model.extendedInformation().containerIdentityInfo().servicePrincipalClientId()); - Assertions.assertEquals("oyzbamwineofvf", model.extendedInformation().containerIdentityInfo().audience()); - Assertions.assertEquals("pol", model.extendedInformation().serviceEndpoints().get("t")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericProtectedItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericProtectedItemTests.java deleted file mode 100644 index 549b2c9604170..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericProtectedItemTests.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.GenericProtectedItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionState; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class GenericProtectedItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GenericProtectedItem model = BinaryData.fromString( - "{\"protectedItemType\":\"GenericProtectedItem\",\"friendlyName\":\"sycxhxzgaz\",\"policyState\":\"abo\",\"protectionState\":\"Protected\",\"protectedItemId\":4301721887615555119,\"sourceAssociations\":{\"mtdherngb\":\"pubowsepdfg\"},\"fabricName\":\"juahokqto\",\"backupManagementType\":\"MAB\",\"workloadType\":\"FileFolder\",\"containerName\":\"fshfph\",\"sourceResourceId\":\"nulaiywzejywhsl\",\"policyId\":\"ojpllndnpdwrpqaf\",\"lastRecoveryPoint\":\"2021-05-07T14:23:25Z\",\"backupSetName\":\"snnfhyetefyp\",\"createMode\":\"Recover\",\"deferredDeleteTimeInUTC\":\"2021-10-29T02:50:04Z\",\"isScheduledForDeferredDelete\":false,\"deferredDeleteTimeRemaining\":\"tixr\",\"isDeferredDeleteScheduleUpcoming\":false,\"isRehydrate\":true,\"resourceGuardOperationRequests\":[\"rmlmuowo\",\"bauiropi\"],\"isArchiveEnabled\":true,\"policyName\":\"onwpnga\",\"softDeleteRetentionPeriodInDays\":39519861,\"vaultId\":\"ixjawrtm\"}") - .toObject(GenericProtectedItem.class); - Assertions.assertEquals("fshfph", model.containerName()); - Assertions.assertEquals("nulaiywzejywhsl", model.sourceResourceId()); - Assertions.assertEquals("ojpllndnpdwrpqaf", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-07T14:23:25Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("snnfhyetefyp", model.backupSetName()); - Assertions.assertEquals(CreateMode.RECOVER, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T02:50:04Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("tixr", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(false, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("rmlmuowo", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, model.isArchiveEnabled()); - Assertions.assertEquals("onwpnga", model.policyName()); - Assertions.assertEquals(39519861, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("sycxhxzgaz", model.friendlyName()); - Assertions.assertEquals("abo", model.policyState()); - Assertions.assertEquals(ProtectionState.PROTECTED, model.protectionState()); - Assertions.assertEquals(4301721887615555119L, model.protectedItemId()); - Assertions.assertEquals("pubowsepdfg", model.sourceAssociations().get("mtdherngb")); - Assertions.assertEquals("juahokqto", model.fabricName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GenericProtectedItem model = new GenericProtectedItem().withContainerName("fshfph") - .withSourceResourceId("nulaiywzejywhsl") - .withPolicyId("ojpllndnpdwrpqaf") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-05-07T14:23:25Z")) - .withBackupSetName("snnfhyetefyp") - .withCreateMode(CreateMode.RECOVER) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-10-29T02:50:04Z")) - .withIsScheduledForDeferredDelete(false) - .withDeferredDeleteTimeRemaining("tixr") - .withIsDeferredDeleteScheduleUpcoming(false) - .withIsRehydrate(true) - .withResourceGuardOperationRequests(Arrays.asList("rmlmuowo", "bauiropi")) - .withIsArchiveEnabled(true) - .withPolicyName("onwpnga") - .withSoftDeleteRetentionPeriod(39519861) - .withFriendlyName("sycxhxzgaz") - .withPolicyState("abo") - .withProtectionState(ProtectionState.PROTECTED) - .withProtectedItemId(4301721887615555119L) - .withSourceAssociations(mapOf("mtdherngb", "pubowsepdfg")) - .withFabricName("juahokqto"); - model = BinaryData.fromObject(model).toObject(GenericProtectedItem.class); - Assertions.assertEquals("fshfph", model.containerName()); - Assertions.assertEquals("nulaiywzejywhsl", model.sourceResourceId()); - Assertions.assertEquals("ojpllndnpdwrpqaf", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-07T14:23:25Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("snnfhyetefyp", model.backupSetName()); - Assertions.assertEquals(CreateMode.RECOVER, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T02:50:04Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("tixr", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(false, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("rmlmuowo", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, model.isArchiveEnabled()); - Assertions.assertEquals("onwpnga", model.policyName()); - Assertions.assertEquals(39519861, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("sycxhxzgaz", model.friendlyName()); - Assertions.assertEquals("abo", model.policyState()); - Assertions.assertEquals(ProtectionState.PROTECTED, model.protectionState()); - Assertions.assertEquals(4301721887615555119L, model.protectedItemId()); - Assertions.assertEquals("pubowsepdfg", model.sourceAssociations().get("mtdherngb")); - Assertions.assertEquals("juahokqto", model.fabricName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericProtectionPolicyTests.java deleted file mode 100644 index c4d286290c7ad..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericProtectionPolicyTests.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.GenericProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.PolicyType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotBackupAdditionalDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.SubProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class GenericProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GenericProtectionPolicy model = BinaryData.fromString( - "{\"backupManagementType\":\"GenericProtectionPolicy\",\"subProtectionPolicy\":[{\"policyType\":\"Invalid\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"tieringPolicy\":{\"qudtcvclx\":{\"tieringMode\":\"DoNotTier\",\"duration\":321240578,\"durationType\":\"Invalid\"},\"fabuiyjibu\":{\"tieringMode\":\"TierRecommended\",\"duration\":267466114,\"durationType\":\"Years\"},\"eiknpgo\":{\"tieringMode\":\"TierAfter\",\"duration\":1714041739,\"durationType\":\"Months\"},\"ibtozipqw\":{\"tieringMode\":\"TierAfter\",\"duration\":537926912,\"durationType\":\"Years\"}},\"snapshotBackupAdditionalDetails\":{\"instantRpRetentionRangeInDays\":775560662,\"instantRPDetails\":\"rrxxgewpktvq\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"mqpzoyhlfbcgw\",\"identityName\":\"loxoebqin\",\"userAssignedIdentityProperties\":{\"clientId\":\"nwjfu\",\"principalId\":\"lafcbahh\"}}}}],\"timeZone\":\"pofoi\",\"fabricName\":\"w\",\"protectedItemsCount\":1217605698,\"resourceGuardOperationRequests\":[\"mkkho\",\"vdndviauo\",\"phuartv\"]}") - .toObject(GenericProtectionPolicy.class); - Assertions.assertEquals(1217605698, model.protectedItemsCount()); - Assertions.assertEquals("mkkho", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(PolicyType.INVALID, model.subProtectionPolicy().get(0).policyType()); - Assertions.assertEquals(TieringMode.DO_NOT_TIER, - model.subProtectionPolicy().get(0).tieringPolicy().get("qudtcvclx").tieringMode()); - Assertions.assertEquals(321240578, - model.subProtectionPolicy().get(0).tieringPolicy().get("qudtcvclx").duration()); - Assertions.assertEquals(RetentionDurationType.INVALID, - model.subProtectionPolicy().get(0).tieringPolicy().get("qudtcvclx").durationType()); - Assertions.assertEquals(775560662, - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRpRetentionRangeInDays()); - Assertions.assertEquals("rrxxgewpktvq", - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRPDetails()); - Assertions.assertEquals("mqpzoyhlfbcgw", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityArmId()); - Assertions.assertEquals("loxoebqin", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityName()); - Assertions.assertEquals("nwjfu", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .clientId()); - Assertions.assertEquals("lafcbahh", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .principalId()); - Assertions.assertEquals("pofoi", model.timeZone()); - Assertions.assertEquals("w", model.fabricName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GenericProtectionPolicy model = new GenericProtectionPolicy().withProtectedItemsCount(1217605698) - .withResourceGuardOperationRequests(Arrays.asList("mkkho", "vdndviauo", "phuartv")) - .withSubProtectionPolicy(Arrays.asList(new SubProtectionPolicy().withPolicyType(PolicyType.INVALID) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withTieringPolicy(mapOf("qudtcvclx", - new TieringPolicy().withTieringMode(TieringMode.DO_NOT_TIER) - .withDuration(321240578) - .withDurationType(RetentionDurationType.INVALID), - "fabuiyjibu", - new TieringPolicy().withTieringMode(TieringMode.TIER_RECOMMENDED) - .withDuration(267466114) - .withDurationType(RetentionDurationType.YEARS), - "eiknpgo", - new TieringPolicy().withTieringMode(TieringMode.TIER_AFTER) - .withDuration(1714041739) - .withDurationType(RetentionDurationType.MONTHS), - "ibtozipqw", - new TieringPolicy().withTieringMode(TieringMode.TIER_AFTER) - .withDuration(537926912) - .withDurationType(RetentionDurationType.YEARS))) - .withSnapshotBackupAdditionalDetails(new SnapshotBackupAdditionalDetails() - .withInstantRpRetentionRangeInDays(775560662) - .withInstantRPDetails("rrxxgewpktvq") - .withUserAssignedManagedIdentityDetails(new UserAssignedManagedIdentityDetails() - .withIdentityArmId("mqpzoyhlfbcgw") - .withIdentityName("loxoebqin") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("nwjfu").withPrincipalId("lafcbahh")))))) - .withTimeZone("pofoi") - .withFabricName("w"); - model = BinaryData.fromObject(model).toObject(GenericProtectionPolicy.class); - Assertions.assertEquals(1217605698, model.protectedItemsCount()); - Assertions.assertEquals("mkkho", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(PolicyType.INVALID, model.subProtectionPolicy().get(0).policyType()); - Assertions.assertEquals(TieringMode.DO_NOT_TIER, - model.subProtectionPolicy().get(0).tieringPolicy().get("qudtcvclx").tieringMode()); - Assertions.assertEquals(321240578, - model.subProtectionPolicy().get(0).tieringPolicy().get("qudtcvclx").duration()); - Assertions.assertEquals(RetentionDurationType.INVALID, - model.subProtectionPolicy().get(0).tieringPolicy().get("qudtcvclx").durationType()); - Assertions.assertEquals(775560662, - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRpRetentionRangeInDays()); - Assertions.assertEquals("rrxxgewpktvq", - model.subProtectionPolicy().get(0).snapshotBackupAdditionalDetails().instantRPDetails()); - Assertions.assertEquals("mqpzoyhlfbcgw", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityArmId()); - Assertions.assertEquals("loxoebqin", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .identityName()); - Assertions.assertEquals("nwjfu", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .clientId()); - Assertions.assertEquals("lafcbahh", - model.subProtectionPolicy() - .get(0) - .snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .principalId()); - Assertions.assertEquals("pofoi", model.timeZone()); - Assertions.assertEquals("w", model.fabricName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericRecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericRecoveryPointTests.java deleted file mode 100644 index 5e01407694994..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GenericRecoveryPointTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.GenericRecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class GenericRecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GenericRecoveryPoint model = BinaryData.fromString( - "{\"objectType\":\"GenericRecoveryPoint\",\"friendlyName\":\"jmyccxlzhcoxov\",\"recoveryPointType\":\"khenlus\",\"recoveryPointTime\":\"2021-09-11T05:10:01Z\",\"recoveryPointAdditionalInfo\":\"tjxtxr\",\"recoveryPointProperties\":{\"expiryTime\":\"tjvidt\",\"ruleName\":\"epu\",\"isSoftDeleted\":false}}") - .toObject(GenericRecoveryPoint.class); - Assertions.assertEquals("jmyccxlzhcoxov", model.friendlyName()); - Assertions.assertEquals("khenlus", model.recoveryPointType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-11T05:10:01Z"), model.recoveryPointTime()); - Assertions.assertEquals("tjxtxr", model.recoveryPointAdditionalInfo()); - Assertions.assertEquals("tjvidt", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("epu", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GenericRecoveryPoint model = new GenericRecoveryPoint().withFriendlyName("jmyccxlzhcoxov") - .withRecoveryPointType("khenlus") - .withRecoveryPointTime(OffsetDateTime.parse("2021-09-11T05:10:01Z")) - .withRecoveryPointAdditionalInfo("tjxtxr") - .withRecoveryPointProperties( - new RecoveryPointProperties().withExpiryTime("tjvidt").withRuleName("epu").withIsSoftDeleted(false)); - model = BinaryData.fromObject(model).toObject(GenericRecoveryPoint.class); - Assertions.assertEquals("jmyccxlzhcoxov", model.friendlyName()); - Assertions.assertEquals("khenlus", model.recoveryPointType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-11T05:10:01Z"), model.recoveryPointTime()); - Assertions.assertEquals("tjxtxr", model.recoveryPointAdditionalInfo()); - Assertions.assertEquals("tjvidt", model.recoveryPointProperties().expiryTime()); - Assertions.assertEquals("epu", model.recoveryPointProperties().ruleName()); - Assertions.assertEquals(false, model.recoveryPointProperties().isSoftDeleted()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GetTieringCostOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GetTieringCostOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index c74d461518f82..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/GetTieringCostOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostInfo; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class GetTieringCostOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr = "{\"objectType\":\"TieringCostInfo\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - TieringCostInfo response = manager.getTieringCostOperationResults() - .getWithResponse("bgbwwz", "dajfwnncfma", "iqgjjrlhiql", com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/HourlyScheduleTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/HourlyScheduleTests.java deleted file mode 100644 index 272ec6b316a06..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/HourlyScheduleTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.HourlySchedule; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class HourlyScheduleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - HourlySchedule model = BinaryData.fromString( - "{\"interval\":2146264945,\"scheduleWindowStartTime\":\"2021-01-06T14:29:30Z\",\"scheduleWindowDuration\":2049992940}") - .toObject(HourlySchedule.class); - Assertions.assertEquals(2146264945, model.interval()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-06T14:29:30Z"), model.scheduleWindowStartTime()); - Assertions.assertEquals(2049992940, model.scheduleWindowDuration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - HourlySchedule model = new HourlySchedule().withInterval(2146264945) - .withScheduleWindowStartTime(OffsetDateTime.parse("2021-01-06T14:29:30Z")) - .withScheduleWindowDuration(2049992940); - model = BinaryData.fromObject(model).toObject(HourlySchedule.class); - Assertions.assertEquals(2146264945, model.interval()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-06T14:29:30Z"), model.scheduleWindowStartTime()); - Assertions.assertEquals(2049992940, model.scheduleWindowDuration()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaaSvmContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaaSvmContainerTests.java deleted file mode 100644 index f826586c674fc..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaaSvmContainerTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaaSvmContainer; -import org.junit.jupiter.api.Assertions; - -public final class IaaSvmContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IaaSvmContainer model = BinaryData.fromString( - "{\"containerType\":\"IaasVMContainer\",\"virtualMachineId\":\"flrytswfpfm\",\"virtualMachineVersion\":\"ycxnmskw\",\"resourceGroup\":\"jjyslurlps\",\"friendlyName\":\"kvp\",\"backupManagementType\":\"AzureStorage\",\"registrationStatus\":\"slsrhmpq\",\"healthStatus\":\"wskondcbrwimuvqe\",\"protectableObjectType\":\"so\"}") - .toObject(IaaSvmContainer.class); - Assertions.assertEquals("kvp", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, model.backupManagementType()); - Assertions.assertEquals("slsrhmpq", model.registrationStatus()); - Assertions.assertEquals("wskondcbrwimuvqe", model.healthStatus()); - Assertions.assertEquals("so", model.protectableObjectType()); - Assertions.assertEquals("flrytswfpfm", model.virtualMachineId()); - Assertions.assertEquals("ycxnmskw", model.virtualMachineVersion()); - Assertions.assertEquals("jjyslurlps", model.resourceGroup()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IaaSvmContainer model = new IaaSvmContainer().withFriendlyName("kvp") - .withBackupManagementType(BackupManagementType.AZURE_STORAGE) - .withRegistrationStatus("slsrhmpq") - .withHealthStatus("wskondcbrwimuvqe") - .withProtectableObjectType("so") - .withVirtualMachineId("flrytswfpfm") - .withVirtualMachineVersion("ycxnmskw") - .withResourceGroup("jjyslurlps"); - model = BinaryData.fromObject(model).toObject(IaaSvmContainer.class); - Assertions.assertEquals("kvp", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, model.backupManagementType()); - Assertions.assertEquals("slsrhmpq", model.registrationStatus()); - Assertions.assertEquals("wskondcbrwimuvqe", model.healthStatus()); - Assertions.assertEquals("so", model.protectableObjectType()); - Assertions.assertEquals("flrytswfpfm", model.virtualMachineId()); - Assertions.assertEquals("ycxnmskw", model.virtualMachineVersion()); - Assertions.assertEquals("jjyslurlps", model.resourceGroup()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaaSvmProtectableItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaaSvmProtectableItemTests.java deleted file mode 100644 index 3798f55c4c55e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaaSvmProtectableItemTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaaSvmProtectableItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class IaaSvmProtectableItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IaaSvmProtectableItem model = BinaryData.fromString( - "{\"protectableItemType\":\"IaaSVMProtectableItem\",\"virtualMachineId\":\"jkxibda\",\"virtualMachineVersion\":\"rkmdyom\",\"resourceGroup\":\"fbvfbhdy\",\"backupManagementType\":\"hpwpgddeimawzovg\",\"workloadType\":\"um\",\"friendlyName\":\"kjcjcaztbwsnsqow\",\"protectionState\":\"Protected\"}") - .toObject(IaaSvmProtectableItem.class); - Assertions.assertEquals("hpwpgddeimawzovg", model.backupManagementType()); - Assertions.assertEquals("um", model.workloadType()); - Assertions.assertEquals("kjcjcaztbwsnsqow", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("jkxibda", model.virtualMachineId()); - Assertions.assertEquals("rkmdyom", model.virtualMachineVersion()); - Assertions.assertEquals("fbvfbhdy", model.resourceGroup()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IaaSvmProtectableItem model = new IaaSvmProtectableItem().withBackupManagementType("hpwpgddeimawzovg") - .withWorkloadType("um") - .withFriendlyName("kjcjcaztbwsnsqow") - .withProtectionState(ProtectionStatus.PROTECTED) - .withVirtualMachineId("jkxibda") - .withVirtualMachineVersion("rkmdyom") - .withResourceGroup("fbvfbhdy"); - model = BinaryData.fromObject(model).toObject(IaaSvmProtectableItem.class); - Assertions.assertEquals("hpwpgddeimawzovg", model.backupManagementType()); - Assertions.assertEquals("um", model.workloadType()); - Assertions.assertEquals("kjcjcaztbwsnsqow", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.protectionState()); - Assertions.assertEquals("jkxibda", model.virtualMachineId()); - Assertions.assertEquals("rkmdyom", model.virtualMachineVersion()); - Assertions.assertEquals("fbvfbhdy", model.resourceGroup()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaasVMBackupRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaasVMBackupRequestTests.java deleted file mode 100644 index 3c8cebbc4130b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaasVMBackupRequestTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaasVMBackupRequest; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class IaasVMBackupRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IaasVMBackupRequest model = BinaryData - .fromString( - "{\"objectType\":\"IaasVMBackupRequest\",\"recoveryPointExpiryTimeInUTC\":\"2021-01-13T02:45:42Z\"}") - .toObject(IaasVMBackupRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-13T02:45:42Z"), model.recoveryPointExpiryTimeInUtc()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IaasVMBackupRequest model - = new IaasVMBackupRequest().withRecoveryPointExpiryTimeInUtc(OffsetDateTime.parse("2021-01-13T02:45:42Z")); - model = BinaryData.fromObject(model).toObject(IaasVMBackupRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-13T02:45:42Z"), model.recoveryPointExpiryTimeInUtc()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaasVmilrRegistrationRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaasVmilrRegistrationRequestTests.java deleted file mode 100644 index f6db22db08395..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IaasVmilrRegistrationRequestTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.IaasVmilrRegistrationRequest; -import org.junit.jupiter.api.Assertions; - -public final class IaasVmilrRegistrationRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IaasVmilrRegistrationRequest model = BinaryData.fromString( - "{\"objectType\":\"IaasVMILRRegistrationRequest\",\"recoveryPointId\":\"nggiycwkdtaa\",\"virtualMachineId\":\"wfekaumrrqmb\",\"initiatorName\":\"qkratbnxwbjsid\",\"renewExistingRegistration\":false}") - .toObject(IaasVmilrRegistrationRequest.class); - Assertions.assertEquals("nggiycwkdtaa", model.recoveryPointId()); - Assertions.assertEquals("wfekaumrrqmb", model.virtualMachineId()); - Assertions.assertEquals("qkratbnxwbjsid", model.initiatorName()); - Assertions.assertEquals(false, model.renewExistingRegistration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IaasVmilrRegistrationRequest model = new IaasVmilrRegistrationRequest().withRecoveryPointId("nggiycwkdtaa") - .withVirtualMachineId("wfekaumrrqmb") - .withInitiatorName("qkratbnxwbjsid") - .withRenewExistingRegistration(false); - model = BinaryData.fromObject(model).toObject(IaasVmilrRegistrationRequest.class); - Assertions.assertEquals("nggiycwkdtaa", model.recoveryPointId()); - Assertions.assertEquals("wfekaumrrqmb", model.virtualMachineId()); - Assertions.assertEquals("qkratbnxwbjsid", model.initiatorName()); - Assertions.assertEquals(false, model.renewExistingRegistration()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IdentityBasedRestoreDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IdentityBasedRestoreDetailsTests.java deleted file mode 100644 index 1a05da8f50840..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IdentityBasedRestoreDetailsTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.IdentityBasedRestoreDetails; -import org.junit.jupiter.api.Assertions; - -public final class IdentityBasedRestoreDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IdentityBasedRestoreDetails model - = BinaryData.fromString("{\"objectType\":\"qirwrweoox\",\"targetStorageAccountId\":\"i\"}") - .toObject(IdentityBasedRestoreDetails.class); - Assertions.assertEquals("qirwrweoox", model.objectType()); - Assertions.assertEquals("i", model.targetStorageAccountId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IdentityBasedRestoreDetails model - = new IdentityBasedRestoreDetails().withObjectType("qirwrweoox").withTargetStorageAccountId("i"); - model = BinaryData.fromObject(model).toObject(IdentityBasedRestoreDetails.class); - Assertions.assertEquals("qirwrweoox", model.objectType()); - Assertions.assertEquals("i", model.targetStorageAccountId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IdentityInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IdentityInfoTests.java deleted file mode 100644 index bdf75f0bf1ee3..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IdentityInfoTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.IdentityInfo; -import org.junit.jupiter.api.Assertions; - -public final class IdentityInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IdentityInfo model = BinaryData - .fromString("{\"isSystemAssignedIdentity\":false,\"managedIdentityResourceId\":\"rsnewmozqvbubqma\"}") - .toObject(IdentityInfo.class); - Assertions.assertEquals(false, model.isSystemAssignedIdentity()); - Assertions.assertEquals("rsnewmozqvbubqma", model.managedIdentityResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IdentityInfo model - = new IdentityInfo().withIsSystemAssignedIdentity(false).withManagedIdentityResourceId("rsnewmozqvbubqma"); - model = BinaryData.fromObject(model).toObject(IdentityInfo.class); - Assertions.assertEquals(false, model.isSystemAssignedIdentity()); - Assertions.assertEquals("rsnewmozqvbubqma", model.managedIdentityResourceId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IlrRequestResourceTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IlrRequestResourceTests.java deleted file mode 100644 index 25ebdb799eda9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IlrRequestResourceTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequestResource; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class IlrRequestResourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IlrRequestResource model = BinaryData.fromString( - "{\"properties\":{\"objectType\":\"IlrRequest\"},\"eTag\":\"sdbnwdcfhucqdpf\",\"location\":\"vglsbjjca\",\"tags\":{\"xqtvcofu\":\"bvtvudutncormr\",\"vkg\":\"f\"},\"id\":\"u\",\"name\":\"gdknnqv\",\"type\":\"aznqntoru\"}") - .toObject(IlrRequestResource.class); - Assertions.assertEquals("vglsbjjca", model.location()); - Assertions.assertEquals("bvtvudutncormr", model.tags().get("xqtvcofu")); - Assertions.assertEquals("sdbnwdcfhucqdpf", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IlrRequestResource model = new IlrRequestResource().withLocation("vglsbjjca") - .withTags(mapOf("xqtvcofu", "bvtvudutncormr", "vkg", "f")) - .withProperties(new IlrRequest()) - .withEtag("sdbnwdcfhucqdpf"); - model = BinaryData.fromObject(model).toObject(IlrRequestResource.class); - Assertions.assertEquals("vglsbjjca", model.location()); - Assertions.assertEquals("bvtvudutncormr", model.tags().get("xqtvcofu")); - Assertions.assertEquals("sdbnwdcfhucqdpf", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IlrRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IlrRequestTests.java deleted file mode 100644 index 61c077ff3ad54..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/IlrRequestTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequest; - -public final class IlrRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IlrRequest model = BinaryData.fromString("{\"objectType\":\"IlrRequest\"}").toObject(IlrRequest.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IlrRequest model = new IlrRequest(); - model = BinaryData.fromObject(model).toObject(IlrRequest.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/InstantItemRecoveryTargetTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/InstantItemRecoveryTargetTests.java deleted file mode 100644 index e120fea45776e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/InstantItemRecoveryTargetTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientScriptForConnect; -import com.azure.resourcemanager.recoveryservicesbackup.models.InstantItemRecoveryTarget; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class InstantItemRecoveryTargetTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InstantItemRecoveryTarget model = BinaryData.fromString( - "{\"clientScripts\":[{\"scriptContent\":\"kso\",\"scriptExtension\":\"gogewijymrh\",\"osType\":\"u\",\"url\":\"zkye\",\"scriptNameSuffix\":\"f\"},{\"scriptContent\":\"hhhqosm\",\"scriptExtension\":\"jkutycyarnr\",\"osType\":\"hguabzoghktdp\",\"url\":\"z\",\"scriptNameSuffix\":\"oeocnhzqrott\"}]}") - .toObject(InstantItemRecoveryTarget.class); - Assertions.assertEquals("kso", model.clientScripts().get(0).scriptContent()); - Assertions.assertEquals("gogewijymrh", model.clientScripts().get(0).scriptExtension()); - Assertions.assertEquals("u", model.clientScripts().get(0).osType()); - Assertions.assertEquals("zkye", model.clientScripts().get(0).url()); - Assertions.assertEquals("f", model.clientScripts().get(0).scriptNameSuffix()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InstantItemRecoveryTarget model = new InstantItemRecoveryTarget().withClientScripts(Arrays.asList( - new ClientScriptForConnect().withScriptContent("kso") - .withScriptExtension("gogewijymrh") - .withOsType("u") - .withUrl("zkye") - .withScriptNameSuffix("f"), - new ClientScriptForConnect().withScriptContent("hhhqosm") - .withScriptExtension("jkutycyarnr") - .withOsType("hguabzoghktdp") - .withUrl("z") - .withScriptNameSuffix("oeocnhzqrott"))); - model = BinaryData.fromObject(model).toObject(InstantItemRecoveryTarget.class); - Assertions.assertEquals("kso", model.clientScripts().get(0).scriptContent()); - Assertions.assertEquals("gogewijymrh", model.clientScripts().get(0).scriptExtension()); - Assertions.assertEquals("u", model.clientScripts().get(0).osType()); - Assertions.assertEquals("zkye", model.clientScripts().get(0).url()); - Assertions.assertEquals("f", model.clientScripts().get(0).scriptNameSuffix()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/InstantRPAdditionalDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/InstantRPAdditionalDetailsTests.java deleted file mode 100644 index 55638c1c7f689..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/InstantRPAdditionalDetailsTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.InstantRPAdditionalDetails; -import org.junit.jupiter.api.Assertions; - -public final class InstantRPAdditionalDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InstantRPAdditionalDetails model - = BinaryData.fromString("{\"azureBackupRGNamePrefix\":\"kxn\",\"azureBackupRGNameSuffix\":\"dabg\"}") - .toObject(InstantRPAdditionalDetails.class); - Assertions.assertEquals("kxn", model.azureBackupRGNamePrefix()); - Assertions.assertEquals("dabg", model.azureBackupRGNameSuffix()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InstantRPAdditionalDetails model - = new InstantRPAdditionalDetails().withAzureBackupRGNamePrefix("kxn").withAzureBackupRGNameSuffix("dabg"); - model = BinaryData.fromObject(model).toObject(InstantRPAdditionalDetails.class); - Assertions.assertEquals("kxn", model.azureBackupRGNamePrefix()); - Assertions.assertEquals("dabg", model.azureBackupRGNameSuffix()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsProvisionWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsProvisionWithResponseMockTests.java deleted file mode 100644 index 7ea04d80f0f43..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsProvisionWithResponseMockTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.IlrRequestResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ItemLevelRecoveryConnectionsProvisionWithResponseMockTests { - @Test - public void testProvisionWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.itemLevelRecoveryConnections() - .provisionWithResponse("l", "dvatdavuqm", "bym", "fobjlquvjezcj", "mvpsimioyo", "glkmiqwnnr", - new IlrRequestResource().withLocation("qpspkladydgnha") - .withTags(mapOf("mabeddqilwgdf", "ukexzgpm")) - .withProperties(new IlrRequest()) - .withEtag("ibb"), - com.azure.core.util.Context.NONE); - - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsRevokeWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsRevokeWithResponseMockTests.java deleted file mode 100644 index 3d9250e67b708..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ItemLevelRecoveryConnectionsRevokeWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ItemLevelRecoveryConnectionsRevokeWithResponseMockTests { - @Test - public void testRevokeWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.itemLevelRecoveryConnections() - .revokeWithResponse("jj", "h", "ci", "kwdvbtb", "ekqhs", "htfpwpqb", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobCancellationsTriggerWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobCancellationsTriggerWithResponseMockTests.java deleted file mode 100644 index ac9cad6ac2375..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobCancellationsTriggerWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class JobCancellationsTriggerWithResponseMockTests { - @Test - public void testTriggerWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.jobCancellations() - .triggerWithResponse("qvmvuaytuadxkxe", "bwpntghy", "sa", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobDetailsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobDetailsGetWithResponseMockTests.java deleted file mode 100644 index 31971a6cd05d5..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobDetailsGetWithResponseMockTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.JobResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class JobDetailsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"jobType\":\"Job\",\"entityFriendlyName\":\"whlwy\",\"backupManagementType\":\"AzureBackupServer\",\"operation\":\"zocrdzgczeu\",\"status\":\"g\",\"startTime\":\"2021-08-10T05:32:33Z\",\"endTime\":\"2021-11-23T04:41:38Z\",\"activityId\":\"ttie\"},\"eTag\":\"i\",\"location\":\"uvny\",\"tags\":{\"yri\":\"gix\",\"lqtxnrflkndrn\":\"lgmgbe\",\"hdaqotwfhipxwg\":\"pgfjo\",\"zuu\":\"abvcipowzaf\"},\"id\":\"ljcirvpefycdvei\",\"name\":\"itjn\",\"type\":\"xzajlnsjhwjuyxxb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - JobResource response = manager.jobDetails() - .getWithResponse("ilm", "xdqaolfylnkkb", "pjvlywltmfwo", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("uvny", response.location()); - Assertions.assertEquals("gix", response.tags().get("yri")); - Assertions.assertEquals("whlwy", response.properties().entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, response.properties().backupManagementType()); - Assertions.assertEquals("zocrdzgczeu", response.properties().operation()); - Assertions.assertEquals("g", response.properties().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-10T05:32:33Z"), response.properties().startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-23T04:41:38Z"), response.properties().endTime()); - Assertions.assertEquals("ttie", response.properties().activityId()); - Assertions.assertEquals("i", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index ee790d5aa2c29..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class JobOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.jobOperationResults() - .getWithResponse("cdrnxsl", "vlzladl", "x", "pbqhvfdqqjwkr", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobResourceInnerTests.java deleted file mode 100644 index 0b9414a0f0d22..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobResourceInnerTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.JobResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.Job; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class JobResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - JobResourceInner model = BinaryData.fromString( - "{\"properties\":{\"jobType\":\"Job\",\"entityFriendlyName\":\"iotwmcdytdxwit\",\"backupManagementType\":\"Invalid\",\"operation\":\"awgqwgxhni\",\"status\":\"x\",\"startTime\":\"2021-09-13T09:37:01Z\",\"endTime\":\"2021-04-10T12:35:25Z\",\"activityId\":\"gklwn\"},\"eTag\":\"hjdauwhvylwz\",\"location\":\"tdhxujznbmpowuwp\",\"tags\":{\"alupjm\":\"lve\",\"iplrbpbewtghfgb\":\"hfxobbcswsrtj\",\"wxzvlvqhjkb\":\"c\",\"iebwwaloayqcgwrt\":\"gibtnm\"},\"id\":\"j\",\"name\":\"zg\",\"type\":\"yzm\"}") - .toObject(JobResourceInner.class); - Assertions.assertEquals("tdhxujznbmpowuwp", model.location()); - Assertions.assertEquals("lve", model.tags().get("alupjm")); - Assertions.assertEquals("iotwmcdytdxwit", model.properties().entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.INVALID, model.properties().backupManagementType()); - Assertions.assertEquals("awgqwgxhni", model.properties().operation()); - Assertions.assertEquals("x", model.properties().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-13T09:37:01Z"), model.properties().startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-10T12:35:25Z"), model.properties().endTime()); - Assertions.assertEquals("gklwn", model.properties().activityId()); - Assertions.assertEquals("hjdauwhvylwz", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - JobResourceInner model = new JobResourceInner().withLocation("tdhxujznbmpowuwp") - .withTags(mapOf("alupjm", "lve", "iplrbpbewtghfgb", "hfxobbcswsrtj", "wxzvlvqhjkb", "c", "iebwwaloayqcgwrt", - "gibtnm")) - .withProperties(new Job().withEntityFriendlyName("iotwmcdytdxwit") - .withBackupManagementType(BackupManagementType.INVALID) - .withOperation("awgqwgxhni") - .withStatus("x") - .withStartTime(OffsetDateTime.parse("2021-09-13T09:37:01Z")) - .withEndTime(OffsetDateTime.parse("2021-04-10T12:35:25Z")) - .withActivityId("gklwn")) - .withEtag("hjdauwhvylwz"); - model = BinaryData.fromObject(model).toObject(JobResourceInner.class); - Assertions.assertEquals("tdhxujznbmpowuwp", model.location()); - Assertions.assertEquals("lve", model.tags().get("alupjm")); - Assertions.assertEquals("iotwmcdytdxwit", model.properties().entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.INVALID, model.properties().backupManagementType()); - Assertions.assertEquals("awgqwgxhni", model.properties().operation()); - Assertions.assertEquals("x", model.properties().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-13T09:37:01Z"), model.properties().startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-10T12:35:25Z"), model.properties().endTime()); - Assertions.assertEquals("gklwn", model.properties().activityId()); - Assertions.assertEquals("hjdauwhvylwz", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobResourceListTests.java deleted file mode 100644 index 15b213f4d20fb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobResourceListTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.JobResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.Job; -import com.azure.resourcemanager.recoveryservicesbackup.models.JobResourceList; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class JobResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - JobResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"jobType\":\"Job\",\"entityFriendlyName\":\"uzbpzkafku\",\"backupManagementType\":\"AzureIaasVM\",\"operation\":\"nwbmeh\",\"status\":\"eyvjusrtslhspkde\",\"startTime\":\"2021-01-28T17:00:30Z\",\"endTime\":\"2021-02-20T10:46:34Z\",\"activityId\":\"xagkvtmelmqkrh\"},\"eTag\":\"vljua\",\"location\":\"aquhcdhm\",\"tags\":{\"fadmws\":\"laexqp\",\"lf\":\"crgvxpvgom\",\"ali\":\"isgwbnbbeldawkz\",\"hashsfwxosow\":\"urqhaka\"},\"id\":\"xcug\",\"name\":\"cjooxdjebwpucwwf\",\"type\":\"ovbvmeueciv\"}],\"nextLink\":\"zceuojgjrw\"}") - .toObject(JobResourceList.class); - Assertions.assertEquals("zceuojgjrw", model.nextLink()); - Assertions.assertEquals("aquhcdhm", model.value().get(0).location()); - Assertions.assertEquals("laexqp", model.value().get(0).tags().get("fadmws")); - Assertions.assertEquals("uzbpzkafku", model.value().get(0).properties().entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_IAAS_VM, - model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("nwbmeh", model.value().get(0).properties().operation()); - Assertions.assertEquals("eyvjusrtslhspkde", model.value().get(0).properties().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-28T17:00:30Z"), - model.value().get(0).properties().startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-20T10:46:34Z"), - model.value().get(0).properties().endTime()); - Assertions.assertEquals("xagkvtmelmqkrh", model.value().get(0).properties().activityId()); - Assertions.assertEquals("vljua", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - JobResourceList model = new JobResourceList().withNextLink("zceuojgjrw") - .withValue(Arrays.asList(new JobResourceInner().withLocation("aquhcdhm") - .withTags( - mapOf("fadmws", "laexqp", "lf", "crgvxpvgom", "ali", "isgwbnbbeldawkz", "hashsfwxosow", "urqhaka")) - .withProperties(new Job().withEntityFriendlyName("uzbpzkafku") - .withBackupManagementType(BackupManagementType.AZURE_IAAS_VM) - .withOperation("nwbmeh") - .withStatus("eyvjusrtslhspkde") - .withStartTime(OffsetDateTime.parse("2021-01-28T17:00:30Z")) - .withEndTime(OffsetDateTime.parse("2021-02-20T10:46:34Z")) - .withActivityId("xagkvtmelmqkrh")) - .withEtag("vljua"))); - model = BinaryData.fromObject(model).toObject(JobResourceList.class); - Assertions.assertEquals("zceuojgjrw", model.nextLink()); - Assertions.assertEquals("aquhcdhm", model.value().get(0).location()); - Assertions.assertEquals("laexqp", model.value().get(0).tags().get("fadmws")); - Assertions.assertEquals("uzbpzkafku", model.value().get(0).properties().entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_IAAS_VM, - model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("nwbmeh", model.value().get(0).properties().operation()); - Assertions.assertEquals("eyvjusrtslhspkde", model.value().get(0).properties().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-28T17:00:30Z"), - model.value().get(0).properties().startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-20T10:46:34Z"), - model.value().get(0).properties().endTime()); - Assertions.assertEquals("xagkvtmelmqkrh", model.value().get(0).properties().activityId()); - Assertions.assertEquals("vljua", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobTests.java deleted file mode 100644 index 17004795dc86c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.Job; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class JobTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Job model = BinaryData.fromString( - "{\"jobType\":\"Job\",\"entityFriendlyName\":\"xongmtsavjcbpwxq\",\"backupManagementType\":\"DefaultBackup\",\"operation\":\"nftguvriuhpr\",\"status\":\"dyvxqtayriww\",\"startTime\":\"2021-05-20T03:51:26Z\",\"endTime\":\"2021-02-13T03:31:18Z\",\"activityId\":\"xrmcqibycnojvk\"}") - .toObject(Job.class); - Assertions.assertEquals("xongmtsavjcbpwxq", model.entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("nftguvriuhpr", model.operation()); - Assertions.assertEquals("dyvxqtayriww", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-20T03:51:26Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-13T03:31:18Z"), model.endTime()); - Assertions.assertEquals("xrmcqibycnojvk", model.activityId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Job model = new Job().withEntityFriendlyName("xongmtsavjcbpwxq") - .withBackupManagementType(BackupManagementType.DEFAULT_BACKUP) - .withOperation("nftguvriuhpr") - .withStatus("dyvxqtayriww") - .withStartTime(OffsetDateTime.parse("2021-05-20T03:51:26Z")) - .withEndTime(OffsetDateTime.parse("2021-02-13T03:31:18Z")) - .withActivityId("xrmcqibycnojvk"); - model = BinaryData.fromObject(model).toObject(Job.class); - Assertions.assertEquals("xongmtsavjcbpwxq", model.entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.backupManagementType()); - Assertions.assertEquals("nftguvriuhpr", model.operation()); - Assertions.assertEquals("dyvxqtayriww", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-20T03:51:26Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-13T03:31:18Z"), model.endTime()); - Assertions.assertEquals("xrmcqibycnojvk", model.activityId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobsExportWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobsExportWithResponseMockTests.java deleted file mode 100644 index b5c000ff6b12f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/JobsExportWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class JobsExportWithResponseMockTests { - @Test - public void testExportWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.jobs().exportWithResponse("wseivmakxh", "so", "ljuxl", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ListRecoveryPointsRecommendedForMoveRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ListRecoveryPointsRecommendedForMoveRequestTests.java deleted file mode 100644 index c1766f7cd4aeb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ListRecoveryPointsRecommendedForMoveRequestTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ListRecoveryPointsRecommendedForMoveRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ListRecoveryPointsRecommendedForMoveRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ListRecoveryPointsRecommendedForMoveRequest model - = BinaryData.fromString("{\"objectType\":\"elvezrypq\",\"excludedRPList\":[\"eokerqwkyhkobopg\"]}") - .toObject(ListRecoveryPointsRecommendedForMoveRequest.class); - Assertions.assertEquals("elvezrypq", model.objectType()); - Assertions.assertEquals("eokerqwkyhkobopg", model.excludedRPList().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ListRecoveryPointsRecommendedForMoveRequest model - = new ListRecoveryPointsRecommendedForMoveRequest().withObjectType("elvezrypq") - .withExcludedRPList(Arrays.asList("eokerqwkyhkobopg")); - model = BinaryData.fromObject(model).toObject(ListRecoveryPointsRecommendedForMoveRequest.class); - Assertions.assertEquals("elvezrypq", model.objectType()); - Assertions.assertEquals("eokerqwkyhkobopg", model.excludedRPList().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LogSchedulePolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LogSchedulePolicyTests.java deleted file mode 100644 index a141ebd3e78cf..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LogSchedulePolicyTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.LogSchedulePolicy; -import org.junit.jupiter.api.Assertions; - -public final class LogSchedulePolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LogSchedulePolicy model = BinaryData - .fromString("{\"schedulePolicyType\":\"LogSchedulePolicy\",\"scheduleFrequencyInMins\":650202313}") - .toObject(LogSchedulePolicy.class); - Assertions.assertEquals(650202313, model.scheduleFrequencyInMins()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LogSchedulePolicy model = new LogSchedulePolicy().withScheduleFrequencyInMins(650202313); - model = BinaryData.fromObject(model).toObject(LogSchedulePolicy.class); - Assertions.assertEquals(650202313, model.scheduleFrequencyInMins()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LongTermRetentionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LongTermRetentionPolicyTests.java deleted file mode 100644 index 3d4770bf955d7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LongTermRetentionPolicyTests.java +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionSchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.Day; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.LongTermRetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.MonthlyRetentionSchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.MonthOfYear; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionScheduleFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionSchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; -import com.azure.resourcemanager.recoveryservicesbackup.models.YearlyRetentionSchedule; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class LongTermRetentionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LongTermRetentionPolicy model = BinaryData.fromString( - "{\"retentionPolicyType\":\"LongTermRetentionPolicy\",\"dailySchedule\":{\"retentionTimes\":[\"2021-02-14T03:26:32Z\",\"2021-09-16T23:50:41Z\"],\"retentionDuration\":{\"count\":1427388338,\"durationType\":\"Invalid\"}},\"weeklySchedule\":{\"daysOfTheWeek\":[\"Tuesday\",\"Thursday\",\"Tuesday\"],\"retentionTimes\":[\"2021-01-10T11:19:20Z\"],\"retentionDuration\":{\"count\":1781943414,\"durationType\":\"Weeks\"}},\"monthlySchedule\":{\"retentionScheduleFormatType\":\"Weekly\",\"retentionScheduleDaily\":{\"daysOfTheMonth\":[{\"date\":1618325491,\"isLast\":false},{\"date\":1716772830,\"isLast\":false}]},\"retentionScheduleWeekly\":{\"daysOfTheWeek\":[\"Wednesday\",\"Thursday\",\"Friday\"],\"weeksOfTheMonth\":[\"Last\",\"Fourth\"]},\"retentionTimes\":[\"2021-09-12T05:33:47Z\",\"2021-11-24T18:23:37Z\"],\"retentionDuration\":{\"count\":415193474,\"durationType\":\"Years\"}},\"yearlySchedule\":{\"retentionScheduleFormatType\":\"Invalid\",\"monthsOfYear\":[\"August\",\"June\",\"Invalid\",\"February\"],\"retentionScheduleDaily\":{\"daysOfTheMonth\":[{\"date\":1614916869,\"isLast\":false},{\"date\":196661330,\"isLast\":true},{\"date\":1147500970,\"isLast\":false},{\"date\":449882255,\"isLast\":false}]},\"retentionScheduleWeekly\":{\"daysOfTheWeek\":[\"Saturday\"],\"weeksOfTheMonth\":[\"Second\",\"Last\",\"Invalid\"]},\"retentionTimes\":[\"2021-04-15T06:58:45Z\",\"2021-02-02T03:22:38Z\",\"2021-08-15T22:01:32Z\"],\"retentionDuration\":{\"count\":694984034,\"durationType\":\"Months\"}}}") - .toObject(LongTermRetentionPolicy.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-14T03:26:32Z"), - model.dailySchedule().retentionTimes().get(0)); - Assertions.assertEquals(1427388338, model.dailySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.INVALID, - model.dailySchedule().retentionDuration().durationType()); - Assertions.assertEquals(DayOfWeek.TUESDAY, model.weeklySchedule().daysOfTheWeek().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-10T11:19:20Z"), - model.weeklySchedule().retentionTimes().get(0)); - Assertions.assertEquals(1781943414, model.weeklySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.weeklySchedule().retentionDuration().durationType()); - Assertions.assertEquals(RetentionScheduleFormat.WEEKLY, model.monthlySchedule().retentionScheduleFormatType()); - Assertions.assertEquals(1618325491, - model.monthlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, - model.monthlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.WEDNESDAY, - model.monthlySchedule().retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.LAST, - model.monthlySchedule().retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-12T05:33:47Z"), - model.monthlySchedule().retentionTimes().get(0)); - Assertions.assertEquals(415193474, model.monthlySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.YEARS, - model.monthlySchedule().retentionDuration().durationType()); - Assertions.assertEquals(RetentionScheduleFormat.INVALID, model.yearlySchedule().retentionScheduleFormatType()); - Assertions.assertEquals(MonthOfYear.AUGUST, model.yearlySchedule().monthsOfYear().get(0)); - Assertions.assertEquals(1614916869, - model.yearlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, - model.yearlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.SATURDAY, - model.yearlySchedule().retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.SECOND, - model.yearlySchedule().retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-15T06:58:45Z"), - model.yearlySchedule().retentionTimes().get(0)); - Assertions.assertEquals(694984034, model.yearlySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.MONTHS, - model.yearlySchedule().retentionDuration().durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LongTermRetentionPolicy model = new LongTermRetentionPolicy() - .withDailySchedule(new DailyRetentionSchedule() - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-02-14T03:26:32Z"), - OffsetDateTime.parse("2021-09-16T23:50:41Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(1427388338).withDurationType(RetentionDurationType.INVALID))) - .withWeeklySchedule(new WeeklyRetentionSchedule() - .withDaysOfTheWeek(Arrays.asList(DayOfWeek.TUESDAY, DayOfWeek.THURSDAY, DayOfWeek.TUESDAY)) - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-01-10T11:19:20Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(1781943414).withDurationType(RetentionDurationType.WEEKS))) - .withMonthlySchedule( - new MonthlyRetentionSchedule().withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY) - .withRetentionScheduleDaily(new DailyRetentionFormat() - .withDaysOfTheMonth(Arrays.asList(new Day().withDate(1618325491).withIsLast(false), - new Day().withDate(1716772830).withIsLast(false)))) - .withRetentionScheduleWeekly(new WeeklyRetentionFormat() - .withDaysOfTheWeek(Arrays.asList(DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY)) - .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.LAST, WeekOfMonth.FOURTH))) - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-09-12T05:33:47Z"), - OffsetDateTime.parse("2021-11-24T18:23:37Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(415193474).withDurationType(RetentionDurationType.YEARS))) - .withYearlySchedule(new YearlyRetentionSchedule() - .withRetentionScheduleFormatType(RetentionScheduleFormat.INVALID) - .withMonthsOfYear( - Arrays.asList(MonthOfYear.AUGUST, MonthOfYear.JUNE, MonthOfYear.INVALID, MonthOfYear.FEBRUARY)) - .withRetentionScheduleDaily(new DailyRetentionFormat().withDaysOfTheMonth(Arrays.asList( - new Day().withDate(1614916869).withIsLast(false), new Day().withDate(196661330).withIsLast(true), - new Day().withDate(1147500970).withIsLast(false), new Day().withDate(449882255).withIsLast(false)))) - .withRetentionScheduleWeekly( - new WeeklyRetentionFormat().withDaysOfTheWeek(Arrays.asList(DayOfWeek.SATURDAY)) - .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.SECOND, WeekOfMonth.LAST, WeekOfMonth.INVALID))) - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-04-15T06:58:45Z"), - OffsetDateTime.parse("2021-02-02T03:22:38Z"), OffsetDateTime.parse("2021-08-15T22:01:32Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(694984034).withDurationType(RetentionDurationType.MONTHS))); - model = BinaryData.fromObject(model).toObject(LongTermRetentionPolicy.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-14T03:26:32Z"), - model.dailySchedule().retentionTimes().get(0)); - Assertions.assertEquals(1427388338, model.dailySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.INVALID, - model.dailySchedule().retentionDuration().durationType()); - Assertions.assertEquals(DayOfWeek.TUESDAY, model.weeklySchedule().daysOfTheWeek().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-10T11:19:20Z"), - model.weeklySchedule().retentionTimes().get(0)); - Assertions.assertEquals(1781943414, model.weeklySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.weeklySchedule().retentionDuration().durationType()); - Assertions.assertEquals(RetentionScheduleFormat.WEEKLY, model.monthlySchedule().retentionScheduleFormatType()); - Assertions.assertEquals(1618325491, - model.monthlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, - model.monthlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.WEDNESDAY, - model.monthlySchedule().retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.LAST, - model.monthlySchedule().retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-12T05:33:47Z"), - model.monthlySchedule().retentionTimes().get(0)); - Assertions.assertEquals(415193474, model.monthlySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.YEARS, - model.monthlySchedule().retentionDuration().durationType()); - Assertions.assertEquals(RetentionScheduleFormat.INVALID, model.yearlySchedule().retentionScheduleFormatType()); - Assertions.assertEquals(MonthOfYear.AUGUST, model.yearlySchedule().monthsOfYear().get(0)); - Assertions.assertEquals(1614916869, - model.yearlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, - model.yearlySchedule().retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.SATURDAY, - model.yearlySchedule().retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.SECOND, - model.yearlySchedule().retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-15T06:58:45Z"), - model.yearlySchedule().retentionTimes().get(0)); - Assertions.assertEquals(694984034, model.yearlySchedule().retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.MONTHS, - model.yearlySchedule().retentionDuration().durationType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LongTermSchedulePolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LongTermSchedulePolicyTests.java deleted file mode 100644 index 0304fc7cefece..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/LongTermSchedulePolicyTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.LongTermSchedulePolicy; - -public final class LongTermSchedulePolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LongTermSchedulePolicy model = BinaryData.fromString("{\"schedulePolicyType\":\"LongTermSchedulePolicy\"}") - .toObject(LongTermSchedulePolicy.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LongTermSchedulePolicy model = new LongTermSchedulePolicy(); - model = BinaryData.fromObject(model).toObject(LongTermSchedulePolicy.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabContainerExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabContainerExtendedInfoTests.java deleted file mode 100644 index 6239643c01a36..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabContainerExtendedInfoTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupItemType; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabContainerExtendedInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MabContainerExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabContainerExtendedInfo model = BinaryData.fromString( - "{\"lastRefreshedAt\":\"2021-08-16T13:25:14Z\",\"backupItemType\":\"SAPHanaDatabase\",\"backupItems\":[\"hhhqxuwyv\",\"acoyvivbsizusjs\"],\"policyName\":\"bscm\",\"lastBackupStatus\":\"zijiufehgmv\"}") - .toObject(MabContainerExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-16T13:25:14Z"), model.lastRefreshedAt()); - Assertions.assertEquals(BackupItemType.SAPHANA_DATABASE, model.backupItemType()); - Assertions.assertEquals("hhhqxuwyv", model.backupItems().get(0)); - Assertions.assertEquals("bscm", model.policyName()); - Assertions.assertEquals("zijiufehgmv", model.lastBackupStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabContainerExtendedInfo model - = new MabContainerExtendedInfo().withLastRefreshedAt(OffsetDateTime.parse("2021-08-16T13:25:14Z")) - .withBackupItemType(BackupItemType.SAPHANA_DATABASE) - .withBackupItems(Arrays.asList("hhhqxuwyv", "acoyvivbsizusjs")) - .withPolicyName("bscm") - .withLastBackupStatus("zijiufehgmv"); - model = BinaryData.fromObject(model).toObject(MabContainerExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-16T13:25:14Z"), model.lastRefreshedAt()); - Assertions.assertEquals(BackupItemType.SAPHANA_DATABASE, model.backupItemType()); - Assertions.assertEquals("hhhqxuwyv", model.backupItems().get(0)); - Assertions.assertEquals("bscm", model.policyName()); - Assertions.assertEquals("zijiufehgmv", model.lastBackupStatus()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabErrorInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabErrorInfoTests.java deleted file mode 100644 index e6510961844c1..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabErrorInfoTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabErrorInfo; - -public final class MabErrorInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabErrorInfo model - = BinaryData.fromString("{\"errorString\":\"narfdlpukhpyrn\",\"recommendations\":[\"jcpeogkhnmg\",\"ro\"]}") - .toObject(MabErrorInfo.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabErrorInfo model = new MabErrorInfo(); - model = BinaryData.fromObject(model).toObject(MabErrorInfo.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabFileFolderProtectedItemExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabFileFolderProtectedItemExtendedInfoTests.java deleted file mode 100644 index 7d7144d57a444..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabFileFolderProtectedItemExtendedInfoTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabFileFolderProtectedItemExtendedInfo; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class MabFileFolderProtectedItemExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabFileFolderProtectedItemExtendedInfo model = BinaryData.fromString( - "{\"lastRefreshedAt\":\"2021-12-03T13:55:09Z\",\"oldestRecoveryPoint\":\"2021-08-07T02:06:49Z\",\"recoveryPointCount\":987390014}") - .toObject(MabFileFolderProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T13:55:09Z"), model.lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-07T02:06:49Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(987390014, model.recoveryPointCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabFileFolderProtectedItemExtendedInfo model = new MabFileFolderProtectedItemExtendedInfo() - .withLastRefreshedAt(OffsetDateTime.parse("2021-12-03T13:55:09Z")) - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-08-07T02:06:49Z")) - .withRecoveryPointCount(987390014); - model = BinaryData.fromObject(model).toObject(MabFileFolderProtectedItemExtendedInfo.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T13:55:09Z"), model.lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-07T02:06:49Z"), model.oldestRecoveryPoint()); - Assertions.assertEquals(987390014, model.recoveryPointCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabFileFolderProtectedItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabFileFolderProtectedItemTests.java deleted file mode 100644 index b001591cbee84..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabFileFolderProtectedItemTests.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabFileFolderProtectedItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabFileFolderProtectedItemExtendedInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MabFileFolderProtectedItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabFileFolderProtectedItem model = BinaryData.fromString( - "{\"protectedItemType\":\"MabFileFolderProtectedItem\",\"friendlyName\":\"ddbhf\",\"computerName\":\"fpazjzoywjxhpd\",\"lastBackupStatus\":\"ontacnpq\",\"lastBackupTime\":\"2020-12-27T20:17:23Z\",\"protectionState\":\"tuevrh\",\"deferredDeleteSyncTimeInUTC\":9121446683075241927,\"extendedInfo\":{\"lastRefreshedAt\":\"2021-05-25T18:18:08Z\",\"oldestRecoveryPoint\":\"2021-07-14T10:16:46Z\",\"recoveryPointCount\":705670671},\"backupManagementType\":\"AzureWorkload\",\"workloadType\":\"AzureFileShare\",\"containerName\":\"wbsreur\",\"sourceResourceId\":\"kfuarenlv\",\"policyId\":\"tklnvnafvvkyfed\",\"lastRecoveryPoint\":\"2021-11-11T21:24:27Z\",\"backupSetName\":\"oslc\",\"createMode\":\"Default\",\"deferredDeleteTimeInUTC\":\"2021-11-15T04:33:59Z\",\"isScheduledForDeferredDelete\":true,\"deferredDeleteTimeRemaining\":\"minqcym\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":true,\"resourceGuardOperationRequests\":[\"xxewu\",\"invudbch\",\"qdtvqecrqctmxx\"],\"isArchiveEnabled\":false,\"policyName\":\"mflhuytxzvtznapx\",\"softDeleteRetentionPeriodInDays\":1405354444,\"vaultId\":\"o\"}") - .toObject(MabFileFolderProtectedItem.class); - Assertions.assertEquals("wbsreur", model.containerName()); - Assertions.assertEquals("kfuarenlv", model.sourceResourceId()); - Assertions.assertEquals("tklnvnafvvkyfed", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-11T21:24:27Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("oslc", model.backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-15T04:33:59Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(true, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("minqcym", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("xxewu", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isArchiveEnabled()); - Assertions.assertEquals("mflhuytxzvtznapx", model.policyName()); - Assertions.assertEquals(1405354444, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("ddbhf", model.friendlyName()); - Assertions.assertEquals("fpazjzoywjxhpd", model.computerName()); - Assertions.assertEquals("ontacnpq", model.lastBackupStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-27T20:17:23Z"), model.lastBackupTime()); - Assertions.assertEquals("tuevrh", model.protectionState()); - Assertions.assertEquals(9121446683075241927L, model.deferredDeleteSyncTimeInUtc()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-25T18:18:08Z"), model.extendedInfo().lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-14T10:16:46Z"), - model.extendedInfo().oldestRecoveryPoint()); - Assertions.assertEquals(705670671, model.extendedInfo().recoveryPointCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabFileFolderProtectedItem model = new MabFileFolderProtectedItem().withContainerName("wbsreur") - .withSourceResourceId("kfuarenlv") - .withPolicyId("tklnvnafvvkyfed") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-11-11T21:24:27Z")) - .withBackupSetName("oslc") - .withCreateMode(CreateMode.DEFAULT) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-11-15T04:33:59Z")) - .withIsScheduledForDeferredDelete(true) - .withDeferredDeleteTimeRemaining("minqcym") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(true) - .withResourceGuardOperationRequests(Arrays.asList("xxewu", "invudbch", "qdtvqecrqctmxx")) - .withIsArchiveEnabled(false) - .withPolicyName("mflhuytxzvtznapx") - .withSoftDeleteRetentionPeriod(1405354444) - .withFriendlyName("ddbhf") - .withComputerName("fpazjzoywjxhpd") - .withLastBackupStatus("ontacnpq") - .withLastBackupTime(OffsetDateTime.parse("2020-12-27T20:17:23Z")) - .withProtectionState("tuevrh") - .withDeferredDeleteSyncTimeInUtc(9121446683075241927L) - .withExtendedInfo(new MabFileFolderProtectedItemExtendedInfo() - .withLastRefreshedAt(OffsetDateTime.parse("2021-05-25T18:18:08Z")) - .withOldestRecoveryPoint(OffsetDateTime.parse("2021-07-14T10:16:46Z")) - .withRecoveryPointCount(705670671)); - model = BinaryData.fromObject(model).toObject(MabFileFolderProtectedItem.class); - Assertions.assertEquals("wbsreur", model.containerName()); - Assertions.assertEquals("kfuarenlv", model.sourceResourceId()); - Assertions.assertEquals("tklnvnafvvkyfed", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-11T21:24:27Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("oslc", model.backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-15T04:33:59Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(true, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("minqcym", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("xxewu", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.isArchiveEnabled()); - Assertions.assertEquals("mflhuytxzvtznapx", model.policyName()); - Assertions.assertEquals(1405354444, model.softDeleteRetentionPeriod()); - Assertions.assertEquals("ddbhf", model.friendlyName()); - Assertions.assertEquals("fpazjzoywjxhpd", model.computerName()); - Assertions.assertEquals("ontacnpq", model.lastBackupStatus()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-27T20:17:23Z"), model.lastBackupTime()); - Assertions.assertEquals("tuevrh", model.protectionState()); - Assertions.assertEquals(9121446683075241927L, model.deferredDeleteSyncTimeInUtc()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-25T18:18:08Z"), model.extendedInfo().lastRefreshedAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-14T10:16:46Z"), - model.extendedInfo().oldestRecoveryPoint()); - Assertions.assertEquals(705670671, model.extendedInfo().recoveryPointCount()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobExtendedInfoTests.java deleted file mode 100644 index 0d507fa65b4c2..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobExtendedInfoTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabJobExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabJobTaskDetails; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class MabJobExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabJobExtendedInfo model = BinaryData.fromString( - "{\"tasksList\":[{\"taskId\":\"ehewhoqh\",\"startTime\":\"2021-07-22T20:31:39Z\",\"endTime\":\"2021-02-23T10:26:16Z\",\"duration\":\"PT58H48M1S\",\"status\":\"xeaclgsc\"}],\"propertyBag\":{\"ofldpuviyfcaa\":\"imkrsrrmouc\"},\"dynamicErrorMessage\":\"olhbhlvb\"}") - .toObject(MabJobExtendedInfo.class); - Assertions.assertEquals("ehewhoqh", model.tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-22T20:31:39Z"), model.tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-23T10:26:16Z"), model.tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT58H48M1S"), model.tasksList().get(0).duration()); - Assertions.assertEquals("xeaclgsc", model.tasksList().get(0).status()); - Assertions.assertEquals("imkrsrrmouc", model.propertyBag().get("ofldpuviyfcaa")); - Assertions.assertEquals("olhbhlvb", model.dynamicErrorMessage()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabJobExtendedInfo model = new MabJobExtendedInfo() - .withTasksList(Arrays.asList(new MabJobTaskDetails().withTaskId("ehewhoqh") - .withStartTime(OffsetDateTime.parse("2021-07-22T20:31:39Z")) - .withEndTime(OffsetDateTime.parse("2021-02-23T10:26:16Z")) - .withDuration(Duration.parse("PT58H48M1S")) - .withStatus("xeaclgsc"))) - .withPropertyBag(mapOf("ofldpuviyfcaa", "imkrsrrmouc")) - .withDynamicErrorMessage("olhbhlvb"); - model = BinaryData.fromObject(model).toObject(MabJobExtendedInfo.class); - Assertions.assertEquals("ehewhoqh", model.tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-22T20:31:39Z"), model.tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-23T10:26:16Z"), model.tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT58H48M1S"), model.tasksList().get(0).duration()); - Assertions.assertEquals("xeaclgsc", model.tasksList().get(0).status()); - Assertions.assertEquals("imkrsrrmouc", model.propertyBag().get("ofldpuviyfcaa")); - Assertions.assertEquals("olhbhlvb", model.dynamicErrorMessage()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobTaskDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobTaskDetailsTests.java deleted file mode 100644 index 0464dbede5ef7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobTaskDetailsTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabJobTaskDetails; -import java.time.Duration; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class MabJobTaskDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabJobTaskDetails model = BinaryData.fromString( - "{\"taskId\":\"uqibsxtkcu\",\"startTime\":\"2021-03-04T11:35:39Z\",\"endTime\":\"2021-09-14T12:40:56Z\",\"duration\":\"PT92H43M10S\",\"status\":\"siowlkjxnqpv\"}") - .toObject(MabJobTaskDetails.class); - Assertions.assertEquals("uqibsxtkcu", model.taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-04T11:35:39Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-14T12:40:56Z"), model.endTime()); - Assertions.assertEquals(Duration.parse("PT92H43M10S"), model.duration()); - Assertions.assertEquals("siowlkjxnqpv", model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabJobTaskDetails model = new MabJobTaskDetails().withTaskId("uqibsxtkcu") - .withStartTime(OffsetDateTime.parse("2021-03-04T11:35:39Z")) - .withEndTime(OffsetDateTime.parse("2021-09-14T12:40:56Z")) - .withDuration(Duration.parse("PT92H43M10S")) - .withStatus("siowlkjxnqpv"); - model = BinaryData.fromObject(model).toObject(MabJobTaskDetails.class); - Assertions.assertEquals("uqibsxtkcu", model.taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-04T11:35:39Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-14T12:40:56Z"), model.endTime()); - Assertions.assertEquals(Duration.parse("PT92H43M10S"), model.duration()); - Assertions.assertEquals("siowlkjxnqpv", model.status()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobTests.java deleted file mode 100644 index f0aa25638774b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabJobTests.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.JobSupportedAction; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabErrorInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabJob; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabJobExtendedInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabJobTaskDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabServerType; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class MabJobTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabJob model = BinaryData.fromString( - "{\"jobType\":\"MabJob\",\"duration\":\"PT157H59M25S\",\"actionsInfo\":[\"Cancellable\",\"Invalid\",\"Invalid\",\"Retriable\"],\"mabServerName\":\"ev\",\"mabServerType\":\"IaasVMServiceContainer\",\"workloadType\":\"Client\",\"errorDetails\":[{\"errorString\":\"rouuxvnsasbcry\",\"recommendations\":[\"izrxklob\"]},{\"errorString\":\"nazpmk\",\"recommendations\":[\"vevfxz\"]},{\"errorString\":\"jhbzxliohrdddtf\",\"recommendations\":[\"ba\",\"pcbbnzqcykna\",\"qofyuicdhzbdy\",\"wwgbdv\"]}],\"extendedInfo\":{\"tasksList\":[{\"taskId\":\"hmwffplfmuv\",\"startTime\":\"2021-03-20T18:52:11Z\",\"endTime\":\"2021-10-24T12:17:10Z\",\"duration\":\"PT58H47M20S\",\"status\":\"vwe\"}],\"propertyBag\":{\"ukphaimmoiroq\":\"oy\"},\"dynamicErrorMessage\":\"shbraga\"},\"entityFriendlyName\":\"yrmfsvbpav\",\"backupManagementType\":\"AzureStorage\",\"operation\":\"ppdbwnupgahxkum\",\"status\":\"jcaacfdmmcpugm\",\"startTime\":\"2021-06-17T13:12:39Z\",\"endTime\":\"2021-09-30T04:22:30Z\",\"activityId\":\"u\"}") - .toObject(MabJob.class); - Assertions.assertEquals("yrmfsvbpav", model.entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, model.backupManagementType()); - Assertions.assertEquals("ppdbwnupgahxkum", model.operation()); - Assertions.assertEquals("jcaacfdmmcpugm", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T13:12:39Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T04:22:30Z"), model.endTime()); - Assertions.assertEquals("u", model.activityId()); - Assertions.assertEquals(Duration.parse("PT157H59M25S"), model.duration()); - Assertions.assertEquals(JobSupportedAction.CANCELLABLE, model.actionsInfo().get(0)); - Assertions.assertEquals("ev", model.mabServerName()); - Assertions.assertEquals(MabServerType.IAAS_VMSERVICE_CONTAINER, model.mabServerType()); - Assertions.assertEquals(WorkloadType.CLIENT, model.workloadType()); - Assertions.assertEquals("hmwffplfmuv", model.extendedInfo().tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-20T18:52:11Z"), - model.extendedInfo().tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-24T12:17:10Z"), - model.extendedInfo().tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT58H47M20S"), model.extendedInfo().tasksList().get(0).duration()); - Assertions.assertEquals("vwe", model.extendedInfo().tasksList().get(0).status()); - Assertions.assertEquals("oy", model.extendedInfo().propertyBag().get("ukphaimmoiroq")); - Assertions.assertEquals("shbraga", model.extendedInfo().dynamicErrorMessage()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabJob model = new MabJob().withEntityFriendlyName("yrmfsvbpav") - .withBackupManagementType(BackupManagementType.AZURE_STORAGE) - .withOperation("ppdbwnupgahxkum") - .withStatus("jcaacfdmmcpugm") - .withStartTime(OffsetDateTime.parse("2021-06-17T13:12:39Z")) - .withEndTime(OffsetDateTime.parse("2021-09-30T04:22:30Z")) - .withActivityId("u") - .withDuration(Duration.parse("PT157H59M25S")) - .withActionsInfo(Arrays.asList(JobSupportedAction.CANCELLABLE, JobSupportedAction.INVALID, - JobSupportedAction.INVALID, JobSupportedAction.RETRIABLE)) - .withMabServerName("ev") - .withMabServerType(MabServerType.IAAS_VMSERVICE_CONTAINER) - .withWorkloadType(WorkloadType.CLIENT) - .withErrorDetails(Arrays.asList(new MabErrorInfo(), new MabErrorInfo(), new MabErrorInfo())) - .withExtendedInfo(new MabJobExtendedInfo() - .withTasksList(Arrays.asList(new MabJobTaskDetails().withTaskId("hmwffplfmuv") - .withStartTime(OffsetDateTime.parse("2021-03-20T18:52:11Z")) - .withEndTime(OffsetDateTime.parse("2021-10-24T12:17:10Z")) - .withDuration(Duration.parse("PT58H47M20S")) - .withStatus("vwe"))) - .withPropertyBag(mapOf("ukphaimmoiroq", "oy")) - .withDynamicErrorMessage("shbraga")); - model = BinaryData.fromObject(model).toObject(MabJob.class); - Assertions.assertEquals("yrmfsvbpav", model.entityFriendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, model.backupManagementType()); - Assertions.assertEquals("ppdbwnupgahxkum", model.operation()); - Assertions.assertEquals("jcaacfdmmcpugm", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T13:12:39Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T04:22:30Z"), model.endTime()); - Assertions.assertEquals("u", model.activityId()); - Assertions.assertEquals(Duration.parse("PT157H59M25S"), model.duration()); - Assertions.assertEquals(JobSupportedAction.CANCELLABLE, model.actionsInfo().get(0)); - Assertions.assertEquals("ev", model.mabServerName()); - Assertions.assertEquals(MabServerType.IAAS_VMSERVICE_CONTAINER, model.mabServerType()); - Assertions.assertEquals(WorkloadType.CLIENT, model.workloadType()); - Assertions.assertEquals("hmwffplfmuv", model.extendedInfo().tasksList().get(0).taskId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-20T18:52:11Z"), - model.extendedInfo().tasksList().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-24T12:17:10Z"), - model.extendedInfo().tasksList().get(0).endTime()); - Assertions.assertEquals(Duration.parse("PT58H47M20S"), model.extendedInfo().tasksList().get(0).duration()); - Assertions.assertEquals("vwe", model.extendedInfo().tasksList().get(0).status()); - Assertions.assertEquals("oy", model.extendedInfo().propertyBag().get("ukphaimmoiroq")); - Assertions.assertEquals("shbraga", model.extendedInfo().dynamicErrorMessage()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabProtectionPolicyTests.java deleted file mode 100644 index d285aa6d73377..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MabProtectionPolicyTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.MabProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MabProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MabProtectionPolicy model = BinaryData.fromString( - "{\"backupManagementType\":\"MAB\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"protectedItemsCount\":1896459173,\"resourceGuardOperationRequests\":[\"qyki\",\"mdksaoa\",\"cluqvo\"]}") - .toObject(MabProtectionPolicy.class); - Assertions.assertEquals(1896459173, model.protectedItemsCount()); - Assertions.assertEquals("qyki", model.resourceGuardOperationRequests().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MabProtectionPolicy model = new MabProtectionPolicy().withProtectedItemsCount(1896459173) - .withResourceGuardOperationRequests(Arrays.asList("qyki", "mdksaoa", "cluqvo")) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()); - model = BinaryData.fromObject(model).toObject(MabProtectionPolicy.class); - Assertions.assertEquals(1896459173, model.protectedItemsCount()); - Assertions.assertEquals("qyki", model.resourceGuardOperationRequests().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MonthlyRetentionScheduleTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MonthlyRetentionScheduleTests.java deleted file mode 100644 index 5469580bb3dfe..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MonthlyRetentionScheduleTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.Day; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.MonthlyRetentionSchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionScheduleFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonthlyRetentionScheduleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonthlyRetentionSchedule model = BinaryData.fromString( - "{\"retentionScheduleFormatType\":\"Daily\",\"retentionScheduleDaily\":{\"daysOfTheMonth\":[{\"date\":1064887368,\"isLast\":false},{\"date\":1188607782,\"isLast\":false}]},\"retentionScheduleWeekly\":{\"daysOfTheWeek\":[\"Saturday\",\"Saturday\",\"Saturday\",\"Tuesday\"],\"weeksOfTheMonth\":[\"First\"]},\"retentionTimes\":[\"2021-01-14T11:43:43Z\",\"2021-03-30T23:09:01Z\",\"2021-05-12T11:13:03Z\"],\"retentionDuration\":{\"count\":1952493795,\"durationType\":\"Years\"}}") - .toObject(MonthlyRetentionSchedule.class); - Assertions.assertEquals(RetentionScheduleFormat.DAILY, model.retentionScheduleFormatType()); - Assertions.assertEquals(1064887368, model.retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, model.retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.SATURDAY, model.retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.FIRST, model.retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-14T11:43:43Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(1952493795, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.YEARS, model.retentionDuration().durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonthlyRetentionSchedule model = new MonthlyRetentionSchedule() - .withRetentionScheduleFormatType(RetentionScheduleFormat.DAILY) - .withRetentionScheduleDaily(new DailyRetentionFormat().withDaysOfTheMonth(Arrays.asList( - new Day().withDate(1064887368).withIsLast(false), new Day().withDate(1188607782).withIsLast(false)))) - .withRetentionScheduleWeekly(new WeeklyRetentionFormat() - .withDaysOfTheWeek( - Arrays.asList(DayOfWeek.SATURDAY, DayOfWeek.SATURDAY, DayOfWeek.SATURDAY, DayOfWeek.TUESDAY)) - .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.FIRST))) - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-01-14T11:43:43Z"), - OffsetDateTime.parse("2021-03-30T23:09:01Z"), OffsetDateTime.parse("2021-05-12T11:13:03Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(1952493795).withDurationType(RetentionDurationType.YEARS)); - model = BinaryData.fromObject(model).toObject(MonthlyRetentionSchedule.class); - Assertions.assertEquals(RetentionScheduleFormat.DAILY, model.retentionScheduleFormatType()); - Assertions.assertEquals(1064887368, model.retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, model.retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.SATURDAY, model.retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.FIRST, model.retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-14T11:43:43Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(1952493795, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.YEARS, model.retentionDuration().durationType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MoveRPAcrossTiersRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MoveRPAcrossTiersRequestTests.java deleted file mode 100644 index 8fe96a51659ac..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/MoveRPAcrossTiersRequestTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.MoveRPAcrossTiersRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import org.junit.jupiter.api.Assertions; - -public final class MoveRPAcrossTiersRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MoveRPAcrossTiersRequest model = BinaryData - .fromString( - "{\"objectType\":\"qdpsqxqvpsvu\",\"sourceTierType\":\"ArchivedRP\",\"targetTierType\":\"InstantRP\"}") - .toObject(MoveRPAcrossTiersRequest.class); - Assertions.assertEquals("qdpsqxqvpsvu", model.objectType()); - Assertions.assertEquals(RecoveryPointTierType.ARCHIVED_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.targetTierType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MoveRPAcrossTiersRequest model = new MoveRPAcrossTiersRequest().withObjectType("qdpsqxqvpsvu") - .withSourceTierType(RecoveryPointTierType.ARCHIVED_RP) - .withTargetTierType(RecoveryPointTierType.INSTANT_RP); - model = BinaryData.fromObject(model).toObject(MoveRPAcrossTiersRequest.class); - Assertions.assertEquals("qdpsqxqvpsvu", model.objectType()); - Assertions.assertEquals(RecoveryPointTierType.ARCHIVED_RP, model.sourceTierType()); - Assertions.assertEquals(RecoveryPointTierType.INSTANT_RP, model.targetTierType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/NameInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/NameInfoTests.java deleted file mode 100644 index 0e53373531488..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/NameInfoTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.NameInfo; -import org.junit.jupiter.api.Assertions; - -public final class NameInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NameInfo model = BinaryData.fromString("{\"value\":\"ukjfkgiawxklr\",\"localizedValue\":\"lwckbasyypnddhs\"}") - .toObject(NameInfo.class); - Assertions.assertEquals("ukjfkgiawxklr", model.value()); - Assertions.assertEquals("lwckbasyypnddhs", model.localizedValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NameInfo model = new NameInfo().withValue("ukjfkgiawxklr").withLocalizedValue("lwckbasyypnddhs"); - model = BinaryData.fromObject(model).toObject(NameInfo.class); - Assertions.assertEquals("ukjfkgiawxklr", model.value()); - Assertions.assertEquals("lwckbasyypnddhs", model.localizedValue()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationResultInfoBaseTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationResultInfoBaseTests.java deleted file mode 100644 index 8c48463ff85a3..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationResultInfoBaseTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.OperationResultInfoBase; - -public final class OperationResultInfoBaseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationResultInfoBase model = BinaryData.fromString("{\"objectType\":\"OperationResultInfoBase\"}") - .toObject(OperationResultInfoBase.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationResultInfoBase model = new OperationResultInfoBase(); - model = BinaryData.fromObject(model).toObject(OperationResultInfoBase.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationResultInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationResultInfoTests.java deleted file mode 100644 index 6ee38096d3777..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationResultInfoTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.OperationResultInfo; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationResultInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationResultInfo model = BinaryData.fromString( - "{\"objectType\":\"OperationResultInfo\",\"jobList\":[\"cjimryvwgcwwpbmz\",\"w\",\"sydsxwefohe\",\"bvopwndyqle\"]}") - .toObject(OperationResultInfo.class); - Assertions.assertEquals("cjimryvwgcwwpbmz", model.jobList().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationResultInfo model = new OperationResultInfo() - .withJobList(Arrays.asList("cjimryvwgcwwpbmz", "w", "sydsxwefohe", "bvopwndyqle")); - model = BinaryData.fromObject(model).toObject(OperationResultInfo.class); - Assertions.assertEquals("cjimryvwgcwwpbmz", model.jobList().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusExtendedInfoTests.java deleted file mode 100644 index 34cb9c5861296..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusExtendedInfoTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusExtendedInfo; - -public final class OperationStatusExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationStatusExtendedInfo model = BinaryData.fromString("{\"objectType\":\"OperationStatusExtendedInfo\"}") - .toObject(OperationStatusExtendedInfo.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationStatusExtendedInfo model = new OperationStatusExtendedInfo(); - model = BinaryData.fromObject(model).toObject(OperationStatusExtendedInfo.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusJobExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusJobExtendedInfoTests.java deleted file mode 100644 index 2459d14336242..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusJobExtendedInfoTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusJobExtendedInfo; -import org.junit.jupiter.api.Assertions; - -public final class OperationStatusJobExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationStatusJobExtendedInfo model - = BinaryData.fromString("{\"objectType\":\"OperationStatusJobExtendedInfo\",\"jobId\":\"yvqkxr\"}") - .toObject(OperationStatusJobExtendedInfo.class); - Assertions.assertEquals("yvqkxr", model.jobId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationStatusJobExtendedInfo model = new OperationStatusJobExtendedInfo().withJobId("yvqkxr"); - model = BinaryData.fromObject(model).toObject(OperationStatusJobExtendedInfo.class); - Assertions.assertEquals("yvqkxr", model.jobId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusJobsExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusJobsExtendedInfoTests.java deleted file mode 100644 index a6e1de0def3e7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusJobsExtendedInfoTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusJobsExtendedInfo; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class OperationStatusJobsExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationStatusJobsExtendedInfo model = BinaryData.fromString( - "{\"objectType\":\"OperationStatusJobsExtendedInfo\",\"jobIds\":[\"niylyly\",\"wxzut\",\"qztw\"],\"failedJobsError\":{\"tcdxabbujftaben\":\"mupgxy\",\"cafeddw\":\"bklqpxz\",\"ookrtalvnbw\":\"nlzafwxudgnh\",\"uclvdjj\":\"pbeme\"}}") - .toObject(OperationStatusJobsExtendedInfo.class); - Assertions.assertEquals("niylyly", model.jobIds().get(0)); - Assertions.assertEquals("mupgxy", model.failedJobsError().get("tcdxabbujftaben")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationStatusJobsExtendedInfo model - = new OperationStatusJobsExtendedInfo().withJobIds(Arrays.asList("niylyly", "wxzut", "qztw")) - .withFailedJobsError(mapOf("tcdxabbujftaben", "mupgxy", "cafeddw", "bklqpxz", "ookrtalvnbw", - "nlzafwxudgnh", "uclvdjj", "pbeme")); - model = BinaryData.fromObject(model).toObject(OperationStatusJobsExtendedInfo.class); - Assertions.assertEquals("niylyly", model.jobIds().get(0)); - Assertions.assertEquals("mupgxy", model.failedJobsError().get("tcdxabbujftaben")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusProvisionIlrExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusProvisionIlrExtendedInfoTests.java deleted file mode 100644 index a17641c87f533..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationStatusProvisionIlrExtendedInfoTests.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientScriptForConnect; -import com.azure.resourcemanager.recoveryservicesbackup.models.InstantItemRecoveryTarget; -import com.azure.resourcemanager.recoveryservicesbackup.models.OperationStatusProvisionIlrExtendedInfo; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationStatusProvisionIlrExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationStatusProvisionIlrExtendedInfo model = BinaryData.fromString( - "{\"objectType\":\"OperationStatusProvisionILRExtendedInfo\",\"recoveryTarget\":{\"clientScripts\":[{\"scriptContent\":\"nqodxahhxhq\",\"scriptExtension\":\"qnvzoqgyipemch\",\"osType\":\"v\",\"url\":\"zuejd\",\"scriptNameSuffix\":\"ptlghwzhomewjjst\"},{\"scriptContent\":\"uhqawmoaianc\",\"scriptExtension\":\"vodrrslblxydkxr\",\"osType\":\"vbxiwkgfbqlj\",\"url\":\"khychocokulehur\",\"scriptNameSuffix\":\"rqffaweyurk\"},{\"scriptContent\":\"y\",\"scriptExtension\":\"xra\",\"osType\":\"uqd\",\"url\":\"xmrgchbapxkiy\",\"scriptNameSuffix\":\"j\"},{\"scriptContent\":\"ajb\",\"scriptExtension\":\"cgduusio\",\"osType\":\"blevpmcluj\",\"url\":\"kyxl\",\"scriptNameSuffix\":\"sjgkzzltafh\"}]}}") - .toObject(OperationStatusProvisionIlrExtendedInfo.class); - Assertions.assertEquals("nqodxahhxhq", model.recoveryTarget().clientScripts().get(0).scriptContent()); - Assertions.assertEquals("qnvzoqgyipemch", model.recoveryTarget().clientScripts().get(0).scriptExtension()); - Assertions.assertEquals("v", model.recoveryTarget().clientScripts().get(0).osType()); - Assertions.assertEquals("zuejd", model.recoveryTarget().clientScripts().get(0).url()); - Assertions.assertEquals("ptlghwzhomewjjst", model.recoveryTarget().clientScripts().get(0).scriptNameSuffix()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationStatusProvisionIlrExtendedInfo model = new OperationStatusProvisionIlrExtendedInfo() - .withRecoveryTarget(new InstantItemRecoveryTarget().withClientScripts(Arrays.asList( - new ClientScriptForConnect().withScriptContent("nqodxahhxhq") - .withScriptExtension("qnvzoqgyipemch") - .withOsType("v") - .withUrl("zuejd") - .withScriptNameSuffix("ptlghwzhomewjjst"), - new ClientScriptForConnect().withScriptContent("uhqawmoaianc") - .withScriptExtension("vodrrslblxydkxr") - .withOsType("vbxiwkgfbqlj") - .withUrl("khychocokulehur") - .withScriptNameSuffix("rqffaweyurk"), - new ClientScriptForConnect().withScriptContent("y") - .withScriptExtension("xra") - .withOsType("uqd") - .withUrl("xmrgchbapxkiy") - .withScriptNameSuffix("j"), - new ClientScriptForConnect().withScriptContent("ajb") - .withScriptExtension("cgduusio") - .withOsType("blevpmcluj") - .withUrl("kyxl") - .withScriptNameSuffix("sjgkzzltafh")))); - model = BinaryData.fromObject(model).toObject(OperationStatusProvisionIlrExtendedInfo.class); - Assertions.assertEquals("nqodxahhxhq", model.recoveryTarget().clientScripts().get(0).scriptContent()); - Assertions.assertEquals("qnvzoqgyipemch", model.recoveryTarget().clientScripts().get(0).scriptExtension()); - Assertions.assertEquals("v", model.recoveryTarget().clientScripts().get(0).osType()); - Assertions.assertEquals("zuejd", model.recoveryTarget().clientScripts().get(0).url()); - Assertions.assertEquals("ptlghwzhomewjjst", model.recoveryTarget().clientScripts().get(0).scriptNameSuffix()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationsListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationsListMockTests.java deleted file mode 100644 index c16ba25932403..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/OperationsListMockTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ClientDiscoveryValueForSingleApi; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"dkygywezski\",\"display\":{\"provider\":\"f\",\"resource\":\"zmxieqvdsmaklix\",\"operation\":\"ah\",\"description\":\"xalybxawoijpo\"},\"origin\":\"blxpkkwjdjodq\",\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"n\",\"displayName\":\"mehllizhceu\",\"blobDuration\":\"qodkadppyibngql\"}]}}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("dkygywezski", response.iterator().next().name()); - Assertions.assertEquals("f", response.iterator().next().display().provider()); - Assertions.assertEquals("zmxieqvdsmaklix", response.iterator().next().display().resource()); - Assertions.assertEquals("ah", response.iterator().next().display().operation()); - Assertions.assertEquals("xalybxawoijpo", response.iterator().next().display().description()); - Assertions.assertEquals("blxpkkwjdjodq", response.iterator().next().origin()); - Assertions.assertEquals("n", - response.iterator().next().properties().serviceSpecification().logSpecifications().get(0).name()); - Assertions.assertEquals("mehllizhceu", - response.iterator().next().properties().serviceSpecification().logSpecifications().get(0).displayName()); - Assertions.assertEquals("qodkadppyibngql", - response.iterator().next().properties().serviceSpecification().logSpecifications().get(0).blobDuration()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PointInTimeRangeTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PointInTimeRangeTests.java deleted file mode 100644 index 9d07b26dd1e5c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PointInTimeRangeTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.PointInTimeRange; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class PointInTimeRangeTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PointInTimeRange model - = BinaryData.fromString("{\"startTime\":\"2021-11-06T16:53:49Z\",\"endTime\":\"2021-05-17T21:24:33Z\"}") - .toObject(PointInTimeRange.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-06T16:53:49Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-17T21:24:33Z"), model.endTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PointInTimeRange model = new PointInTimeRange().withStartTime(OffsetDateTime.parse("2021-11-06T16:53:49Z")) - .withEndTime(OffsetDateTime.parse("2021-05-17T21:24:33Z")); - model = BinaryData.fromObject(model).toObject(PointInTimeRange.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-06T16:53:49Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-17T21:24:33Z"), model.endTime()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PreValidateEnableBackupRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PreValidateEnableBackupRequestTests.java deleted file mode 100644 index a24dd72895901..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PreValidateEnableBackupRequestTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType; -import com.azure.resourcemanager.recoveryservicesbackup.models.PreValidateEnableBackupRequest; -import org.junit.jupiter.api.Assertions; - -public final class PreValidateEnableBackupRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PreValidateEnableBackupRequest model = BinaryData.fromString( - "{\"resourceType\":\"Sharepoint\",\"resourceId\":\"gdf\",\"vaultId\":\"lzl\",\"properties\":\"xrifkwmrvkts\"}") - .toObject(PreValidateEnableBackupRequest.class); - Assertions.assertEquals(DataSourceType.SHAREPOINT, model.resourceType()); - Assertions.assertEquals("gdf", model.resourceId()); - Assertions.assertEquals("lzl", model.vaultId()); - Assertions.assertEquals("xrifkwmrvkts", model.properties()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PreValidateEnableBackupRequest model - = new PreValidateEnableBackupRequest().withResourceType(DataSourceType.SHAREPOINT) - .withResourceId("gdf") - .withVaultId("lzl") - .withProperties("xrifkwmrvkts"); - model = BinaryData.fromObject(model).toObject(PreValidateEnableBackupRequest.class); - Assertions.assertEquals(DataSourceType.SHAREPOINT, model.resourceType()); - Assertions.assertEquals("gdf", model.resourceId()); - Assertions.assertEquals("lzl", model.vaultId()); - Assertions.assertEquals("xrifkwmrvkts", model.properties()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrepareDataMoveRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrepareDataMoveRequestTests.java deleted file mode 100644 index 34ef8a004c190..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrepareDataMoveRequestTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataMoveLevel; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrepareDataMoveRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PrepareDataMoveRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrepareDataMoveRequest model = BinaryData.fromString( - "{\"targetResourceId\":\"ujjugwdkcglh\",\"targetRegion\":\"lazjdyggdtjixhbk\",\"dataMoveLevel\":\"Container\",\"sourceContainerArmIds\":[\"wey\",\"hmenevfyexfwhybc\",\"bvyvdcsity\"],\"ignoreMoved\":false}") - .toObject(PrepareDataMoveRequest.class); - Assertions.assertEquals("ujjugwdkcglh", model.targetResourceId()); - Assertions.assertEquals("lazjdyggdtjixhbk", model.targetRegion()); - Assertions.assertEquals(DataMoveLevel.CONTAINER, model.dataMoveLevel()); - Assertions.assertEquals("wey", model.sourceContainerArmIds().get(0)); - Assertions.assertEquals(false, model.ignoreMoved()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrepareDataMoveRequest model = new PrepareDataMoveRequest().withTargetResourceId("ujjugwdkcglh") - .withTargetRegion("lazjdyggdtjixhbk") - .withDataMoveLevel(DataMoveLevel.CONTAINER) - .withSourceContainerArmIds(Arrays.asList("wey", "hmenevfyexfwhybc", "bvyvdcsity")) - .withIgnoreMoved(false); - model = BinaryData.fromObject(model).toObject(PrepareDataMoveRequest.class); - Assertions.assertEquals("ujjugwdkcglh", model.targetResourceId()); - Assertions.assertEquals("lazjdyggdtjixhbk", model.targetRegion()); - Assertions.assertEquals(DataMoveLevel.CONTAINER, model.dataMoveLevel()); - Assertions.assertEquals("wey", model.sourceContainerArmIds().get(0)); - Assertions.assertEquals(false, model.ignoreMoved()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrepareDataMoveResponseTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrepareDataMoveResponseTests.java deleted file mode 100644 index a54f597aaffb5..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrepareDataMoveResponseTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrepareDataMoveResponse; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class PrepareDataMoveResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrepareDataMoveResponse model = BinaryData.fromString( - "{\"objectType\":\"PrepareDataMoveResponse\",\"correlationId\":\"lklmtkhlo\",\"sourceVaultProperties\":{\"syzfhotlhikcyych\":\"xpvbrdfjm\"}}") - .toObject(PrepareDataMoveResponse.class); - Assertions.assertEquals("lklmtkhlo", model.correlationId()); - Assertions.assertEquals("xpvbrdfjm", model.sourceVaultProperties().get("syzfhotlhikcyych")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrepareDataMoveResponse model = new PrepareDataMoveResponse().withCorrelationId("lklmtkhlo") - .withSourceVaultProperties(mapOf("syzfhotlhikcyych", "xpvbrdfjm")); - model = BinaryData.fromObject(model).toObject(PrepareDataMoveResponse.class); - Assertions.assertEquals("lklmtkhlo", model.correlationId()); - Assertions.assertEquals("xpvbrdfjm", model.sourceVaultProperties().get("syzfhotlhikcyych")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionResourceInnerTests.java deleted file mode 100644 index 2029ff47a9432..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionResourceInnerTests.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.PrivateEndpointConnectionResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnection; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateLinkServiceConnectionState; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProvisioningState; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultSubResourceType; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionResourceInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"privateEndpoint\":{\"id\":\"gehoqfbowskany\"},\"groupIds\":[\"AzureSiteRecovery\",\"AzureBackup\",\"AzureBackup_secondary\",\"AzureSiteRecovery\"],\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"ywgndrv\",\"actionsRequired\":\"hzgpphrcgyncocpe\"}},\"eTag\":\"vmmcoofs\",\"location\":\"lzevgbmqjqab\",\"tags\":{\"wnfnbacf\":\"mivkwlzuvcc\",\"bqqwxrj\":\"onlebxetqgtzxdpn\",\"mpmngnzscxaqwoo\":\"eallnwsubisnj\"},\"id\":\"hcbonqvpkvlr\",\"name\":\"njeaseipheofloke\",\"type\":\"y\"}") - .toObject(PrivateEndpointConnectionResourceInner.class); - Assertions.assertEquals("lzevgbmqjqab", model.location()); - Assertions.assertEquals("mivkwlzuvcc", model.tags().get("wnfnbacf")); - Assertions.assertEquals(ProvisioningState.SUCCEEDED, model.properties().provisioningState()); - Assertions.assertEquals("gehoqfbowskany", model.properties().privateEndpoint().id()); - Assertions.assertEquals(VaultSubResourceType.AZURE_SITE_RECOVERY, model.properties().groupIds().get(0)); - Assertions.assertEquals(PrivateEndpointConnectionStatus.REJECTED, - model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("ywgndrv", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("hzgpphrcgyncocpe", - model.properties().privateLinkServiceConnectionState().actionRequired()); - Assertions.assertEquals("vmmcoofs", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnectionResourceInner model = new PrivateEndpointConnectionResourceInner() - .withLocation("lzevgbmqjqab") - .withTags( - mapOf("wnfnbacf", "mivkwlzuvcc", "bqqwxrj", "onlebxetqgtzxdpn", "mpmngnzscxaqwoo", "eallnwsubisnj")) - .withProperties(new PrivateEndpointConnection().withProvisioningState(ProvisioningState.SUCCEEDED) - .withPrivateEndpoint(new PrivateEndpoint().withId("gehoqfbowskany")) - .withGroupIds(Arrays.asList(VaultSubResourceType.AZURE_SITE_RECOVERY, VaultSubResourceType.AZURE_BACKUP, - VaultSubResourceType.AZURE_BACKUP_SECONDARY, VaultSubResourceType.AZURE_SITE_RECOVERY)) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointConnectionStatus.REJECTED) - .withDescription("ywgndrv") - .withActionRequired("hzgpphrcgyncocpe"))) - .withEtag("vmmcoofs"); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionResourceInner.class); - Assertions.assertEquals("lzevgbmqjqab", model.location()); - Assertions.assertEquals("mivkwlzuvcc", model.tags().get("wnfnbacf")); - Assertions.assertEquals(ProvisioningState.SUCCEEDED, model.properties().provisioningState()); - Assertions.assertEquals("gehoqfbowskany", model.properties().privateEndpoint().id()); - Assertions.assertEquals(VaultSubResourceType.AZURE_SITE_RECOVERY, model.properties().groupIds().get(0)); - Assertions.assertEquals(PrivateEndpointConnectionStatus.REJECTED, - model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("ywgndrv", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("hzgpphrcgyncocpe", - model.properties().privateLinkServiceConnectionState().actionRequired()); - Assertions.assertEquals("vmmcoofs", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionTests.java deleted file mode 100644 index f72aca7a15ce7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnection; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateLinkServiceConnectionState; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProvisioningState; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultSubResourceType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnection model = BinaryData.fromString( - "{\"provisioningState\":\"Succeeded\",\"privateEndpoint\":{\"id\":\"dlwtgrhpdj\"},\"groupIds\":[\"AzureBackup\",\"AzureSiteRecovery\",\"AzureBackup_secondary\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"pqyegualhbxxh\",\"actionsRequired\":\"jzzvdud\"}}") - .toObject(PrivateEndpointConnection.class); - Assertions.assertEquals(ProvisioningState.SUCCEEDED, model.provisioningState()); - Assertions.assertEquals("dlwtgrhpdj", model.privateEndpoint().id()); - Assertions.assertEquals(VaultSubResourceType.AZURE_BACKUP, model.groupIds().get(0)); - Assertions.assertEquals(PrivateEndpointConnectionStatus.PENDING, - model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("pqyegualhbxxh", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("jzzvdud", model.privateLinkServiceConnectionState().actionRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnection model - = new PrivateEndpointConnection().withProvisioningState(ProvisioningState.SUCCEEDED) - .withPrivateEndpoint(new PrivateEndpoint().withId("dlwtgrhpdj")) - .withGroupIds(Arrays.asList(VaultSubResourceType.AZURE_BACKUP, VaultSubResourceType.AZURE_SITE_RECOVERY, - VaultSubResourceType.AZURE_BACKUP_SECONDARY)) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointConnectionStatus.PENDING) - .withDescription("pqyegualhbxxh") - .withActionRequired("jzzvdud")); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnection.class); - Assertions.assertEquals(ProvisioningState.SUCCEEDED, model.provisioningState()); - Assertions.assertEquals("dlwtgrhpdj", model.privateEndpoint().id()); - Assertions.assertEquals(VaultSubResourceType.AZURE_BACKUP, model.groupIds().get(0)); - Assertions.assertEquals(PrivateEndpointConnectionStatus.PENDING, - model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("pqyegualhbxxh", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("jzzvdud", model.privateLinkServiceConnectionState().actionRequired()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsDeleteMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsDeleteMockTests.java deleted file mode 100644 index 77ce0d4880e24..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsDeleteMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PrivateEndpointConnectionsDeleteMockTests { - @Test - public void testDelete() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.privateEndpointConnections() - .delete("tlgflwfgz", "iucijjcea", "lijjjrtvam", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java deleted file mode 100644 index 550181fc9992a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProvisioningState; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultSubResourceType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PrivateEndpointConnectionsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Deleting\",\"privateEndpoint\":{\"id\":\"zdcduwjoedxng\"},\"groupIds\":[\"AzureBackup_secondary\",\"AzureBackup_secondary\",\"AzureBackup_secondary\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"wgilfjqqac\",\"actionsRequired\":\"kxwxdcvjwcyziake\"}},\"eTag\":\"qchxrtuic\",\"location\":\"siw\",\"tags\":{\"grpxncakiqaondjr\":\"mpzhzzwvywrgyngy\"},\"id\":\"clamgglvlmfejdoq\",\"name\":\"ykglt\",\"type\":\"gxhqfgqkayejs\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PrivateEndpointConnectionResource response = manager.privateEndpointConnections() - .getWithResponse("nrzorpd", "tbqctqjfgx", "saetgzdgvpyig", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("siw", response.location()); - Assertions.assertEquals("mpzhzzwvywrgyngy", response.tags().get("grpxncakiqaondjr")); - Assertions.assertEquals(ProvisioningState.DELETING, response.properties().provisioningState()); - Assertions.assertEquals("zdcduwjoedxng", response.properties().privateEndpoint().id()); - Assertions.assertEquals(VaultSubResourceType.AZURE_BACKUP_SECONDARY, response.properties().groupIds().get(0)); - Assertions.assertEquals(PrivateEndpointConnectionStatus.APPROVED, - response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("wgilfjqqac", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("kxwxdcvjwcyziake", - response.properties().privateLinkServiceConnectionState().actionRequired()); - Assertions.assertEquals("qchxrtuic", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsPutMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsPutMockTests.java deleted file mode 100644 index 5ee1e923a66af..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointConnectionsPutMockTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnection; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateLinkServiceConnectionState; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProvisioningState; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultSubResourceType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PrivateEndpointConnectionsPutMockTests { - @Test - public void testPut() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"privateEndpoint\":{\"id\":\"cxn\"},\"groupIds\":[\"AzureSiteRecovery\",\"AzureSiteRecovery\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"vxisimjcea\",\"actionsRequired\":\"jqvlsumywz\"}},\"eTag\":\"hxgonoyjf\",\"location\":\"ipubyznclkfk\",\"tags\":{\"pemtuoqu\":\"gv\",\"egqavnigflqqb\":\"l\"},\"id\":\"nyjpylxdbfv\",\"name\":\"bmvmsxba\",\"type\":\"vwjcnkottlwuh\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PrivateEndpointConnectionResource response = manager.privateEndpointConnections() - .define("cxetyvkunmignoh") - .withRegion("vwypusuvjsl") - .withExistingVault("a", "zknxkv") - .withTags(mapOf("lfryvdmvxadqac", "ciidjs")) - .withProperties(new PrivateEndpointConnection().withProvisioningState(ProvisioningState.PENDING) - .withPrivateEndpoint(new PrivateEndpoint().withId("g")) - .withGroupIds( - Arrays.asList(VaultSubResourceType.AZURE_BACKUP, VaultSubResourceType.AZURE_BACKUP_SECONDARY)) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointConnectionStatus.DISCONNECTED) - .withDescription("abbxbhmedeil") - .withActionRequired("ywfcfxzi"))) - .withEtag("zi") - .create(); - - Assertions.assertEquals("ipubyznclkfk", response.location()); - Assertions.assertEquals("gv", response.tags().get("pemtuoqu")); - Assertions.assertEquals(ProvisioningState.SUCCEEDED, response.properties().provisioningState()); - Assertions.assertEquals("cxn", response.properties().privateEndpoint().id()); - Assertions.assertEquals(VaultSubResourceType.AZURE_SITE_RECOVERY, response.properties().groupIds().get(0)); - Assertions.assertEquals(PrivateEndpointConnectionStatus.PENDING, - response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("vxisimjcea", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("jqvlsumywz", - response.properties().privateLinkServiceConnectionState().actionRequired()); - Assertions.assertEquals("hxgonoyjf", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointTests.java deleted file mode 100644 index 8bf27f2a88e66..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateEndpointTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpoint; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpoint model = BinaryData.fromString("{\"id\":\"dslfhotwmcy\"}").toObject(PrivateEndpoint.class); - Assertions.assertEquals("dslfhotwmcy", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpoint model = new PrivateEndpoint().withId("dslfhotwmcy"); - model = BinaryData.fromObject(model).toObject(PrivateEndpoint.class); - Assertions.assertEquals("dslfhotwmcy", model.id()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateLinkServiceConnectionStateTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateLinkServiceConnectionStateTests.java deleted file mode 100644 index 5e77e84e8d227..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/PrivateLinkServiceConnectionStateTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateEndpointConnectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrivateLinkServiceConnectionState; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkServiceConnectionStateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkServiceConnectionState model = BinaryData - .fromString("{\"status\":\"Disconnected\",\"description\":\"bjnpg\",\"actionsRequired\":\"ftadehxnltyfs\"}") - .toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointConnectionStatus.DISCONNECTED, model.status()); - Assertions.assertEquals("bjnpg", model.description()); - Assertions.assertEquals("ftadehxnltyfs", model.actionRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateLinkServiceConnectionState model - = new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointConnectionStatus.DISCONNECTED) - .withDescription("bjnpg") - .withActionRequired("ftadehxnltyfs"); - model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointConnectionStatus.DISCONNECTED, model.status()); - Assertions.assertEquals("bjnpg", model.description()); - Assertions.assertEquals("ftadehxnltyfs", model.actionRequired()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerResourceInnerTests.java deleted file mode 100644 index ba3cbb524bf1f..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerResourceInnerTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectableContainerResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainer; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectableContainerResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectableContainerResourceInner model = BinaryData.fromString( - "{\"properties\":{\"protectableContainerType\":\"ProtectableContainer\",\"friendlyName\":\"queziky\",\"backupManagementType\":\"AzureWorkload\",\"healthStatus\":\"kallatmel\",\"containerId\":\"ipicc\"},\"eTag\":\"kzivgvvcnayrh\",\"location\":\"rnxxmueed\",\"tags\":{\"qtc\":\"dvstkw\",\"piohgwxrtfu\":\"ealmfmtdaaygdvwv\",\"k\":\"xepxgyqagvrvmn\"},\"id\":\"kghimdblxgwimfnj\",\"name\":\"fjxwmsz\",\"type\":\"kfoqreyfkzikfj\"}") - .toObject(ProtectableContainerResourceInner.class); - Assertions.assertEquals("rnxxmueed", model.location()); - Assertions.assertEquals("dvstkw", model.tags().get("qtc")); - Assertions.assertEquals("queziky", model.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_WORKLOAD, model.properties().backupManagementType()); - Assertions.assertEquals("kallatmel", model.properties().healthStatus()); - Assertions.assertEquals("ipicc", model.properties().containerId()); - Assertions.assertEquals("kzivgvvcnayrh", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectableContainerResourceInner model = new ProtectableContainerResourceInner().withLocation("rnxxmueed") - .withTags(mapOf("qtc", "dvstkw", "piohgwxrtfu", "ealmfmtdaaygdvwv", "k", "xepxgyqagvrvmn")) - .withProperties(new ProtectableContainer().withFriendlyName("queziky") - .withBackupManagementType(BackupManagementType.AZURE_WORKLOAD) - .withHealthStatus("kallatmel") - .withContainerId("ipicc")) - .withEtag("kzivgvvcnayrh"); - model = BinaryData.fromObject(model).toObject(ProtectableContainerResourceInner.class); - Assertions.assertEquals("rnxxmueed", model.location()); - Assertions.assertEquals("dvstkw", model.tags().get("qtc")); - Assertions.assertEquals("queziky", model.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_WORKLOAD, model.properties().backupManagementType()); - Assertions.assertEquals("kallatmel", model.properties().healthStatus()); - Assertions.assertEquals("ipicc", model.properties().containerId()); - Assertions.assertEquals("kzivgvvcnayrh", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerResourceListTests.java deleted file mode 100644 index e9a6c5dac80f9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerResourceListTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectableContainerResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainerResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectableContainerResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectableContainerResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"protectableContainerType\":\"ProtectableContainer\",\"friendlyName\":\"zapvhelx\",\"backupManagementType\":\"MAB\",\"healthStatus\":\"yat\",\"containerId\":\"ckcb\"},\"eTag\":\"ejrjxgciqibrho\",\"location\":\"xsdqrhzoymibmrqy\",\"tags\":{\"zdtmhrkwofy\":\"hwflu\",\"iwbwoenwashrtdtk\":\"voqacpiexpbt\",\"kulpiujwaasi\":\"nqxwbp\",\"qlpqwcciuq\":\"qiiobyuqer\"},\"id\":\"bdbutauvf\",\"name\":\"tkuwhhmhykojo\",\"type\":\"afnn\"},{\"properties\":{\"protectableContainerType\":\"ProtectableContainer\",\"friendlyName\":\"ichkoymkcdyhb\",\"backupManagementType\":\"AzureSql\",\"healthStatus\":\"wdreqnovvqfovl\",\"containerId\":\"ywsuwsy\"},\"eTag\":\"ndsytgadg\",\"location\":\"r\",\"tags\":{\"qnzarrwl\":\"en\",\"jfqka\":\"uu\",\"iipfpubj\":\"e\"},\"id\":\"bwwift\",\"name\":\"hqkvpuvksgplsak\",\"type\":\"ynfs\"},{\"properties\":{\"protectableContainerType\":\"ProtectableContainer\",\"friendlyName\":\"jphuopxodlqi\",\"backupManagementType\":\"AzureStorage\",\"healthStatus\":\"rz\",\"containerId\":\"leosjswsrms\"},\"eTag\":\"zrpzb\",\"location\":\"hckqqzqioxiy\",\"tags\":{\"ynkedyatrwyhqmib\":\"i\",\"mnzgmwznmabi\":\"yhwitsmypyynpcdp\",\"wwrlkdmtncv\":\"nsorgjhxbldt\",\"xdy\":\"kotl\"},\"id\":\"gsyocogj\",\"name\":\"tdtbnnhadooc\",\"type\":\"kvci\"}],\"nextLink\":\"nvpamq\"}") - .toObject(ProtectableContainerResourceList.class); - Assertions.assertEquals("nvpamq", model.nextLink()); - Assertions.assertEquals("xsdqrhzoymibmrqy", model.value().get(0).location()); - Assertions.assertEquals("hwflu", model.value().get(0).tags().get("zdtmhrkwofy")); - Assertions.assertEquals("zapvhelx", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("yat", model.value().get(0).properties().healthStatus()); - Assertions.assertEquals("ckcb", model.value().get(0).properties().containerId()); - Assertions.assertEquals("ejrjxgciqibrho", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectableContainerResourceList model = new ProtectableContainerResourceList().withNextLink("nvpamq") - .withValue(Arrays.asList( - new ProtectableContainerResourceInner().withLocation("xsdqrhzoymibmrqy") - .withTags(mapOf("zdtmhrkwofy", "hwflu", "iwbwoenwashrtdtk", "voqacpiexpbt", "kulpiujwaasi", - "nqxwbp", "qlpqwcciuq", "qiiobyuqer")) - .withProperties(new ProtectableContainer().withFriendlyName("zapvhelx") - .withBackupManagementType(BackupManagementType.MAB) - .withHealthStatus("yat") - .withContainerId("ckcb")) - .withEtag("ejrjxgciqibrho"), - new ProtectableContainerResourceInner().withLocation("r") - .withTags(mapOf("qnzarrwl", "en", "jfqka", "uu", "iipfpubj", "e")) - .withProperties(new ProtectableContainer().withFriendlyName("ichkoymkcdyhb") - .withBackupManagementType(BackupManagementType.AZURE_SQL) - .withHealthStatus("wdreqnovvqfovl") - .withContainerId("ywsuwsy")) - .withEtag("ndsytgadg"), - new ProtectableContainerResourceInner().withLocation("hckqqzqioxiy") - .withTags(mapOf("ynkedyatrwyhqmib", "i", "mnzgmwznmabi", "yhwitsmypyynpcdp", "wwrlkdmtncv", - "nsorgjhxbldt", "xdy", "kotl")) - .withProperties(new ProtectableContainer().withFriendlyName("jphuopxodlqi") - .withBackupManagementType(BackupManagementType.AZURE_STORAGE) - .withHealthStatus("rz") - .withContainerId("leosjswsrms")) - .withEtag("zrpzb"))); - model = BinaryData.fromObject(model).toObject(ProtectableContainerResourceList.class); - Assertions.assertEquals("nvpamq", model.nextLink()); - Assertions.assertEquals("xsdqrhzoymibmrqy", model.value().get(0).location()); - Assertions.assertEquals("hwflu", model.value().get(0).tags().get("zdtmhrkwofy")); - Assertions.assertEquals("zapvhelx", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("yat", model.value().get(0).properties().healthStatus()); - Assertions.assertEquals("ckcb", model.value().get(0).properties().containerId()); - Assertions.assertEquals("ejrjxgciqibrho", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerTests.java deleted file mode 100644 index 31ee240d48a9e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainerTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainer; -import org.junit.jupiter.api.Assertions; - -public final class ProtectableContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectableContainer model = BinaryData.fromString( - "{\"protectableContainerType\":\"ProtectableContainer\",\"friendlyName\":\"n\",\"backupManagementType\":\"MAB\",\"healthStatus\":\"xwczelpcire\",\"containerId\":\"feaenwab\"}") - .toObject(ProtectableContainer.class); - Assertions.assertEquals("n", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("xwczelpcire", model.healthStatus()); - Assertions.assertEquals("feaenwab", model.containerId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectableContainer model = new ProtectableContainer().withFriendlyName("n") - .withBackupManagementType(BackupManagementType.MAB) - .withHealthStatus("xwczelpcire") - .withContainerId("feaenwab"); - model = BinaryData.fromObject(model).toObject(ProtectableContainer.class); - Assertions.assertEquals("n", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.MAB, model.backupManagementType()); - Assertions.assertEquals("xwczelpcire", model.healthStatus()); - Assertions.assertEquals("feaenwab", model.containerId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainersListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainersListMockTests.java deleted file mode 100644 index 2ae17e89d609a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectableContainersListMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectableContainerResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectableContainersListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"protectableContainerType\":\"ProtectableContainer\",\"friendlyName\":\"s\",\"backupManagementType\":\"AzureStorage\",\"healthStatus\":\"xsmyltrw\",\"containerId\":\"fmtbgwjdxwn\"},\"eTag\":\"kurrdreyzjwh\",\"location\":\"etw\",\"tags\":{\"qseuzuukykcyqhy\":\"z\",\"fop\":\"qzzdcykeyste\",\"azgbsqgpe\":\"z\",\"fut\":\"q\"},\"id\":\"dpvozglqj\",\"name\":\"kn\",\"type\":\"zcl\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.protectableContainers() - .list("dhsoymhpv", "yqfttehdpboujst", "fvvdshxcdedsue", "ygnxcgjtfrnqukt", - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("etw", response.iterator().next().location()); - Assertions.assertEquals("z", response.iterator().next().tags().get("qseuzuukykcyqhy")); - Assertions.assertEquals("s", response.iterator().next().properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, - response.iterator().next().properties().backupManagementType()); - Assertions.assertEquals("xsmyltrw", response.iterator().next().properties().healthStatus()); - Assertions.assertEquals("fmtbgwjdxwn", response.iterator().next().properties().containerId()); - Assertions.assertEquals("kurrdreyzjwh", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index 473ccf51a456d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectedItemOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"AzureIaasVM\",\"workloadType\":\"VM\",\"containerName\":\"bfcmkrfts\",\"sourceResourceId\":\"wjjxsgm\",\"policyId\":\"wvif\",\"lastRecoveryPoint\":\"2021-02-28T16:49:55Z\",\"backupSetName\":\"cifhocjxwkl\",\"createMode\":\"Recover\",\"deferredDeleteTimeInUTC\":\"2021-06-04T22:03:27Z\",\"isScheduledForDeferredDelete\":true,\"deferredDeleteTimeRemaining\":\"cmufunlcpxxv\",\"isDeferredDeleteScheduleUpcoming\":false,\"isRehydrate\":true,\"resourceGuardOperationRequests\":[\"jgvrquvpyggl\",\"mcrdcue\"],\"isArchiveEnabled\":false,\"policyName\":\"ahxm\",\"softDeleteRetentionPeriodInDays\":418950073,\"vaultId\":\"arvsx\"},\"eTag\":\"bglcjkayspthzodu\",\"location\":\"tl\",\"tags\":{\"djxyxgbkkqvjcteo\":\"gblioskkfmkm\",\"pxvjnzd\":\"dlrslskk\",\"pcnab\":\"vocoj\"},\"id\":\"zf\",\"name\":\"nggy\",\"type\":\"e\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectedItemResource response = manager.protectedItemOperationResults() - .getWithResponse("i", "hwu", "trdexyionofnin", "dbzsx", "wqqrsmpcbbprtuga", "bzbcyksiv", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("tl", response.location()); - Assertions.assertEquals("gblioskkfmkm", response.tags().get("djxyxgbkkqvjcteo")); - Assertions.assertEquals("bfcmkrfts", response.properties().containerName()); - Assertions.assertEquals("wjjxsgm", response.properties().sourceResourceId()); - Assertions.assertEquals("wvif", response.properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-28T16:49:55Z"), - response.properties().lastRecoveryPoint()); - Assertions.assertEquals("cifhocjxwkl", response.properties().backupSetName()); - Assertions.assertEquals(CreateMode.RECOVER, response.properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-04T22:03:27Z"), - response.properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(true, response.properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("cmufunlcpxxv", response.properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(false, response.properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, response.properties().isRehydrate()); - Assertions.assertEquals("jgvrquvpyggl", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, response.properties().isArchiveEnabled()); - Assertions.assertEquals("ahxm", response.properties().policyName()); - Assertions.assertEquals(418950073, response.properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("bglcjkayspthzodu", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemResourceInnerTests.java deleted file mode 100644 index 7fbd9b4dd22fe..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemResourceInnerTests.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectedItemResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItem; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectedItemResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectedItemResourceInner model = BinaryData.fromString( - "{\"properties\":{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"AzureWorkload\",\"workloadType\":\"SQLDataBase\",\"containerName\":\"pjhvmdajvnys\",\"sourceResourceId\":\"nqecanoaeup\",\"policyId\":\"yhltrpmopjmcm\",\"lastRecoveryPoint\":\"2020-12-22T02:02:43Z\",\"backupSetName\":\"kthfui\",\"createMode\":\"Recover\",\"deferredDeleteTimeInUTC\":\"2021-10-17T19:18:45Z\",\"isScheduledForDeferredDelete\":false,\"deferredDeleteTimeRemaining\":\"kvxod\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":true,\"resourceGuardOperationRequests\":[\"ydagfuaxbe\",\"yiuokktwh\",\"dxwzywqsmbsurexi\",\"o\"],\"isArchiveEnabled\":false,\"policyName\":\"fsfksymddyst\",\"softDeleteRetentionPeriodInDays\":980316888,\"vaultId\":\"xhqyudxorrqnb\"},\"eTag\":\"czvyifq\",\"location\":\"vkd\",\"tags\":{\"vvdfwatkpnpul\":\"llr\"},\"id\":\"xxbczwtr\",\"name\":\"wiqzbqjvsovmyo\",\"type\":\"acspkwl\"}") - .toObject(ProtectedItemResourceInner.class); - Assertions.assertEquals("vkd", model.location()); - Assertions.assertEquals("llr", model.tags().get("vvdfwatkpnpul")); - Assertions.assertEquals("pjhvmdajvnys", model.properties().containerName()); - Assertions.assertEquals("nqecanoaeup", model.properties().sourceResourceId()); - Assertions.assertEquals("yhltrpmopjmcm", model.properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-22T02:02:43Z"), model.properties().lastRecoveryPoint()); - Assertions.assertEquals("kthfui", model.properties().backupSetName()); - Assertions.assertEquals(CreateMode.RECOVER, model.properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T19:18:45Z"), - model.properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("kvxod", model.properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.properties().isRehydrate()); - Assertions.assertEquals("ydagfuaxbe", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.properties().isArchiveEnabled()); - Assertions.assertEquals("fsfksymddyst", model.properties().policyName()); - Assertions.assertEquals(980316888, model.properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("czvyifq", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectedItemResourceInner model = new ProtectedItemResourceInner().withLocation("vkd") - .withTags(mapOf("vvdfwatkpnpul", "llr")) - .withProperties(new ProtectedItem().withContainerName("pjhvmdajvnys") - .withSourceResourceId("nqecanoaeup") - .withPolicyId("yhltrpmopjmcm") - .withLastRecoveryPoint(OffsetDateTime.parse("2020-12-22T02:02:43Z")) - .withBackupSetName("kthfui") - .withCreateMode(CreateMode.RECOVER) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-10-17T19:18:45Z")) - .withIsScheduledForDeferredDelete(false) - .withDeferredDeleteTimeRemaining("kvxod") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(true) - .withResourceGuardOperationRequests(Arrays.asList("ydagfuaxbe", "yiuokktwh", "dxwzywqsmbsurexi", "o")) - .withIsArchiveEnabled(false) - .withPolicyName("fsfksymddyst") - .withSoftDeleteRetentionPeriod(980316888)) - .withEtag("czvyifq"); - model = BinaryData.fromObject(model).toObject(ProtectedItemResourceInner.class); - Assertions.assertEquals("vkd", model.location()); - Assertions.assertEquals("llr", model.tags().get("vvdfwatkpnpul")); - Assertions.assertEquals("pjhvmdajvnys", model.properties().containerName()); - Assertions.assertEquals("nqecanoaeup", model.properties().sourceResourceId()); - Assertions.assertEquals("yhltrpmopjmcm", model.properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-22T02:02:43Z"), model.properties().lastRecoveryPoint()); - Assertions.assertEquals("kthfui", model.properties().backupSetName()); - Assertions.assertEquals(CreateMode.RECOVER, model.properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T19:18:45Z"), - model.properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("kvxod", model.properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.properties().isRehydrate()); - Assertions.assertEquals("ydagfuaxbe", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.properties().isArchiveEnabled()); - Assertions.assertEquals("fsfksymddyst", model.properties().policyName()); - Assertions.assertEquals(980316888, model.properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("czvyifq", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemResourceListTests.java deleted file mode 100644 index 9bf57ce009862..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemResourceListTests.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectedItemResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemResourceList; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectedItemResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectedItemResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"AzureWorkload\",\"workloadType\":\"Sharepoint\",\"containerName\":\"y\",\"sourceResourceId\":\"pvgqzcjrvxdjzlm\",\"policyId\":\"xkvugfhzov\",\"lastRecoveryPoint\":\"2021-04-06T17:45:34Z\",\"backupSetName\":\"zunlu\",\"createMode\":\"Invalid\",\"deferredDeleteTimeInUTC\":\"2021-01-21T11:08:17Z\",\"isScheduledForDeferredDelete\":false,\"deferredDeleteTimeRemaining\":\"i\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":false,\"resourceGuardOperationRequests\":[\"uaejxdultsk\",\"bbtdzumvee\"],\"isArchiveEnabled\":false,\"policyName\":\"ozuhkfp\",\"softDeleteRetentionPeriodInDays\":1369679233,\"vaultId\":\"ofd\"},\"eTag\":\"uusdttouwa\",\"location\":\"oekqvk\",\"tags\":{\"xwyjsflhhc\":\"smv\",\"ixisxyawjoy\":\"aln\",\"yexz\":\"qcslyjpkiid\"},\"id\":\"eli\",\"name\":\"hnrztfol\",\"type\":\"bnxknalaulppg\"},{\"properties\":{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"Invalid\",\"workloadType\":\"AzureFileShare\",\"containerName\":\"nyiropuhpi\",\"sourceResourceId\":\"pgylg\",\"policyId\":\"itxmedjvcslynqww\",\"lastRecoveryPoint\":\"2021-09-17T17:00:46Z\",\"backupSetName\":\"zhxgktrmgucn\",\"createMode\":\"Recover\",\"deferredDeleteTimeInUTC\":\"2021-05-25T00:20:27Z\",\"isScheduledForDeferredDelete\":true,\"deferredDeleteTimeRemaining\":\"lwptfdy\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":false,\"resourceGuardOperationRequests\":[\"ceopzfqrhhuaopp\"],\"isArchiveEnabled\":false,\"policyName\":\"qxolzdahzx\",\"softDeleteRetentionPeriodInDays\":792773086,\"vaultId\":\"gbkdmoizpos\"},\"eTag\":\"grcfb\",\"location\":\"nrmfqjhhk\",\"tags\":{\"vkr\":\"vjymjhxxjyngud\",\"szjfauvjfdxxivet\":\"swbxqz\",\"qaqtdoqmcbxvwvxy\":\"t\",\"obl\":\"lqbhsf\"},\"id\":\"tkblmpewww\",\"name\":\"bkrvrnsvshqj\",\"type\":\"hxcr\"}],\"nextLink\":\"fovasr\"}") - .toObject(ProtectedItemResourceList.class); - Assertions.assertEquals("fovasr", model.nextLink()); - Assertions.assertEquals("oekqvk", model.value().get(0).location()); - Assertions.assertEquals("smv", model.value().get(0).tags().get("xwyjsflhhc")); - Assertions.assertEquals("y", model.value().get(0).properties().containerName()); - Assertions.assertEquals("pvgqzcjrvxdjzlm", model.value().get(0).properties().sourceResourceId()); - Assertions.assertEquals("xkvugfhzov", model.value().get(0).properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-06T17:45:34Z"), - model.value().get(0).properties().lastRecoveryPoint()); - Assertions.assertEquals("zunlu", model.value().get(0).properties().backupSetName()); - Assertions.assertEquals(CreateMode.INVALID, model.value().get(0).properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-21T11:08:17Z"), - model.value().get(0).properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.value().get(0).properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("i", model.value().get(0).properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.value().get(0).properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(false, model.value().get(0).properties().isRehydrate()); - Assertions.assertEquals("uaejxdultsk", - model.value().get(0).properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.value().get(0).properties().isArchiveEnabled()); - Assertions.assertEquals("ozuhkfp", model.value().get(0).properties().policyName()); - Assertions.assertEquals(1369679233, model.value().get(0).properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("uusdttouwa", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectedItemResourceList model = new ProtectedItemResourceList().withNextLink("fovasr") - .withValue(Arrays.asList( - new ProtectedItemResourceInner().withLocation("oekqvk") - .withTags(mapOf("xwyjsflhhc", "smv", "ixisxyawjoy", "aln", "yexz", "qcslyjpkiid")) - .withProperties(new ProtectedItem().withContainerName("y") - .withSourceResourceId("pvgqzcjrvxdjzlm") - .withPolicyId("xkvugfhzov") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-04-06T17:45:34Z")) - .withBackupSetName("zunlu") - .withCreateMode(CreateMode.INVALID) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-01-21T11:08:17Z")) - .withIsScheduledForDeferredDelete(false) - .withDeferredDeleteTimeRemaining("i") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(false) - .withResourceGuardOperationRequests(Arrays.asList("uaejxdultsk", "bbtdzumvee")) - .withIsArchiveEnabled(false) - .withPolicyName("ozuhkfp") - .withSoftDeleteRetentionPeriod(1369679233)) - .withEtag("uusdttouwa"), - new ProtectedItemResourceInner().withLocation("nrmfqjhhk") - .withTags(mapOf("vkr", "vjymjhxxjyngud", "szjfauvjfdxxivet", "swbxqz", "qaqtdoqmcbxvwvxy", "t", - "obl", "lqbhsf")) - .withProperties(new ProtectedItem().withContainerName("nyiropuhpi") - .withSourceResourceId("pgylg") - .withPolicyId("itxmedjvcslynqww") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-09-17T17:00:46Z")) - .withBackupSetName("zhxgktrmgucn") - .withCreateMode(CreateMode.RECOVER) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-05-25T00:20:27Z")) - .withIsScheduledForDeferredDelete(true) - .withDeferredDeleteTimeRemaining("lwptfdy") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(false) - .withResourceGuardOperationRequests(Arrays.asList("ceopzfqrhhuaopp")) - .withIsArchiveEnabled(false) - .withPolicyName("qxolzdahzx") - .withSoftDeleteRetentionPeriod(792773086)) - .withEtag("grcfb"))); - model = BinaryData.fromObject(model).toObject(ProtectedItemResourceList.class); - Assertions.assertEquals("fovasr", model.nextLink()); - Assertions.assertEquals("oekqvk", model.value().get(0).location()); - Assertions.assertEquals("smv", model.value().get(0).tags().get("xwyjsflhhc")); - Assertions.assertEquals("y", model.value().get(0).properties().containerName()); - Assertions.assertEquals("pvgqzcjrvxdjzlm", model.value().get(0).properties().sourceResourceId()); - Assertions.assertEquals("xkvugfhzov", model.value().get(0).properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-06T17:45:34Z"), - model.value().get(0).properties().lastRecoveryPoint()); - Assertions.assertEquals("zunlu", model.value().get(0).properties().backupSetName()); - Assertions.assertEquals(CreateMode.INVALID, model.value().get(0).properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-21T11:08:17Z"), - model.value().get(0).properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, model.value().get(0).properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("i", model.value().get(0).properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.value().get(0).properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(false, model.value().get(0).properties().isRehydrate()); - Assertions.assertEquals("uaejxdultsk", - model.value().get(0).properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, model.value().get(0).properties().isArchiveEnabled()); - Assertions.assertEquals("ozuhkfp", model.value().get(0).properties().policyName()); - Assertions.assertEquals(1369679233, model.value().get(0).properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("uusdttouwa", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemTests.java deleted file mode 100644 index 838c989009cbe..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItem; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ProtectedItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectedItem model = BinaryData.fromString( - "{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"AzureBackupServer\",\"workloadType\":\"Sharepoint\",\"containerName\":\"xjmflbvv\",\"sourceResourceId\":\"hrk\",\"policyId\":\"iwwzjuqk\",\"lastRecoveryPoint\":\"2021-05-03T11:30:29Z\",\"backupSetName\":\"jiwkuofoskghsau\",\"createMode\":\"Invalid\",\"deferredDeleteTimeInUTC\":\"2021-01-11T01:27:45Z\",\"isScheduledForDeferredDelete\":true,\"deferredDeleteTimeRemaining\":\"eduugi\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":true,\"resourceGuardOperationRequests\":[\"y\"],\"isArchiveEnabled\":true,\"policyName\":\"e\",\"softDeleteRetentionPeriodInDays\":981492544,\"vaultId\":\"npc\"}") - .toObject(ProtectedItem.class); - Assertions.assertEquals("xjmflbvv", model.containerName()); - Assertions.assertEquals("hrk", model.sourceResourceId()); - Assertions.assertEquals("iwwzjuqk", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T11:30:29Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("jiwkuofoskghsau", model.backupSetName()); - Assertions.assertEquals(CreateMode.INVALID, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-11T01:27:45Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(true, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("eduugi", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("y", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, model.isArchiveEnabled()); - Assertions.assertEquals("e", model.policyName()); - Assertions.assertEquals(981492544, model.softDeleteRetentionPeriod()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectedItem model = new ProtectedItem().withContainerName("xjmflbvv") - .withSourceResourceId("hrk") - .withPolicyId("iwwzjuqk") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-05-03T11:30:29Z")) - .withBackupSetName("jiwkuofoskghsau") - .withCreateMode(CreateMode.INVALID) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-01-11T01:27:45Z")) - .withIsScheduledForDeferredDelete(true) - .withDeferredDeleteTimeRemaining("eduugi") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(true) - .withResourceGuardOperationRequests(Arrays.asList("y")) - .withIsArchiveEnabled(true) - .withPolicyName("e") - .withSoftDeleteRetentionPeriod(981492544); - model = BinaryData.fromObject(model).toObject(ProtectedItem.class); - Assertions.assertEquals("xjmflbvv", model.containerName()); - Assertions.assertEquals("hrk", model.sourceResourceId()); - Assertions.assertEquals("iwwzjuqk", model.policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T11:30:29Z"), model.lastRecoveryPoint()); - Assertions.assertEquals("jiwkuofoskghsau", model.backupSetName()); - Assertions.assertEquals(CreateMode.INVALID, model.createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-11T01:27:45Z"), model.deferredDeleteTimeInUtc()); - Assertions.assertEquals(true, model.isScheduledForDeferredDelete()); - Assertions.assertEquals("eduugi", model.deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, model.isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(true, model.isRehydrate()); - Assertions.assertEquals("y", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(true, model.isArchiveEnabled()); - Assertions.assertEquals("e", model.policyName()); - Assertions.assertEquals(981492544, model.softDeleteRetentionPeriod()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsCreateOrUpdateWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 2472a70d9784e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectedItemsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"AzureStorage\",\"workloadType\":\"Sharepoint\",\"containerName\":\"xricctkwmuqq\",\"sourceResourceId\":\"jxeiy\",\"policyId\":\"esrw\",\"lastRecoveryPoint\":\"2021-09-23T00:22:38Z\",\"backupSetName\":\"hdctrceqn\",\"createMode\":\"Default\",\"deferredDeleteTimeInUTC\":\"2021-01-22T20:14:34Z\",\"isScheduledForDeferredDelete\":true,\"deferredDeleteTimeRemaining\":\"hdmljz\",\"isDeferredDeleteScheduleUpcoming\":false,\"isRehydrate\":false,\"resourceGuardOperationRequests\":[\"jpbi\",\"nzpphepife\",\"leqirccjclykcgxv\"],\"isArchiveEnabled\":false,\"policyName\":\"vczuodacpune\",\"softDeleteRetentionPeriodInDays\":1031387254,\"vaultId\":\"djxqeskoynuiylpc\"},\"eTag\":\"ewsedveskwxe\",\"location\":\"qphr\",\"tags\":{\"tsghpbcbcp\":\"zhctm\",\"ypefcpczshnuqnda\":\"arpzeqacdldtzm\",\"vtvegwqiukvzw\":\"zupfkhuytuszxhm\"},\"id\":\"dwttha\",\"name\":\"kgkskjivbsshaj\",\"type\":\"fukpeexpgeu\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectedItemResource response = manager.protectedItems() - .define("gcwn") - .withRegion("phm") - .withExistingProtectionContainer("gybpmfb", "ununm", "zkrvfyi", "kdschlzvfictnkjj") - .withTags(mapOf("nmwynefxexl", "kcgsuthhl", "mdskjhhxdlajfoxc", "ciatxtjrrl", "lxlhuavkrm", "scv", - "slojfkqidnqt", "kmyjmkxett")) - .withProperties(new ProtectedItem().withContainerName("rtogmhmj") - .withSourceResourceId("scdfpdqw") - .withPolicyId("gevgwmse") - .withLastRecoveryPoint(OffsetDateTime.parse("2021-06-22T21:43:44Z")) - .withBackupSetName("ifvqnr") - .withCreateMode(CreateMode.DEFAULT) - .withDeferredDeleteTimeInUtc(OffsetDateTime.parse("2021-10-28T06:45:39Z")) - .withIsScheduledForDeferredDelete(false) - .withDeferredDeleteTimeRemaining("nvwjhrsidqpxl") - .withIsDeferredDeleteScheduleUpcoming(true) - .withIsRehydrate(false) - .withResourceGuardOperationRequests(Arrays.asList("ngatwmy", "yutrymd", "mfjhpycvjqdvdwkq")) - .withIsArchiveEnabled(true) - .withPolicyName("lefgnaavuagnte") - .withSoftDeleteRetentionPeriod(2121929864)) - .withEtag("duyeuyl") - .create(); - - Assertions.assertEquals("qphr", response.location()); - Assertions.assertEquals("zhctm", response.tags().get("tsghpbcbcp")); - Assertions.assertEquals("xricctkwmuqq", response.properties().containerName()); - Assertions.assertEquals("jxeiy", response.properties().sourceResourceId()); - Assertions.assertEquals("esrw", response.properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-23T00:22:38Z"), - response.properties().lastRecoveryPoint()); - Assertions.assertEquals("hdctrceqn", response.properties().backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, response.properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-22T20:14:34Z"), - response.properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(true, response.properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("hdmljz", response.properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(false, response.properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(false, response.properties().isRehydrate()); - Assertions.assertEquals("jpbi", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, response.properties().isArchiveEnabled()); - Assertions.assertEquals("vczuodacpune", response.properties().policyName()); - Assertions.assertEquals(1031387254, response.properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("ewsedveskwxe", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsDeleteWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsDeleteWithResponseMockTests.java deleted file mode 100644 index 98a5c520989bf..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectedItemsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.protectedItems() - .deleteWithResponse("zygleexahvm", "whsbrcary", "sjjzyvoaqajuveh", "ptdmkrrbhmpful", "be", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsGetWithResponseMockTests.java deleted file mode 100644 index abb89d00af470..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectedItemsGetWithResponseMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.CreateMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectedItemResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectedItemsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"protectedItemType\":\"ProtectedItem\",\"backupManagementType\":\"MAB\",\"workloadType\":\"SQLDB\",\"containerName\":\"ef\",\"sourceResourceId\":\"absol\",\"policyId\":\"nqqlmgnl\",\"lastRecoveryPoint\":\"2021-02-08T02:13:29Z\",\"backupSetName\":\"xtelexhvu\",\"createMode\":\"Default\",\"deferredDeleteTimeInUTC\":\"2021-02-12T14:02:41Z\",\"isScheduledForDeferredDelete\":false,\"deferredDeleteTimeRemaining\":\"qocarkuzlbc\",\"isDeferredDeleteScheduleUpcoming\":true,\"isRehydrate\":false,\"resourceGuardOperationRequests\":[\"awqytllhdyzm\",\"ckze\"],\"isArchiveEnabled\":false,\"policyName\":\"kck\",\"softDeleteRetentionPeriodInDays\":789963505,\"vaultId\":\"x\"},\"eTag\":\"abjkdtfohfao\",\"location\":\"zvkiwrsiwdy\",\"tags\":{\"ogd\":\"rykcrraueekcsue\",\"ydl\":\"acbcb\",\"fbnrq\":\"idywmhmptyril\",\"omals\":\"xvztpbnfnqtxj\"},\"id\":\"bnfddep\",\"name\":\"dwq\",\"type\":\"ns\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectedItemResource response = manager.protectedItems() - .getWithResponse("ibtyibuyvpirfqjp", "qnoowsbedenrex", "xbhxvucnulgmnhj", "vdyznf", "jsvkskmqozzkivy", - "jrliiz", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("zvkiwrsiwdy", response.location()); - Assertions.assertEquals("rykcrraueekcsue", response.tags().get("ogd")); - Assertions.assertEquals("ef", response.properties().containerName()); - Assertions.assertEquals("absol", response.properties().sourceResourceId()); - Assertions.assertEquals("nqqlmgnl", response.properties().policyId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T02:13:29Z"), - response.properties().lastRecoveryPoint()); - Assertions.assertEquals("xtelexhvu", response.properties().backupSetName()); - Assertions.assertEquals(CreateMode.DEFAULT, response.properties().createMode()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-12T14:02:41Z"), - response.properties().deferredDeleteTimeInUtc()); - Assertions.assertEquals(false, response.properties().isScheduledForDeferredDelete()); - Assertions.assertEquals("qocarkuzlbc", response.properties().deferredDeleteTimeRemaining()); - Assertions.assertEquals(true, response.properties().isDeferredDeleteScheduleUpcoming()); - Assertions.assertEquals(false, response.properties().isRehydrate()); - Assertions.assertEquals("awqytllhdyzm", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals(false, response.properties().isArchiveEnabled()); - Assertions.assertEquals("kck", response.properties().policyName()); - Assertions.assertEquals(789963505, response.properties().softDeleteRetentionPeriod()); - Assertions.assertEquals("abjkdtfohfao", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index faf91fe36b983..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionContainerOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"qvfqepdxc\",\"backupManagementType\":\"AzureIaasVM\",\"registrationStatus\":\"bwyvpjbowcpjqdu\",\"healthStatus\":\"ixexkydfbwljavhu\",\"protectableObjectType\":\"k\"},\"eTag\":\"dvrgliegftcvbi\",\"location\":\"ftksd\",\"tags\":{\"ldbglzout\":\"nkefgmwdhcebuvc\",\"clyzgs\":\"aaqgzeka\"},\"id\":\"orbjg\",\"name\":\"nzjotvmr\",\"type\":\"khlobvvjbhvhdi\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionContainerResource response = manager.protectionContainerOperationResults() - .getWithResponse("nkkiiwvmtumxpy", "djf", "axroqvqpilrgunc", "nlduwzorxsbm", "aqklxy", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ftksd", response.location()); - Assertions.assertEquals("nkefgmwdhcebuvc", response.tags().get("ldbglzout")); - Assertions.assertEquals("qvfqepdxc", response.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_IAAS_VM, response.properties().backupManagementType()); - Assertions.assertEquals("bwyvpjbowcpjqdu", response.properties().registrationStatus()); - Assertions.assertEquals("ixexkydfbwljavhu", response.properties().healthStatus()); - Assertions.assertEquals("k", response.properties().protectableObjectType()); - Assertions.assertEquals("dvrgliegftcvbi", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerRefreshOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerRefreshOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index d4f0ff21d8e16..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerRefreshOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionContainerRefreshOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.protectionContainerRefreshOperationResults() - .getWithResponse("vzvluyq", "aiossscyvaifp", "uacvfy", "owpsfxt", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerResourceInnerTests.java deleted file mode 100644 index 12ff43707aca1..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerResourceInnerTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionContainerResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainer; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionContainerResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionContainerResourceInner model = BinaryData.fromString( - "{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"kl\",\"backupManagementType\":\"AzureWorkload\",\"registrationStatus\":\"jhwuaanozjos\",\"healthStatus\":\"youlp\",\"protectableObjectType\":\"v\"},\"eTag\":\"glrvimjwosytxi\",\"location\":\"cskfcktqumiekk\",\"tags\":{\"yf\":\"ikh\",\"unygaeqid\":\"hdgqggeb\"},\"id\":\"qfatpxllrxcyjm\",\"name\":\"a\",\"type\":\"su\"}") - .toObject(ProtectionContainerResourceInner.class); - Assertions.assertEquals("cskfcktqumiekk", model.location()); - Assertions.assertEquals("ikh", model.tags().get("yf")); - Assertions.assertEquals("kl", model.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_WORKLOAD, model.properties().backupManagementType()); - Assertions.assertEquals("jhwuaanozjos", model.properties().registrationStatus()); - Assertions.assertEquals("youlp", model.properties().healthStatus()); - Assertions.assertEquals("v", model.properties().protectableObjectType()); - Assertions.assertEquals("glrvimjwosytxi", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionContainerResourceInner model = new ProtectionContainerResourceInner().withLocation("cskfcktqumiekk") - .withTags(mapOf("yf", "ikh", "unygaeqid", "hdgqggeb")) - .withProperties(new ProtectionContainer().withFriendlyName("kl") - .withBackupManagementType(BackupManagementType.AZURE_WORKLOAD) - .withRegistrationStatus("jhwuaanozjos") - .withHealthStatus("youlp") - .withProtectableObjectType("v")) - .withEtag("glrvimjwosytxi"); - model = BinaryData.fromObject(model).toObject(ProtectionContainerResourceInner.class); - Assertions.assertEquals("cskfcktqumiekk", model.location()); - Assertions.assertEquals("ikh", model.tags().get("yf")); - Assertions.assertEquals("kl", model.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_WORKLOAD, model.properties().backupManagementType()); - Assertions.assertEquals("jhwuaanozjos", model.properties().registrationStatus()); - Assertions.assertEquals("youlp", model.properties().healthStatus()); - Assertions.assertEquals("v", model.properties().protectableObjectType()); - Assertions.assertEquals("glrvimjwosytxi", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerResourceListTests.java deleted file mode 100644 index cd3e24378065b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerResourceListTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionContainerResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionContainerResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionContainerResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"bqwrvtldgm\",\"backupManagementType\":\"AzureStorage\",\"registrationStatus\":\"mpipaslthaqfxs\",\"healthStatus\":\"wutwbdsre\",\"protectableObjectType\":\"drhneuyow\"},\"eTag\":\"d\",\"location\":\"ytisibir\",\"tags\":{\"lfzxiavrmbzonoki\":\"ikpzimejza\",\"rgz\":\"rjqc\"},\"id\":\"frl\",\"name\":\"zszrnwoiindfpw\",\"type\":\"jylwbtlhflsj\"},{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"szfjvfbgofelja\",\"backupManagementType\":\"AzureSql\",\"registrationStatus\":\"qhl\",\"healthStatus\":\"riiiojnalghfkv\",\"protectableObjectType\":\"sexso\"},\"eTag\":\"el\",\"location\":\"qhhahhxvrhmzkwpj\",\"tags\":{\"ujxukndxd\":\"spughftqsxhq\",\"syqtfi\":\"grjguufzd\",\"phoszqz\":\"whbotzingamv\",\"kfwynw\":\"dphqamv\"},\"id\":\"vtbvkayh\",\"name\":\"tnvyqiatkzwp\",\"type\":\"npwzcjaes\"}],\"nextLink\":\"v\"}") - .toObject(ProtectionContainerResourceList.class); - Assertions.assertEquals("v", model.nextLink()); - Assertions.assertEquals("ytisibir", model.value().get(0).location()); - Assertions.assertEquals("ikpzimejza", model.value().get(0).tags().get("lfzxiavrmbzonoki")); - Assertions.assertEquals("bqwrvtldgm", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, - model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("mpipaslthaqfxs", model.value().get(0).properties().registrationStatus()); - Assertions.assertEquals("wutwbdsre", model.value().get(0).properties().healthStatus()); - Assertions.assertEquals("drhneuyow", model.value().get(0).properties().protectableObjectType()); - Assertions.assertEquals("d", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionContainerResourceList model = new ProtectionContainerResourceList().withNextLink("v") - .withValue(Arrays.asList( - new ProtectionContainerResourceInner().withLocation("ytisibir") - .withTags(mapOf("lfzxiavrmbzonoki", "ikpzimejza", "rgz", "rjqc")) - .withProperties(new ProtectionContainer().withFriendlyName("bqwrvtldgm") - .withBackupManagementType(BackupManagementType.AZURE_STORAGE) - .withRegistrationStatus("mpipaslthaqfxs") - .withHealthStatus("wutwbdsre") - .withProtectableObjectType("drhneuyow")) - .withEtag("d"), - new ProtectionContainerResourceInner().withLocation("qhhahhxvrhmzkwpj") - .withTags(mapOf("ujxukndxd", "spughftqsxhq", "syqtfi", "grjguufzd", "phoszqz", "whbotzingamv", - "kfwynw", "dphqamv")) - .withProperties(new ProtectionContainer().withFriendlyName("szfjvfbgofelja") - .withBackupManagementType(BackupManagementType.AZURE_SQL) - .withRegistrationStatus("qhl") - .withHealthStatus("riiiojnalghfkv") - .withProtectableObjectType("sexso")) - .withEtag("el"))); - model = BinaryData.fromObject(model).toObject(ProtectionContainerResourceList.class); - Assertions.assertEquals("v", model.nextLink()); - Assertions.assertEquals("ytisibir", model.value().get(0).location()); - Assertions.assertEquals("ikpzimejza", model.value().get(0).tags().get("lfzxiavrmbzonoki")); - Assertions.assertEquals("bqwrvtldgm", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, - model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("mpipaslthaqfxs", model.value().get(0).properties().registrationStatus()); - Assertions.assertEquals("wutwbdsre", model.value().get(0).properties().healthStatus()); - Assertions.assertEquals("drhneuyow", model.value().get(0).properties().protectableObjectType()); - Assertions.assertEquals("d", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerTests.java deleted file mode 100644 index b3c85d3587fa7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainerTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainer; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionContainerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionContainer model = BinaryData.fromString( - "{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"r\",\"backupManagementType\":\"AzureBackupServer\",\"registrationStatus\":\"mjsjqb\",\"healthStatus\":\"hyxxrwlycoduhpk\",\"protectableObjectType\":\"gymare\"}") - .toObject(ProtectionContainer.class); - Assertions.assertEquals("r", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, model.backupManagementType()); - Assertions.assertEquals("mjsjqb", model.registrationStatus()); - Assertions.assertEquals("hyxxrwlycoduhpk", model.healthStatus()); - Assertions.assertEquals("gymare", model.protectableObjectType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionContainer model = new ProtectionContainer().withFriendlyName("r") - .withBackupManagementType(BackupManagementType.AZURE_BACKUP_SERVER) - .withRegistrationStatus("mjsjqb") - .withHealthStatus("hyxxrwlycoduhpk") - .withProtectableObjectType("gymare"); - model = BinaryData.fromObject(model).toObject(ProtectionContainer.class); - Assertions.assertEquals("r", model.friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, model.backupManagementType()); - Assertions.assertEquals("mjsjqb", model.registrationStatus()); - Assertions.assertEquals("hyxxrwlycoduhpk", model.healthStatus()); - Assertions.assertEquals("gymare", model.protectableObjectType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersGetWithResponseMockTests.java deleted file mode 100644 index ffc00b81da132..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersGetWithResponseMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionContainersGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"pftxudqyeme\",\"backupManagementType\":\"AzureBackupServer\",\"registrationStatus\":\"ucmci\",\"healthStatus\":\"nee\",\"protectableObjectType\":\"jauwcgxefnohaitr\"},\"eTag\":\"izerw\",\"location\":\"udasmxubvfbng\",\"tags\":{\"aud\":\"cefhpriylfmpzt\",\"dculregp\":\"vhl\",\"dgrtwmew\":\"tmojhvrztnvgyshq\",\"rzrr\":\"zlpykcfazzwjcay\"},\"id\":\"nsyby\",\"name\":\"polwzrghsrlei\",\"type\":\"kfscjfncjwv\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionContainerResource response = manager.protectionContainers() - .getWithResponse("tzeyowmndcovd", "zqauxzan", "mk", "fruwkud", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("udasmxubvfbng", response.location()); - Assertions.assertEquals("cefhpriylfmpzt", response.tags().get("aud")); - Assertions.assertEquals("pftxudqyeme", response.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, response.properties().backupManagementType()); - Assertions.assertEquals("ucmci", response.properties().registrationStatus()); - Assertions.assertEquals("nee", response.properties().healthStatus()); - Assertions.assertEquals("jauwcgxefnohaitr", response.properties().protectableObjectType()); - Assertions.assertEquals("izerw", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersInquireWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersInquireWithResponseMockTests.java deleted file mode 100644 index 7acce5082a9eb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersInquireWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionContainersInquireWithResponseMockTests { - @Test - public void testInquireWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.protectionContainers() - .inquireWithResponse("fsvagh", "pynwlslrcigtzjcv", "xqlaps", "ssov", "xpavid", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRefreshWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRefreshWithResponseMockTests.java deleted file mode 100644 index bfe121f20b431..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRefreshWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionContainersRefreshWithResponseMockTests { - @Test - public void testRefreshWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.protectionContainers() - .refreshWithResponse("ievw", "fcvvy", "zslp", "xgcbdsvalpnpt", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRegisterMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRegisterMockTests.java deleted file mode 100644 index 34271b3849a88..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersRegisterMockTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainer; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionContainerResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionContainersRegisterMockTests { - @Test - public void testRegister() throws Exception { - String responseStr - = "{\"properties\":{\"containerType\":\"ProtectionContainer\",\"friendlyName\":\"ntumeezbxvq\",\"backupManagementType\":\"AzureBackupServer\",\"registrationStatus\":\"vwcga\",\"healthStatus\":\"omtmjzwxuqgov\",\"protectableObjectType\":\"pwwztjfmkkhtgf\"},\"eTag\":\"dmlsc\",\"location\":\"rllccnaovjowazhp\",\"tags\":{\"srqorcgenmvceb\":\"comlyotgkwsx\",\"dcqjkedwqurc\":\"eetqujxcxxq\",\"qqrsil\":\"ojmrvvxwjongzse\"},\"id\":\"chskxxka\",\"name\":\"sbvr\",\"type\":\"aqgvto\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionContainerResource response = manager.protectionContainers() - .define("obfelhldiuhz") - .withRegion("fdvhaxdvwzae") - .withExistingBackupFabric("trkxgpazwu", "x", "qvn") - .withTags(mapOf("oixwgiksb", "hthdklmvetatlakf")) - .withProperties(new ProtectionContainer().withFriendlyName("lmfaewzgiudjp") - .withBackupManagementType(BackupManagementType.AZURE_IAAS_VM) - .withRegistrationStatus("ttqhnmhkrezsds") - .withHealthStatus("heqdgcru") - .withProtectableObjectType("pinymmqgwokmikp")) - .withEtag("fbmjxuvji") - .create(); - - Assertions.assertEquals("rllccnaovjowazhp", response.location()); - Assertions.assertEquals("comlyotgkwsx", response.tags().get("srqorcgenmvceb")); - Assertions.assertEquals("ntumeezbxvq", response.properties().friendlyName()); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, response.properties().backupManagementType()); - Assertions.assertEquals("vwcga", response.properties().registrationStatus()); - Assertions.assertEquals("omtmjzwxuqgov", response.properties().healthStatus()); - Assertions.assertEquals("pwwztjfmkkhtgf", response.properties().protectableObjectType()); - Assertions.assertEquals("dmlsc", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersUnregisterWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersUnregisterWithResponseMockTests.java deleted file mode 100644 index e1f7d199bc653..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionContainersUnregisterWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionContainersUnregisterWithResponseMockTests { - @Test - public void testUnregisterWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.protectionContainers() - .unregisterWithResponse("ag", "qwtltngvmreupt", "klzmijajw", "l", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentResourceInnerTests.java deleted file mode 100644 index d8119b85d41e1..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentResourceInnerTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionIntentResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionIntentResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionIntentResourceInner model = BinaryData.fromString( - "{\"properties\":{\"protectionIntentItemType\":\"ProtectionIntent\",\"backupManagementType\":\"DefaultBackup\",\"sourceResourceId\":\"xhekuksjtxukcdm\",\"itemId\":\"rcryuanzwuxzdxta\",\"policyId\":\"lhmwhfpmrqobm\",\"protectionState\":\"Protected\"},\"eTag\":\"nryrtihf\",\"location\":\"tijbpzvgnwzsymgl\",\"tags\":{\"fcbjysagithxqha\":\"cyzkohdbihanuf\",\"cnpqxuhivyqniwby\":\"ifpikxwczby\",\"grtfwvu\":\"rkxvdum\",\"h\":\"xgaudccs\"},\"id\":\"jcny\",\"name\":\"j\",\"type\":\"kryhtnapczwlokj\"}") - .toObject(ProtectionIntentResourceInner.class); - Assertions.assertEquals("tijbpzvgnwzsymgl", model.location()); - Assertions.assertEquals("cyzkohdbihanuf", model.tags().get("fcbjysagithxqha")); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.properties().backupManagementType()); - Assertions.assertEquals("xhekuksjtxukcdm", model.properties().sourceResourceId()); - Assertions.assertEquals("rcryuanzwuxzdxta", model.properties().itemId()); - Assertions.assertEquals("lhmwhfpmrqobm", model.properties().policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.properties().protectionState()); - Assertions.assertEquals("nryrtihf", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionIntentResourceInner model = new ProtectionIntentResourceInner().withLocation("tijbpzvgnwzsymgl") - .withTags(mapOf("fcbjysagithxqha", "cyzkohdbihanuf", "cnpqxuhivyqniwby", "ifpikxwczby", "grtfwvu", - "rkxvdum", "h", "xgaudccs")) - .withProperties(new ProtectionIntent().withBackupManagementType(BackupManagementType.DEFAULT_BACKUP) - .withSourceResourceId("xhekuksjtxukcdm") - .withItemId("rcryuanzwuxzdxta") - .withPolicyId("lhmwhfpmrqobm") - .withProtectionState(ProtectionStatus.PROTECTED)) - .withEtag("nryrtihf"); - model = BinaryData.fromObject(model).toObject(ProtectionIntentResourceInner.class); - Assertions.assertEquals("tijbpzvgnwzsymgl", model.location()); - Assertions.assertEquals("cyzkohdbihanuf", model.tags().get("fcbjysagithxqha")); - Assertions.assertEquals(BackupManagementType.DEFAULT_BACKUP, model.properties().backupManagementType()); - Assertions.assertEquals("xhekuksjtxukcdm", model.properties().sourceResourceId()); - Assertions.assertEquals("rcryuanzwuxzdxta", model.properties().itemId()); - Assertions.assertEquals("lhmwhfpmrqobm", model.properties().policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.properties().protectionState()); - Assertions.assertEquals("nryrtihf", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentResourceListTests.java deleted file mode 100644 index 323e7787c9b9a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentResourceListTests.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionIntentResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntentResourceList; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionIntentResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionIntentResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"protectionIntentItemType\":\"ProtectionIntent\",\"backupManagementType\":\"MAB\",\"sourceResourceId\":\"wixjsprozvcp\",\"itemId\":\"eg\",\"policyId\":\"wmfdatscmdvpjhul\",\"protectionState\":\"Protected\"},\"eTag\":\"mkjozkrwf\",\"location\":\"dio\",\"tags\":{\"yoqpsoaccta\":\"slwejdpvw\",\"lahbcryff\":\"akl\",\"xpaojakhmsbz\":\"fdosyg\"},\"id\":\"hcrzevd\",\"name\":\"hlxaolthqtr\",\"type\":\"qjbpfzfsin\"},{\"properties\":{\"protectionIntentItemType\":\"ProtectionIntent\",\"backupManagementType\":\"AzureBackupServer\",\"sourceResourceId\":\"jrwzox\",\"itemId\":\"tfell\",\"policyId\":\"fziton\",\"protectionState\":\"ProtectionFailed\"},\"eTag\":\"pjkjlxofpdv\",\"location\":\"pfxxy\",\"tags\":{\"mayhuybbkpodepoo\":\"i\",\"rxzxtheo\":\"inuvamiheogn\",\"cciqihnhungbwjz\":\"usivye\"},\"id\":\"nfygxgispemvtz\",\"name\":\"kufubljo\",\"type\":\"xqeofjaeqjhqjba\"}],\"nextLink\":\"msmjqulngsntn\"}") - .toObject(ProtectionIntentResourceList.class); - Assertions.assertEquals("msmjqulngsntn", model.nextLink()); - Assertions.assertEquals("dio", model.value().get(0).location()); - Assertions.assertEquals("slwejdpvw", model.value().get(0).tags().get("yoqpsoaccta")); - Assertions.assertEquals(BackupManagementType.MAB, model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("wixjsprozvcp", model.value().get(0).properties().sourceResourceId()); - Assertions.assertEquals("eg", model.value().get(0).properties().itemId()); - Assertions.assertEquals("wmfdatscmdvpjhul", model.value().get(0).properties().policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.value().get(0).properties().protectionState()); - Assertions.assertEquals("mkjozkrwf", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionIntentResourceList model = new ProtectionIntentResourceList().withNextLink("msmjqulngsntn") - .withValue(Arrays.asList( - new ProtectionIntentResourceInner().withLocation("dio") - .withTags(mapOf("yoqpsoaccta", "slwejdpvw", "lahbcryff", "akl", "xpaojakhmsbz", "fdosyg")) - .withProperties(new ProtectionIntent().withBackupManagementType(BackupManagementType.MAB) - .withSourceResourceId("wixjsprozvcp") - .withItemId("eg") - .withPolicyId("wmfdatscmdvpjhul") - .withProtectionState(ProtectionStatus.PROTECTED)) - .withEtag("mkjozkrwf"), - new ProtectionIntentResourceInner().withLocation("pfxxy") - .withTags(mapOf("mayhuybbkpodepoo", "i", "rxzxtheo", "inuvamiheogn", "cciqihnhungbwjz", "usivye")) - .withProperties( - new ProtectionIntent().withBackupManagementType(BackupManagementType.AZURE_BACKUP_SERVER) - .withSourceResourceId("jrwzox") - .withItemId("tfell") - .withPolicyId("fziton") - .withProtectionState(ProtectionStatus.PROTECTION_FAILED)) - .withEtag("pjkjlxofpdv"))); - model = BinaryData.fromObject(model).toObject(ProtectionIntentResourceList.class); - Assertions.assertEquals("msmjqulngsntn", model.nextLink()); - Assertions.assertEquals("dio", model.value().get(0).location()); - Assertions.assertEquals("slwejdpvw", model.value().get(0).tags().get("yoqpsoaccta")); - Assertions.assertEquals(BackupManagementType.MAB, model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("wixjsprozvcp", model.value().get(0).properties().sourceResourceId()); - Assertions.assertEquals("eg", model.value().get(0).properties().itemId()); - Assertions.assertEquals("wmfdatscmdvpjhul", model.value().get(0).properties().policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.value().get(0).properties().protectionState()); - Assertions.assertEquals("mkjozkrwf", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentTests.java deleted file mode 100644 index 24caffe757696..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionIntentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionIntent model = BinaryData.fromString( - "{\"protectionIntentItemType\":\"ProtectionIntent\",\"backupManagementType\":\"AzureSql\",\"sourceResourceId\":\"kvnipjoxz\",\"itemId\":\"chgejspodm\",\"policyId\":\"lzydehojwyahux\",\"protectionState\":\"ProtectionFailed\"}") - .toObject(ProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("kvnipjoxz", model.sourceResourceId()); - Assertions.assertEquals("chgejspodm", model.itemId()); - Assertions.assertEquals("lzydehojwyahux", model.policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionIntent model = new ProtectionIntent().withBackupManagementType(BackupManagementType.AZURE_SQL) - .withSourceResourceId("kvnipjoxz") - .withItemId("chgejspodm") - .withPolicyId("lzydehojwyahux") - .withProtectionState(ProtectionStatus.PROTECTION_FAILED); - model = BinaryData.fromObject(model).toObject(ProtectionIntent.class); - Assertions.assertEquals(BackupManagementType.AZURE_SQL, model.backupManagementType()); - Assertions.assertEquals("kvnipjoxz", model.sourceResourceId()); - Assertions.assertEquals("chgejspodm", model.itemId()); - Assertions.assertEquals("lzydehojwyahux", model.policyId()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsCreateOrUpdateWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index cb396266c7002..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntent; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntentResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionIntentsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"protectionIntentItemType\":\"ProtectionIntent\",\"backupManagementType\":\"AzureBackupServer\",\"sourceResourceId\":\"djyibqbnaomhjrm\",\"itemId\":\"hmaxljalfi\",\"policyId\":\"jmobca\",\"protectionState\":\"NotProtected\"},\"eTag\":\"xxqcwgaxf\",\"location\":\"vaknokzwjj\",\"tags\":{\"x\":\"tixldzyyfytpqs\",\"vyqlkjuvsmbmslzo\":\"mmpuj\",\"mx\":\"ovwzdbpqvybefg\",\"vcuartrhun\":\"okcvtlubses\"},\"id\":\"pirykycndzfqiv\",\"name\":\"reuykbbmnwagl\",\"type\":\"bxoeeonql\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionIntentResource response = manager.protectionIntents() - .define("rcyrucpcunnu") - .withRegion("hblkwqpatvbq") - .withExistingBackupFabric("l", "ytoithgygvfl", "gvdihoynkrxwetwk") - .withTags(mapOf("zqymtuowogtgits", "cjbctviv")) - .withProperties(new ProtectionIntent().withBackupManagementType(BackupManagementType.MAB) - .withSourceResourceId("oenodnaienh") - .withItemId("skndnelqkaadlknw") - .withPolicyId("anniyopetxivcnr") - .withProtectionState(ProtectionStatus.INVALID)) - .withEtag("ucae") - .create(); - - Assertions.assertEquals("vaknokzwjj", response.location()); - Assertions.assertEquals("tixldzyyfytpqs", response.tags().get("x")); - Assertions.assertEquals(BackupManagementType.AZURE_BACKUP_SERVER, response.properties().backupManagementType()); - Assertions.assertEquals("djyibqbnaomhjrm", response.properties().sourceResourceId()); - Assertions.assertEquals("hmaxljalfi", response.properties().itemId()); - Assertions.assertEquals("jmobca", response.properties().policyId()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, response.properties().protectionState()); - Assertions.assertEquals("xxqcwgaxf", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsDeleteWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsDeleteWithResponseMockTests.java deleted file mode 100644 index 136fe8656987c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionIntentsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 204, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.protectionIntents() - .deleteWithResponse("oytzpose", "xigpxvkqmaupxvpi", "dfaifyzyzeyuube", "ds", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsGetWithResponseMockTests.java deleted file mode 100644 index b294cf0f003bb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionIntentsGetWithResponseMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.BackupManagementType; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionIntentResource; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionIntentsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"protectionIntentItemType\":\"ProtectionIntent\",\"backupManagementType\":\"AzureStorage\",\"sourceResourceId\":\"pjlxeehuxiqhzl\",\"itemId\":\"yme\",\"policyId\":\"lskihmxrfdsajred\",\"protectionState\":\"NotProtected\"},\"eTag\":\"shtuwgm\",\"location\":\"vuafpwzyifr\",\"tags\":{\"gzdyimsfayorp\":\"ltxeqip\",\"sl\":\"avkjog\",\"sykvwjtqpke\":\"bnsmjkwynqxaek\",\"rspxklur\":\"myltj\"},\"id\":\"clf\",\"name\":\"xa\",\"type\":\"n\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionIntentResource response = manager.protectionIntents() - .getWithResponse("n", "pmil", "pnwy", "udqll", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("vuafpwzyifr", response.location()); - Assertions.assertEquals("ltxeqip", response.tags().get("gzdyimsfayorp")); - Assertions.assertEquals(BackupManagementType.AZURE_STORAGE, response.properties().backupManagementType()); - Assertions.assertEquals("pjlxeehuxiqhzl", response.properties().sourceResourceId()); - Assertions.assertEquals("yme", response.properties().itemId()); - Assertions.assertEquals("lskihmxrfdsajred", response.properties().policyId()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, response.properties().protectionState()); - Assertions.assertEquals("shtuwgm", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesCreateOrUpdateWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index b7aa1d7b42ba4..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionPoliciesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":2005722569,\"resourceGuardOperationRequests\":[\"mwhqnucsklh\",\"i\"]},\"eTag\":\"jtdlp\",\"location\":\"ninjgazlsvbz\",\"tags\":{\"lhsyekrdrenxolr\":\"uoeedwjcci\",\"bfgrlpunytjlkes\":\"yehqbeivdlhydwb\"},\"id\":\"mpathubtah\",\"name\":\"e\",\"type\":\"niiwllbvgwz\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionPolicyResource response = manager.protectionPolicies() - .define("dkyzbfvxov") - .withRegion("f") - .withExistingVault("mcrunfhiucn", "fbcpaqktkrumzu") - .withTags(mapOf("sdxeqztvxwmwwmjs", "qrkijpeuq", "wwa", "en", "ojhtollhs", "ecleqioulndhzyo", "lxpnovyoanf", - "idmytzln")) - .withProperties(new ProtectionPolicy().withProtectedItemsCount(113581490) - .withResourceGuardOperationRequests(Arrays.asList("q", "gvqrnhyhlwcj"))) - .withEtag("ggjh") - .create(); - - Assertions.assertEquals("ninjgazlsvbz", response.location()); - Assertions.assertEquals("uoeedwjcci", response.tags().get("lhsyekrdrenxolr")); - Assertions.assertEquals(2005722569, response.properties().protectedItemsCount()); - Assertions.assertEquals("mwhqnucsklh", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("jtdlp", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesDeleteMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesDeleteMockTests.java deleted file mode 100644 index 841be93fb0d3a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesDeleteMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionPoliciesDeleteMockTests { - @Test - public void testDelete() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.protectionPolicies() - .delete("hdkcprgu", "xrztiochlu", "ixmqrudjizcbf", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesGetWithResponseMockTests.java deleted file mode 100644 index 04b82117088ab..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPoliciesGetWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionPoliciesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":1415414821,\"resourceGuardOperationRequests\":[\"fcmfcn\",\"jajqmatxjt\"]},\"eTag\":\"ln\",\"location\":\"qgxxgfbb\",\"tags\":{\"calincryqxz\":\"pqagynoiprn\",\"mqimiymqru\":\"aqzi\"},\"id\":\"guhfupe\",\"name\":\"asvvoqsbpkfl\",\"type\":\"nfkgxsyaowuzowpu\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionPolicyResource response = manager.protectionPolicies() - .getWithResponse("pvksmit", "sqxtltclkrdpq", "fhyrfrakk", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("qgxxgfbb", response.location()); - Assertions.assertEquals("pqagynoiprn", response.tags().get("calincryqxz")); - Assertions.assertEquals(1415414821, response.properties().protectedItemsCount()); - Assertions.assertEquals("fcmfcn", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("ln", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationResultsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationResultsGetWithResponseMockTests.java deleted file mode 100644 index 53f83b77f7433..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyOperationResultsGetWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProtectionPolicyOperationResultsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":1320591219,\"resourceGuardOperationRequests\":[\"eboywhczzqrhm\",\"gqbedygi\",\"rzwnyk\"]},\"eTag\":\"djchlr\",\"location\":\"pwctofl\",\"tags\":{\"g\":\"acdhztxkbr\",\"fj\":\"rwjiyew\"},\"id\":\"rwq\",\"name\":\"xet\",\"type\":\"gcwvrrmdqntycna\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ProtectionPolicyResource response = manager.protectionPolicyOperationResults() - .getWithResponse("fftedousnktj", "gravaqogfkbebauz", "qbtxxwpf", "njzudr", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("pwctofl", response.location()); - Assertions.assertEquals("acdhztxkbr", response.tags().get("g")); - Assertions.assertEquals(1320591219, response.properties().protectedItemsCount()); - Assertions.assertEquals("eboywhczzqrhm", response.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("djchlr", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyResourceInnerTests.java deleted file mode 100644 index a486a36c14101..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyResourceInnerTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionPolicyResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicy; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionPolicyResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionPolicyResourceInner model = BinaryData.fromString( - "{\"properties\":{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":208644200,\"resourceGuardOperationRequests\":[\"kvceoveilovnotyf\",\"fcnj\",\"k\"]},\"eTag\":\"x\",\"location\":\"hbttkphyw\",\"tags\":{\"mclfplphoxuscr\":\"jtoqne\",\"psbjta\":\"abgy\",\"kqujidsuyono\":\"qugxywpmueefjzwf\",\"tcc\":\"glaocq\"},\"id\":\"g\",\"name\":\"udxytlmoyrx\",\"type\":\"wfudwpzntxhdzhl\"}") - .toObject(ProtectionPolicyResourceInner.class); - Assertions.assertEquals("hbttkphyw", model.location()); - Assertions.assertEquals("jtoqne", model.tags().get("mclfplphoxuscr")); - Assertions.assertEquals(208644200, model.properties().protectedItemsCount()); - Assertions.assertEquals("kvceoveilovnotyf", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("x", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionPolicyResourceInner model = new ProtectionPolicyResourceInner().withLocation("hbttkphyw") - .withTags(mapOf("mclfplphoxuscr", "jtoqne", "psbjta", "abgy", "kqujidsuyono", "qugxywpmueefjzwf", "tcc", - "glaocq")) - .withProperties(new ProtectionPolicy().withProtectedItemsCount(208644200) - .withResourceGuardOperationRequests(Arrays.asList("kvceoveilovnotyf", "fcnj", "k"))) - .withEtag("x"); - model = BinaryData.fromObject(model).toObject(ProtectionPolicyResourceInner.class); - Assertions.assertEquals("hbttkphyw", model.location()); - Assertions.assertEquals("jtoqne", model.tags().get("mclfplphoxuscr")); - Assertions.assertEquals(208644200, model.properties().protectedItemsCount()); - Assertions.assertEquals("kvceoveilovnotyf", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("x", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyResourceListTests.java deleted file mode 100644 index b3c72d774c448..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyResourceListTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionPolicyResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionPolicyResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionPolicyResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":712970145,\"resourceGuardOperationRequests\":[\"jwbhqwalmuz\"]},\"eTag\":\"xaepdkzjancuxr\",\"location\":\"d\",\"tags\":{\"bniwdj\":\"v\",\"s\":\"wz\",\"xytxhpzxbz\":\"bpg\",\"lcuhxwtctyqiklb\":\"fzab\"},\"id\":\"ovplw\",\"name\":\"bhvgy\",\"type\":\"gu\"},{\"properties\":{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":1732351990,\"resourceGuardOperationRequests\":[\"ss\",\"qukkfp\",\"gmgsxnkjzkde\"]},\"eTag\":\"pvlopwiyighxpkd\",\"location\":\"zb\",\"tags\":{\"umnyqu\":\"ebb\",\"hsmtxpsiebtfhvp\":\"edeojnabc\",\"qmhjjdhtld\":\"sapskr\"},\"id\":\"kyzxuutk\",\"name\":\"cwscwsvlx\",\"type\":\"togt\"}],\"nextLink\":\"upqsx\"}") - .toObject(ProtectionPolicyResourceList.class); - Assertions.assertEquals("upqsx", model.nextLink()); - Assertions.assertEquals("d", model.value().get(0).location()); - Assertions.assertEquals("v", model.value().get(0).tags().get("bniwdj")); - Assertions.assertEquals(712970145, model.value().get(0).properties().protectedItemsCount()); - Assertions.assertEquals("jwbhqwalmuz", - model.value().get(0).properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("xaepdkzjancuxr", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionPolicyResourceList model = new ProtectionPolicyResourceList().withNextLink("upqsx") - .withValue(Arrays.asList( - new ProtectionPolicyResourceInner().withLocation("d") - .withTags(mapOf("bniwdj", "v", "s", "wz", "xytxhpzxbz", "bpg", "lcuhxwtctyqiklb", "fzab")) - .withProperties(new ProtectionPolicy().withProtectedItemsCount(712970145) - .withResourceGuardOperationRequests(Arrays.asList("jwbhqwalmuz"))) - .withEtag("xaepdkzjancuxr"), - new ProtectionPolicyResourceInner().withLocation("zb") - .withTags(mapOf("umnyqu", "ebb", "hsmtxpsiebtfhvp", "edeojnabc", "qmhjjdhtld", "sapskr")) - .withProperties(new ProtectionPolicy().withProtectedItemsCount(1732351990) - .withResourceGuardOperationRequests(Arrays.asList("ss", "qukkfp", "gmgsxnkjzkde"))) - .withEtag("pvlopwiyighxpkd"))); - model = BinaryData.fromObject(model).toObject(ProtectionPolicyResourceList.class); - Assertions.assertEquals("upqsx", model.nextLink()); - Assertions.assertEquals("d", model.value().get(0).location()); - Assertions.assertEquals("v", model.value().get(0).tags().get("bniwdj")); - Assertions.assertEquals(712970145, model.value().get(0).properties().protectedItemsCount()); - Assertions.assertEquals("jwbhqwalmuz", - model.value().get(0).properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("xaepdkzjancuxr", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyTests.java deleted file mode 100644 index 5e1218e30fd7a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ProtectionPolicyTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicy; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProtectionPolicy model = BinaryData.fromString( - "{\"backupManagementType\":\"ProtectionPolicy\",\"protectedItemsCount\":291050041,\"resourceGuardOperationRequests\":[\"ck\",\"rlhrxs\",\"kyv\"]}") - .toObject(ProtectionPolicy.class); - Assertions.assertEquals(291050041, model.protectedItemsCount()); - Assertions.assertEquals("ck", model.resourceGuardOperationRequests().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProtectionPolicy model = new ProtectionPolicy().withProtectedItemsCount(291050041) - .withResourceGuardOperationRequests(Arrays.asList("ck", "rlhrxs", "kyv")); - model = BinaryData.fromObject(model).toObject(ProtectionPolicy.class); - Assertions.assertEquals(291050041, model.protectedItemsCount()); - Assertions.assertEquals("ck", model.resourceGuardOperationRequests().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointDiskConfigurationTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointDiskConfigurationTests.java deleted file mode 100644 index 018e556d3d349..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointDiskConfigurationTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DiskInformation; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointDiskConfiguration; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointDiskConfigurationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointDiskConfiguration model = BinaryData.fromString( - "{\"numberOfDisksIncludedInBackup\":1751850154,\"numberOfDisksAttachedToVm\":612007503,\"includedDiskList\":[{\"lun\":2132390446,\"name\":\"wgfmx\"},{\"lun\":641707757,\"name\":\"bjb\"}],\"excludedDiskList\":[{\"lun\":197594994,\"name\":\"dysna\"},{\"lun\":551280900,\"name\":\"qbctqha\"},{\"lun\":1692264859,\"name\":\"wdkqzeqy\"},{\"lun\":1179923211,\"name\":\"iunjxdf\"}]}") - .toObject(RecoveryPointDiskConfiguration.class); - Assertions.assertEquals(1751850154, model.numberOfDisksIncludedInBackup()); - Assertions.assertEquals(612007503, model.numberOfDisksAttachedToVm()); - Assertions.assertEquals(2132390446, model.includedDiskList().get(0).lun()); - Assertions.assertEquals("wgfmx", model.includedDiskList().get(0).name()); - Assertions.assertEquals(197594994, model.excludedDiskList().get(0).lun()); - Assertions.assertEquals("dysna", model.excludedDiskList().get(0).name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointDiskConfiguration model - = new RecoveryPointDiskConfiguration().withNumberOfDisksIncludedInBackup(1751850154) - .withNumberOfDisksAttachedToVm(612007503) - .withIncludedDiskList(Arrays.asList(new DiskInformation().withLun(2132390446).withName("wgfmx"), - new DiskInformation().withLun(641707757).withName("bjb"))) - .withExcludedDiskList(Arrays.asList(new DiskInformation().withLun(197594994).withName("dysna"), - new DiskInformation().withLun(551280900).withName("qbctqha"), - new DiskInformation().withLun(1692264859).withName("wdkqzeqy"), - new DiskInformation().withLun(1179923211).withName("iunjxdf"))); - model = BinaryData.fromObject(model).toObject(RecoveryPointDiskConfiguration.class); - Assertions.assertEquals(1751850154, model.numberOfDisksIncludedInBackup()); - Assertions.assertEquals(612007503, model.numberOfDisksAttachedToVm()); - Assertions.assertEquals(2132390446, model.includedDiskList().get(0).lun()); - Assertions.assertEquals("wgfmx", model.includedDiskList().get(0).name()); - Assertions.assertEquals(197594994, model.excludedDiskList().get(0).lun()); - Assertions.assertEquals("dysna", model.excludedDiskList().get(0).name()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointMoveReadinessInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointMoveReadinessInfoTests.java deleted file mode 100644 index 67af834daee4b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointMoveReadinessInfoTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointMoveReadinessInfo; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointMoveReadinessInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointMoveReadinessInfo model - = BinaryData.fromString("{\"isReadyForMove\":false,\"additionalInfo\":\"cf\"}") - .toObject(RecoveryPointMoveReadinessInfo.class); - Assertions.assertEquals(false, model.isReadyForMove()); - Assertions.assertEquals("cf", model.additionalInfo()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointMoveReadinessInfo model - = new RecoveryPointMoveReadinessInfo().withIsReadyForMove(false).withAdditionalInfo("cf"); - model = BinaryData.fromObject(model).toObject(RecoveryPointMoveReadinessInfo.class); - Assertions.assertEquals(false, model.isReadyForMove()); - Assertions.assertEquals("cf", model.additionalInfo()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointPropertiesTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointPropertiesTests.java deleted file mode 100644 index d8dce6da95d77..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointPropertiesTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointProperties; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointProperties model = BinaryData - .fromString("{\"expiryTime\":\"dlwggytsbwtovv\",\"ruleName\":\"seinqfiuf\",\"isSoftDeleted\":true}") - .toObject(RecoveryPointProperties.class); - Assertions.assertEquals("dlwggytsbwtovv", model.expiryTime()); - Assertions.assertEquals("seinqfiuf", model.ruleName()); - Assertions.assertEquals(true, model.isSoftDeleted()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointProperties model = new RecoveryPointProperties().withExpiryTime("dlwggytsbwtovv") - .withRuleName("seinqfiuf") - .withIsSoftDeleted(true); - model = BinaryData.fromObject(model).toObject(RecoveryPointProperties.class); - Assertions.assertEquals("dlwggytsbwtovv", model.expiryTime()); - Assertions.assertEquals("seinqfiuf", model.ruleName()); - Assertions.assertEquals(true, model.isSoftDeleted()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointRehydrationInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointRehydrationInfoTests.java deleted file mode 100644 index e0ad0da68cd5a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointRehydrationInfoTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointRehydrationInfo; -import com.azure.resourcemanager.recoveryservicesbackup.models.RehydrationPriority; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointRehydrationInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointRehydrationInfo model = BinaryData - .fromString("{\"rehydrationRetentionDuration\":\"eysfaqegplw\",\"rehydrationPriority\":\"High\"}") - .toObject(RecoveryPointRehydrationInfo.class); - Assertions.assertEquals("eysfaqegplw", model.rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.rehydrationPriority()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointRehydrationInfo model - = new RecoveryPointRehydrationInfo().withRehydrationRetentionDuration("eysfaqegplw") - .withRehydrationPriority(RehydrationPriority.HIGH); - model = BinaryData.fromObject(model).toObject(RecoveryPointRehydrationInfo.class); - Assertions.assertEquals("eysfaqegplw", model.rehydrationRetentionDuration()); - Assertions.assertEquals(RehydrationPriority.HIGH, model.rehydrationPriority()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointResourceInnerTests.java deleted file mode 100644 index 89cb14158f535..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointResourceInnerTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.RecoveryPointResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPoint; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointResourceInner model = BinaryData.fromString( - "{\"properties\":{\"objectType\":\"RecoveryPoint\"},\"eTag\":\"xjvuujqgidokg\",\"location\":\"ljyoxgvcltb\",\"tags\":{\"hkjeszzhbi\":\"c\",\"vecxgodebfqkk\":\"htxfvgxbfsmxnehm\"},\"id\":\"bmpukgriwflz\",\"name\":\"fbxzpuzycisp\",\"type\":\"qzahmgkbrp\"}") - .toObject(RecoveryPointResourceInner.class); - Assertions.assertEquals("ljyoxgvcltb", model.location()); - Assertions.assertEquals("c", model.tags().get("hkjeszzhbi")); - Assertions.assertEquals("xjvuujqgidokg", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointResourceInner model = new RecoveryPointResourceInner().withLocation("ljyoxgvcltb") - .withTags(mapOf("hkjeszzhbi", "c", "vecxgodebfqkk", "htxfvgxbfsmxnehm")) - .withProperties(new RecoveryPoint()) - .withEtag("xjvuujqgidokg"); - model = BinaryData.fromObject(model).toObject(RecoveryPointResourceInner.class); - Assertions.assertEquals("ljyoxgvcltb", model.location()); - Assertions.assertEquals("c", model.tags().get("hkjeszzhbi")); - Assertions.assertEquals("xjvuujqgidokg", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointResourceListTests.java deleted file mode 100644 index e619cbb4b4706..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointResourceListTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.RecoveryPointResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPoint; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"objectType\":\"RecoveryPoint\"},\"eTag\":\"hslkevleggzf\",\"location\":\"u\",\"tags\":{\"vmezy\":\"vfaxkffeiith\",\"burvjxxjnspy\":\"shxmzsbbzoggigrx\",\"udwtiukbl\":\"ptkoenkoukn\",\"o\":\"ngkpocipazy\"},\"id\":\"gukgjnpiucgygevq\",\"name\":\"ntypmrbpizcdrqj\",\"type\":\"dpydn\"},{\"properties\":{\"objectType\":\"RecoveryPoint\"},\"eTag\":\"xdeoejzic\",\"location\":\"ifsjttgzfbishcb\",\"tags\":{\"alpbuxwgipwhon\":\"jdeyeamdpha\",\"kix\":\"wkgshwa\",\"eputtmrywnuzoqf\":\"bin\",\"qvyxlwhzlsicoho\":\"iyqzrnk\"},\"id\":\"qnwvlrya\",\"name\":\"w\",\"type\":\"heun\"},{\"properties\":{\"objectType\":\"RecoveryPoint\"},\"eTag\":\"hgyxzkonoc\",\"location\":\"koklya\",\"tags\":{\"zf\":\"onuq\",\"vjektcxsenh\":\"beypewrmjmw\",\"rzpwvlqdqgbiq\":\"lrsf\",\"vf\":\"lihkaetcktvfc\"},\"id\":\"nkymuctqhjfbebrj\",\"name\":\"xerf\",\"type\":\"wutttxfvjrbi\"}],\"nextLink\":\"hxepcyvahfnlj\"}") - .toObject(RecoveryPointResourceList.class); - Assertions.assertEquals("hxepcyvahfnlj", model.nextLink()); - Assertions.assertEquals("u", model.value().get(0).location()); - Assertions.assertEquals("vfaxkffeiith", model.value().get(0).tags().get("vmezy")); - Assertions.assertEquals("hslkevleggzf", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointResourceList model = new RecoveryPointResourceList().withNextLink("hxepcyvahfnlj") - .withValue(Arrays.asList( - new RecoveryPointResourceInner().withLocation("u") - .withTags(mapOf("vmezy", "vfaxkffeiith", "burvjxxjnspy", "shxmzsbbzoggigrx", "udwtiukbl", - "ptkoenkoukn", "o", "ngkpocipazy")) - .withProperties(new RecoveryPoint()) - .withEtag("hslkevleggzf"), - new RecoveryPointResourceInner().withLocation("ifsjttgzfbishcb") - .withTags(mapOf("alpbuxwgipwhon", "jdeyeamdpha", "kix", "wkgshwa", "eputtmrywnuzoqf", "bin", - "qvyxlwhzlsicoho", "iyqzrnk")) - .withProperties(new RecoveryPoint()) - .withEtag("xdeoejzic"), - new RecoveryPointResourceInner().withLocation("koklya") - .withTags(mapOf("zf", "onuq", "vjektcxsenh", "beypewrmjmw", "rzpwvlqdqgbiq", "lrsf", "vf", - "lihkaetcktvfc")) - .withProperties(new RecoveryPoint()) - .withEtag("hgyxzkonoc"))); - model = BinaryData.fromObject(model).toObject(RecoveryPointResourceList.class); - Assertions.assertEquals("hxepcyvahfnlj", model.nextLink()); - Assertions.assertEquals("u", model.value().get(0).location()); - Assertions.assertEquals("vfaxkffeiith", model.value().get(0).tags().get("vmezy")); - Assertions.assertEquals("hslkevleggzf", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTests.java deleted file mode 100644 index 2ccf1030417bf..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPoint; - -public final class RecoveryPointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPoint model = BinaryData.fromString("{\"objectType\":\"RecoveryPoint\"}").toObject(RecoveryPoint.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPoint model = new RecoveryPoint(); - model = BinaryData.fromObject(model).toObject(RecoveryPoint.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTierInformationTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTierInformationTests.java deleted file mode 100644 index 57071d71fd9a5..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTierInformationTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformation; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointTierInformationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointTierInformation model = BinaryData - .fromString( - "{\"type\":\"ArchivedRP\",\"status\":\"Disabled\",\"extendedInfo\":{\"jrajcivm\":\"azkmtgguwp\"}}") - .toObject(RecoveryPointTierInformation.class); - Assertions.assertEquals(RecoveryPointTierType.ARCHIVED_RP, model.type()); - Assertions.assertEquals(RecoveryPointTierStatus.DISABLED, model.status()); - Assertions.assertEquals("azkmtgguwp", model.extendedInfo().get("jrajcivm")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointTierInformation model - = new RecoveryPointTierInformation().withType(RecoveryPointTierType.ARCHIVED_RP) - .withStatus(RecoveryPointTierStatus.DISABLED) - .withExtendedInfo(mapOf("jrajcivm", "azkmtgguwp")); - model = BinaryData.fromObject(model).toObject(RecoveryPointTierInformation.class); - Assertions.assertEquals(RecoveryPointTierType.ARCHIVED_RP, model.type()); - Assertions.assertEquals(RecoveryPointTierStatus.DISABLED, model.status()); - Assertions.assertEquals("azkmtgguwp", model.extendedInfo().get("jrajcivm")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTierInformationV2Tests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTierInformationV2Tests.java deleted file mode 100644 index c7865393f53a0..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointTierInformationV2Tests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierInformationV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointTierType; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class RecoveryPointTierInformationV2Tests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecoveryPointTierInformationV2 model = BinaryData.fromString( - "{\"type\":\"ArchivedRP\",\"status\":\"Rehydrated\",\"extendedInfo\":{\"twly\":\"wahfbousnfepgfew\",\"limmbcxf\":\"gncxykxhdj\",\"pxtgqscjav\":\"bcporxvxcjzhqizx\"}}") - .toObject(RecoveryPointTierInformationV2.class); - Assertions.assertEquals(RecoveryPointTierType.ARCHIVED_RP, model.type()); - Assertions.assertEquals(RecoveryPointTierStatus.REHYDRATED, model.status()); - Assertions.assertEquals("wahfbousnfepgfew", model.extendedInfo().get("twly")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecoveryPointTierInformationV2 model - = new RecoveryPointTierInformationV2().withType(RecoveryPointTierType.ARCHIVED_RP) - .withStatus(RecoveryPointTierStatus.REHYDRATED) - .withExtendedInfo( - mapOf("twly", "wahfbousnfepgfew", "limmbcxf", "gncxykxhdj", "pxtgqscjav", "bcporxvxcjzhqizx")); - model = BinaryData.fromObject(model).toObject(RecoveryPointTierInformationV2.class); - Assertions.assertEquals(RecoveryPointTierType.ARCHIVED_RP, model.type()); - Assertions.assertEquals(RecoveryPointTierStatus.REHYDRATED, model.status()); - Assertions.assertEquals("wahfbousnfepgfew", model.extendedInfo().get("twly")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsGetWithResponseMockTests.java deleted file mode 100644 index dc13e931bae70..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsGetWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class RecoveryPointsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"objectType\":\"RecoveryPoint\"},\"eTag\":\"rebluimmbwxsf\",\"location\":\"td\",\"tags\":{\"okqkbudbtwao\":\"xekr\",\"taaknwfrkebsmhp\":\"bavly\",\"gatolekscbctnan\":\"ujd\",\"wnsnlaimouxwks\":\"imwbzxpdcldpk\"},\"id\":\"mud\",\"name\":\"fco\",\"type\":\"bicziuswswj\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - RecoveryPointResource response = manager.recoveryPoints() - .getWithResponse("bjwzzos", "pkybtgl", "kzpgaj", "qjcemqbmf", "vqar", "z", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("td", response.location()); - Assertions.assertEquals("xekr", response.tags().get("okqkbudbtwao")); - Assertions.assertEquals("rebluimmbwxsf", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsListMockTests.java deleted file mode 100644 index d7c33aa588b88..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsListMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class RecoveryPointsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"objectType\":\"RecoveryPoint\"},\"eTag\":\"ttmbqdabzfiv\",\"location\":\"okpysthhzagj\",\"tags\":{\"g\":\"yrl\",\"qszllrz\":\"nuzejgvkveb\",\"gmihzpimcqr\":\"smmd\"},\"id\":\"nxtminklog\",\"name\":\"svtzarhzv\",\"type\":\"nsqktc\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.recoveryPoints() - .list("vzilmhiv", "kwwwnckn", "zdajlskzptjxu", "weucyrth", "qlehmcgcjeinu", "hokamvfej", - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("okpysthhzagj", response.iterator().next().location()); - Assertions.assertEquals("yrl", response.iterator().next().tags().get("g")); - Assertions.assertEquals("ttmbqdabzfiv", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsRecommendedForMovesListMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsRecommendedForMovesListMockTests.java deleted file mode 100644 index ded66eee186d6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RecoveryPointsRecommendedForMovesListMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ListRecoveryPointsRecommendedForMoveRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryPointResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class RecoveryPointsRecommendedForMovesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"objectType\":\"RecoveryPoint\"},\"eTag\":\"zabwmvog\",\"location\":\"jsvlpg\",\"tags\":{\"iomqoqpepiaea\":\"wcehaqidoyzlt\",\"eqwbpqqncjubkhj\":\"fsergdtpeqnacy\",\"qiipsejb\":\"zfymcwmbupyvqyvl\",\"ieswhddzydisn\":\"vsi\"},\"id\":\"epywyjlnldpxottd\",\"name\":\"i\",\"type\":\"ocqibz\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.recoveryPointsRecommendedForMoves() - .list("quxweyslandkd", "djhunhghcgawnr", "nquoxsotireimse", "bfsx", "tcyilbvz", - new ListRecoveryPointsRecommendedForMoveRequest().withObjectType("xcjzlquze") - .withExcludedRPList(Arrays.asList("jxebj", "b")), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("jsvlpg", response.iterator().next().location()); - Assertions.assertEquals("wcehaqidoyzlt", response.iterator().next().tags().get("iomqoqpepiaea")); - Assertions.assertEquals("zabwmvog", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardOperationDetailTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardOperationDetailTests.java deleted file mode 100644 index 9c79c88107200..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardOperationDetailTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardOperationDetail; -import org.junit.jupiter.api.Assertions; - -public final class ResourceGuardOperationDetailTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceGuardOperationDetail model = BinaryData - .fromString("{\"vaultCriticalOperation\":\"aysjkixqtnqttez\",\"defaultResourceRequest\":\"fffiak\"}") - .toObject(ResourceGuardOperationDetail.class); - Assertions.assertEquals("aysjkixqtnqttez", model.vaultCriticalOperation()); - Assertions.assertEquals("fffiak", model.defaultResourceRequest()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceGuardOperationDetail model - = new ResourceGuardOperationDetail().withVaultCriticalOperation("aysjkixqtnqttez") - .withDefaultResourceRequest("fffiak"); - model = BinaryData.fromObject(model).toObject(ResourceGuardOperationDetail.class); - Assertions.assertEquals("aysjkixqtnqttez", model.vaultCriticalOperation()); - Assertions.assertEquals("fffiak", model.defaultResourceRequest()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetMockTests.java deleted file mode 100644 index 2b73e356b2397..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBaseResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ResourceGuardProxiesGetMockTests { - @Test - public void testGet() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"resourceGuardResourceId\":\"vcjwqwoqsratj\",\"resourceGuardOperationDetails\":[{\"vaultCriticalOperation\":\"ybspijhfrzg\",\"defaultResourceRequest\":\"kagvwukhs\"},{\"vaultCriticalOperation\":\"mm\",\"defaultResourceRequest\":\"fmz\"},{\"vaultCriticalOperation\":\"ilz\",\"defaultResourceRequest\":\"nijmriprlkdne\"}],\"lastUpdatedTime\":\"tlrcxivcbkutpu\",\"description\":\"twjfluxynbp\"},\"eTag\":\"l\",\"location\":\"ywauyqnjckhm\",\"tags\":{\"qggljkybs\":\"jshgouarhwvix\"},\"id\":\"rcl\",\"name\":\"vtzqnrbctbhp\",\"type\":\"hxpcvrdnyeita\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.resourceGuardProxies().get("ihweeb", "ph", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ywauyqnjckhm", response.iterator().next().location()); - Assertions.assertEquals("jshgouarhwvix", response.iterator().next().tags().get("qggljkybs")); - Assertions.assertEquals("vcjwqwoqsratj", response.iterator().next().properties().resourceGuardResourceId()); - Assertions.assertEquals("ybspijhfrzg", - response.iterator().next().properties().resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("kagvwukhs", - response.iterator().next().properties().resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("tlrcxivcbkutpu", response.iterator().next().properties().lastUpdatedTime()); - Assertions.assertEquals("twjfluxynbp", response.iterator().next().properties().description()); - Assertions.assertEquals("l", response.iterator().next().etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseResourceInnerTests.java deleted file mode 100644 index 680bed47febca..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseResourceInnerTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ResourceGuardProxyBaseResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardOperationDetail; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBase; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ResourceGuardProxyBaseResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceGuardProxyBaseResourceInner model = BinaryData.fromString( - "{\"properties\":{\"resourceGuardResourceId\":\"ejvegrhbpnaixex\",\"resourceGuardOperationDetails\":[{\"vaultCriticalOperation\":\"reaxhcexdr\",\"defaultResourceRequest\":\"qahqkghtpwijn\"}],\"lastUpdatedTime\":\"jsvfycxzbfvoowv\",\"description\":\"mtg\"},\"eTag\":\"ppyostronzmyhgf\",\"location\":\"pnsxkmcwaek\",\"tags\":{\"ikkx\":\"reafxtsgumhjg\",\"qpvuzlmvfelf\":\"slol\",\"crpw\":\"tgp\"},\"id\":\"xeznoi\",\"name\":\"brnjwmw\",\"type\":\"pn\"}") - .toObject(ResourceGuardProxyBaseResourceInner.class); - Assertions.assertEquals("pnsxkmcwaek", model.location()); - Assertions.assertEquals("reafxtsgumhjg", model.tags().get("ikkx")); - Assertions.assertEquals("ejvegrhbpnaixex", model.properties().resourceGuardResourceId()); - Assertions.assertEquals("reaxhcexdr", - model.properties().resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("qahqkghtpwijn", - model.properties().resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("jsvfycxzbfvoowv", model.properties().lastUpdatedTime()); - Assertions.assertEquals("mtg", model.properties().description()); - Assertions.assertEquals("ppyostronzmyhgf", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceGuardProxyBaseResourceInner model - = new ResourceGuardProxyBaseResourceInner().withLocation("pnsxkmcwaek") - .withTags(mapOf("ikkx", "reafxtsgumhjg", "qpvuzlmvfelf", "slol", "crpw", "tgp")) - .withProperties(new ResourceGuardProxyBase().withResourceGuardResourceId("ejvegrhbpnaixex") - .withResourceGuardOperationDetails( - Arrays.asList(new ResourceGuardOperationDetail().withVaultCriticalOperation("reaxhcexdr") - .withDefaultResourceRequest("qahqkghtpwijn"))) - .withLastUpdatedTime("jsvfycxzbfvoowv") - .withDescription("mtg")) - .withEtag("ppyostronzmyhgf"); - model = BinaryData.fromObject(model).toObject(ResourceGuardProxyBaseResourceInner.class); - Assertions.assertEquals("pnsxkmcwaek", model.location()); - Assertions.assertEquals("reafxtsgumhjg", model.tags().get("ikkx")); - Assertions.assertEquals("ejvegrhbpnaixex", model.properties().resourceGuardResourceId()); - Assertions.assertEquals("reaxhcexdr", - model.properties().resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("qahqkghtpwijn", - model.properties().resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("jsvfycxzbfvoowv", model.properties().lastUpdatedTime()); - Assertions.assertEquals("mtg", model.properties().description()); - Assertions.assertEquals("ppyostronzmyhgf", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseResourceListTests.java deleted file mode 100644 index e44e4e6048787..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseResourceListTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ResourceGuardProxyBaseResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardOperationDetail; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBase; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBaseResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ResourceGuardProxyBaseResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceGuardProxyBaseResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"resourceGuardResourceId\":\"owepbqpcrfkb\",\"resourceGuardOperationDetails\":[{\"vaultCriticalOperation\":\"njv\",\"defaultResourceRequest\":\"wxlp\"},{\"vaultCriticalOperation\":\"kftnkhtjsyin\",\"defaultResourceRequest\":\"fq\"},{\"vaultCriticalOperation\":\"mtdh\",\"defaultResourceRequest\":\"dvypgikdgsz\"},{\"vaultCriticalOperation\":\"kbir\",\"defaultResourceRequest\":\"uzhlhkjoqrv\"}],\"lastUpdatedTime\":\"aatjinrvgoupmfi\",\"description\":\"fggjioolvr\"},\"eTag\":\"kvtkkg\",\"location\":\"lqwjygvjayvblm\",\"tags\":{\"rqufegxuvwz\":\"zuhbxvvyhgsopb\"},\"id\":\"bnhlmc\",\"name\":\"l\",\"type\":\"dn\"}],\"nextLink\":\"tvgbmhrixkwmy\"}") - .toObject(ResourceGuardProxyBaseResourceList.class); - Assertions.assertEquals("tvgbmhrixkwmy", model.nextLink()); - Assertions.assertEquals("lqwjygvjayvblm", model.value().get(0).location()); - Assertions.assertEquals("zuhbxvvyhgsopb", model.value().get(0).tags().get("rqufegxuvwz")); - Assertions.assertEquals("owepbqpcrfkb", model.value().get(0).properties().resourceGuardResourceId()); - Assertions.assertEquals("njv", - model.value().get(0).properties().resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("wxlp", - model.value().get(0).properties().resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("aatjinrvgoupmfi", model.value().get(0).properties().lastUpdatedTime()); - Assertions.assertEquals("fggjioolvr", model.value().get(0).properties().description()); - Assertions.assertEquals("kvtkkg", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceGuardProxyBaseResourceList model - = new ResourceGuardProxyBaseResourceList().withNextLink("tvgbmhrixkwmy") - .withValue(Arrays.asList(new ResourceGuardProxyBaseResourceInner().withLocation("lqwjygvjayvblm") - .withTags(mapOf("rqufegxuvwz", "zuhbxvvyhgsopb")) - .withProperties(new ResourceGuardProxyBase().withResourceGuardResourceId("owepbqpcrfkb") - .withResourceGuardOperationDetails(Arrays.asList( - new ResourceGuardOperationDetail().withVaultCriticalOperation("njv") - .withDefaultResourceRequest("wxlp"), - new ResourceGuardOperationDetail().withVaultCriticalOperation("kftnkhtjsyin") - .withDefaultResourceRequest("fq"), - new ResourceGuardOperationDetail().withVaultCriticalOperation("mtdh") - .withDefaultResourceRequest("dvypgikdgsz"), - new ResourceGuardOperationDetail().withVaultCriticalOperation("kbir") - .withDefaultResourceRequest("uzhlhkjoqrv"))) - .withLastUpdatedTime("aatjinrvgoupmfi") - .withDescription("fggjioolvr")) - .withEtag("kvtkkg"))); - model = BinaryData.fromObject(model).toObject(ResourceGuardProxyBaseResourceList.class); - Assertions.assertEquals("tvgbmhrixkwmy", model.nextLink()); - Assertions.assertEquals("lqwjygvjayvblm", model.value().get(0).location()); - Assertions.assertEquals("zuhbxvvyhgsopb", model.value().get(0).tags().get("rqufegxuvwz")); - Assertions.assertEquals("owepbqpcrfkb", model.value().get(0).properties().resourceGuardResourceId()); - Assertions.assertEquals("njv", - model.value().get(0).properties().resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("wxlp", - model.value().get(0).properties().resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("aatjinrvgoupmfi", model.value().get(0).properties().lastUpdatedTime()); - Assertions.assertEquals("fggjioolvr", model.value().get(0).properties().description()); - Assertions.assertEquals("kvtkkg", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseTests.java deleted file mode 100644 index cb6b663c82e2d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyBaseTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardOperationDetail; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBase; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ResourceGuardProxyBaseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceGuardProxyBase model = BinaryData.fromString( - "{\"resourceGuardResourceId\":\"saz\",\"resourceGuardOperationDetails\":[{\"vaultCriticalOperation\":\"qkagfhsxt\",\"defaultResourceRequest\":\"ugzxnf\"},{\"vaultCriticalOperation\":\"zpxdt\",\"defaultResourceRequest\":\"dm\"},{\"vaultCriticalOperation\":\"j\",\"defaultResourceRequest\":\"wuenvr\"}],\"lastUpdatedTime\":\"yo\",\"description\":\"ibreb\"}") - .toObject(ResourceGuardProxyBase.class); - Assertions.assertEquals("saz", model.resourceGuardResourceId()); - Assertions.assertEquals("qkagfhsxt", model.resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("ugzxnf", model.resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("yo", model.lastUpdatedTime()); - Assertions.assertEquals("ibreb", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceGuardProxyBase model = new ResourceGuardProxyBase().withResourceGuardResourceId("saz") - .withResourceGuardOperationDetails(Arrays.asList( - new ResourceGuardOperationDetail().withVaultCriticalOperation("qkagfhsxt") - .withDefaultResourceRequest("ugzxnf"), - new ResourceGuardOperationDetail().withVaultCriticalOperation("zpxdt").withDefaultResourceRequest("dm"), - new ResourceGuardOperationDetail().withVaultCriticalOperation("j") - .withDefaultResourceRequest("wuenvr"))) - .withLastUpdatedTime("yo") - .withDescription("ibreb"); - model = BinaryData.fromObject(model).toObject(ResourceGuardProxyBase.class); - Assertions.assertEquals("saz", model.resourceGuardResourceId()); - Assertions.assertEquals("qkagfhsxt", model.resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("ugzxnf", model.resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("yo", model.lastUpdatedTime()); - Assertions.assertEquals("ibreb", model.description()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsDeleteWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsDeleteWithResponseMockTests.java deleted file mode 100644 index b13a48c08556b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ResourceGuardProxyOperationsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.resourceGuardProxyOperations() - .deleteWithResponse("tftedz", "ubjtvgjsxmtyjjv", "vdpwwobtdphti", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsGetWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsGetWithResponseMockTests.java deleted file mode 100644 index bab5862a0a1eb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsGetWithResponseMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBaseResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ResourceGuardProxyOperationsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"resourceGuardResourceId\":\"evsaa\",\"resourceGuardOperationDetails\":[{\"vaultCriticalOperation\":\"caxikhfjqebgl\",\"defaultResourceRequest\":\"kxgzzromvygysem\"},{\"vaultCriticalOperation\":\"esrfsvpinkzpatq\",\"defaultResourceRequest\":\"iswxspv\"}],\"lastUpdatedTime\":\"ojazbbgspfte\",\"description\":\"b\"},\"eTag\":\"vpvdylytcovqse\",\"location\":\"srfjbdxzfxnx\",\"tags\":{\"cy\":\"muoswkjmdih\"},\"id\":\"yzlwhbwzjnufzrf\",\"name\":\"m\",\"type\":\"qgnnbz\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ResourceGuardProxyBaseResource response = manager.resourceGuardProxyOperations() - .getWithResponse("eq", "dynzjahwr", "uomzczfki", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("srfjbdxzfxnx", response.location()); - Assertions.assertEquals("muoswkjmdih", response.tags().get("cy")); - Assertions.assertEquals("evsaa", response.properties().resourceGuardResourceId()); - Assertions.assertEquals("caxikhfjqebgl", - response.properties().resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("kxgzzromvygysem", - response.properties().resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("ojazbbgspfte", response.properties().lastUpdatedTime()); - Assertions.assertEquals("b", response.properties().description()); - Assertions.assertEquals("vpvdylytcovqse", response.etag()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsPutWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsPutWithResponseMockTests.java deleted file mode 100644 index 6223a0a3ad183..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsPutWithResponseMockTests.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardOperationDetail; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBase; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceGuardProxyBaseResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ResourceGuardProxyOperationsPutWithResponseMockTests { - @Test - public void testPutWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"resourceGuardResourceId\":\"ykykip\",\"resourceGuardOperationDetails\":[{\"vaultCriticalOperation\":\"epfnoc\",\"defaultResourceRequest\":\"ezacfpztga\"},{\"vaultCriticalOperation\":\"yqejga\",\"defaultResourceRequest\":\"kctgkp\"}],\"lastUpdatedTime\":\"kqzkcyzmff\",\"description\":\"dyfcix\"},\"eTag\":\"lcqvhoejgoiutgw\",\"location\":\"mkahpqha\",\"tags\":{\"hncogmipnml\":\"tac\",\"v\":\"q\"},\"id\":\"bhikeaqgr\",\"name\":\"gpomxpu\",\"type\":\"dtsdfjy\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ResourceGuardProxyBaseResource response = manager.resourceGuardProxyOperations() - .define("fcm") - .withRegion("vfqbqna") - .withExistingVault("gubsrtmdylpe", "pilttjzgc") - .withTags(mapOf("yvdgxlyzk", "yenzsieuscpl")) - .withProperties(new ResourceGuardProxyBase().withResourceGuardResourceId("fbodetresrgvts") - .withResourceGuardOperationDetails(Arrays.asList( - new ResourceGuardOperationDetail().withVaultCriticalOperation("t") - .withDefaultResourceRequest("ivmuqkevzgjyp"), - new ResourceGuardOperationDetail().withVaultCriticalOperation("hxmpdxxz") - .withDefaultResourceRequest("wwzjwotnxlkfhglh"))) - .withLastUpdatedTime("oxqwecrsnhpcse") - .withDescription("xovppqibukklvzr")) - .withEtag("mlccmetjscz") - .create(); - - Assertions.assertEquals("mkahpqha", response.location()); - Assertions.assertEquals("tac", response.tags().get("hncogmipnml")); - Assertions.assertEquals("ykykip", response.properties().resourceGuardResourceId()); - Assertions.assertEquals("epfnoc", - response.properties().resourceGuardOperationDetails().get(0).vaultCriticalOperation()); - Assertions.assertEquals("ezacfpztga", - response.properties().resourceGuardOperationDetails().get(0).defaultResourceRequest()); - Assertions.assertEquals("kqzkcyzmff", response.properties().lastUpdatedTime()); - Assertions.assertEquals("dyfcix", response.properties().description()); - Assertions.assertEquals("lcqvhoejgoiutgw", response.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsUnlockDeleteWithResponseMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsUnlockDeleteWithResponseMockTests.java deleted file mode 100644 index 143ee9af0f225..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxyOperationsUnlockDeleteWithResponseMockTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.UnlockDeleteRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.UnlockDeleteResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ResourceGuardProxyOperationsUnlockDeleteWithResponseMockTests { - @Test - public void testUnlockDeleteWithResponse() throws Exception { - String responseStr = "{\"unlockDeleteExpiryTime\":\"uugggzlfbgrd\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - UnlockDeleteResponse response = manager.resourceGuardProxyOperations() - .unlockDeleteWithResponse("sffofwanmhksca", "w", "zcgwdfriw", - new UnlockDeleteRequest() - .withResourceGuardOperationRequests( - Arrays.asList("jpozoksc", "gllixdgbyfgwew", "k", "vxprwpxsoohu")) - .withResourceToBeDeleted("lcsklt"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("uugggzlfbgrd", response.unlockDeleteExpiryTime()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceListTests.java deleted file mode 100644 index c1abf713dd581..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceListTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ResourceList; -import org.junit.jupiter.api.Assertions; - -public final class ResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceList model = BinaryData.fromString("{\"nextLink\":\"bkzgcwrwclx\"}").toObject(ResourceList.class); - Assertions.assertEquals("bkzgcwrwclx", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceList model = new ResourceList().withNextLink("bkzgcwrwclx"); - model = BinaryData.fromObject(model).toObject(ResourceList.class); - Assertions.assertEquals("bkzgcwrwclx", model.nextLink()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProvidersBmsPrepareDataMoveMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProvidersBmsPrepareDataMoveMockTests.java deleted file mode 100644 index e48f5f0cc66a5..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProvidersBmsPrepareDataMoveMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataMoveLevel; -import com.azure.resourcemanager.recoveryservicesbackup.models.PrepareDataMoveRequest; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ResourceProvidersBmsPrepareDataMoveMockTests { - @Test - public void testBmsPrepareDataMove() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.resourceProviders() - .bmsPrepareDataMove("g", "syparybjufp", - new PrepareDataMoveRequest().withTargetResourceId("bjczjnciuiyqvlda") - .withTargetRegion("wvppi") - .withDataMoveLevel(DataMoveLevel.CONTAINER) - .withSourceContainerArmIds(Arrays.asList("lgcndhzxrrfcfsrh", "hgsnxuwwkpph", "fsbzxlbzxo")) - .withIgnoreMoved(true), - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProvidersBmsTriggerDataMoveMockTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProvidersBmsTriggerDataMoveMockTests.java deleted file mode 100644 index 12ecff5543df8..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceProvidersBmsTriggerDataMoveMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataMoveLevel; -import com.azure.resourcemanager.recoveryservicesbackup.models.TriggerDataMoveRequest; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ResourceProvidersBmsTriggerDataMoveMockTests { - @Test - public void testBmsTriggerDataMove() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - RecoveryServicesBackupManager manager = RecoveryServicesBackupManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.resourceProviders() - .bmsTriggerDataMove("k", "clwzacnmwpfsu", - new TriggerDataMoveRequest().withSourceResourceId("t") - .withSourceRegion("azyqbxyxoyfp") - .withDataMoveLevel(DataMoveLevel.CONTAINER) - .withCorrelationId("qi") - .withSourceContainerArmIds(Arrays.asList("xlhdj", "qdcadwvps", "zjiihjr", "ybmrzoepnxwd")) - .withPauseGC(true), - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreFileSpecsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreFileSpecsTests.java deleted file mode 100644 index 02d15efcf40a1..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreFileSpecsTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreFileSpecs; -import org.junit.jupiter.api.Assertions; - -public final class RestoreFileSpecsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RestoreFileSpecs model = BinaryData - .fromString("{\"path\":\"ufhyaomtbgh\",\"fileSpecType\":\"vgrvkffo\",\"targetFolderPath\":\"zh\"}") - .toObject(RestoreFileSpecs.class); - Assertions.assertEquals("ufhyaomtbgh", model.path()); - Assertions.assertEquals("vgrvkffo", model.fileSpecType()); - Assertions.assertEquals("zh", model.targetFolderPath()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RestoreFileSpecs model - = new RestoreFileSpecs().withPath("ufhyaomtbgh").withFileSpecType("vgrvkffo").withTargetFolderPath("zh"); - model = BinaryData.fromObject(model).toObject(RestoreFileSpecs.class); - Assertions.assertEquals("ufhyaomtbgh", model.path()); - Assertions.assertEquals("vgrvkffo", model.fileSpecType()); - Assertions.assertEquals("zh", model.targetFolderPath()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreRequestResourceTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreRequestResourceTests.java deleted file mode 100644 index 158b16c34c68e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreRequestResourceTests.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequestResource; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class RestoreRequestResourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RestoreRequestResource model = BinaryData.fromString( - "{\"properties\":{\"objectType\":\"RestoreRequest\",\"resourceGuardOperationRequests\":[\"ibnuqqkpik\",\"drgvtqagn\",\"uynhijg\"]},\"eTag\":\"ebf\",\"location\":\"iarbutrcvpna\",\"tags\":{\"unmpxttd\":\"hj\",\"nbtkcxywnytnr\":\"hrbnlankxmyskpbh\",\"qidybyx\":\"yn\",\"aaxdbabphlwrq\":\"zfcl\"},\"id\":\"fkts\",\"name\":\"hsucoc\",\"type\":\"nyyazttbtwwrqpue\"}") - .toObject(RestoreRequestResource.class); - Assertions.assertEquals("iarbutrcvpna", model.location()); - Assertions.assertEquals("hj", model.tags().get("unmpxttd")); - Assertions.assertEquals("ibnuqqkpik", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("ebf", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RestoreRequestResource model = new RestoreRequestResource().withLocation("iarbutrcvpna") - .withTags( - mapOf("unmpxttd", "hj", "nbtkcxywnytnr", "hrbnlankxmyskpbh", "qidybyx", "yn", "aaxdbabphlwrq", "zfcl")) - .withProperties(new RestoreRequest() - .withResourceGuardOperationRequests(Arrays.asList("ibnuqqkpik", "drgvtqagn", "uynhijg"))) - .withEtag("ebf"); - model = BinaryData.fromObject(model).toObject(RestoreRequestResource.class); - Assertions.assertEquals("iarbutrcvpna", model.location()); - Assertions.assertEquals("hj", model.tags().get("unmpxttd")); - Assertions.assertEquals("ibnuqqkpik", model.properties().resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("ebf", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreRequestTests.java deleted file mode 100644 index 9de2c951c847a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RestoreRequestTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class RestoreRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RestoreRequest model = BinaryData - .fromString("{\"objectType\":\"RestoreRequest\",\"resourceGuardOperationRequests\":[\"zywbiex\",\"fey\"]}") - .toObject(RestoreRequest.class); - Assertions.assertEquals("zywbiex", model.resourceGuardOperationRequests().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RestoreRequest model = new RestoreRequest().withResourceGuardOperationRequests(Arrays.asList("zywbiex", "fey")); - model = BinaryData.fromObject(model).toObject(RestoreRequest.class); - Assertions.assertEquals("zywbiex", model.resourceGuardOperationRequests().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RetentionDurationTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RetentionDurationTests.java deleted file mode 100644 index 448f4d05fc027..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RetentionDurationTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import org.junit.jupiter.api.Assertions; - -public final class RetentionDurationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RetentionDuration model = BinaryData.fromString("{\"count\":1048059203,\"durationType\":\"Weeks\"}") - .toObject(RetentionDuration.class); - Assertions.assertEquals(1048059203, model.count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RetentionDuration model - = new RetentionDuration().withCount(1048059203).withDurationType(RetentionDurationType.WEEKS); - model = BinaryData.fromObject(model).toObject(RetentionDuration.class); - Assertions.assertEquals(1048059203, model.count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.durationType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RetentionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RetentionPolicyTests.java deleted file mode 100644 index fd628d15d0535..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/RetentionPolicyTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; - -public final class RetentionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RetentionPolicy model - = BinaryData.fromString("{\"retentionPolicyType\":\"RetentionPolicy\"}").toObject(RetentionPolicy.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RetentionPolicy model = new RetentionPolicy(); - model = BinaryData.fromObject(model).toObject(RetentionPolicy.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SchedulePolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SchedulePolicyTests.java deleted file mode 100644 index 392ae96f05466..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SchedulePolicyTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy; - -public final class SchedulePolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SchedulePolicy model - = BinaryData.fromString("{\"schedulePolicyType\":\"SchedulePolicy\"}").toObject(SchedulePolicy.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SchedulePolicy model = new SchedulePolicy(); - model = BinaryData.fromObject(model).toObject(SchedulePolicy.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecuredVMDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecuredVMDetailsTests.java deleted file mode 100644 index f2f4b2a22410a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecuredVMDetailsTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.SecuredVMDetails; -import org.junit.jupiter.api.Assertions; - -public final class SecuredVMDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecuredVMDetails model - = BinaryData.fromString("{\"securedVMOsDiskEncryptionSetId\":\"vpilg\"}").toObject(SecuredVMDetails.class); - Assertions.assertEquals("vpilg", model.securedVmosDiskEncryptionSetId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecuredVMDetails model = new SecuredVMDetails().withSecuredVmosDiskEncryptionSetId("vpilg"); - model = BinaryData.fromObject(model).toObject(SecuredVMDetails.class); - Assertions.assertEquals("vpilg", model.securedVmosDiskEncryptionSetId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecurityPinBaseTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecurityPinBaseTests.java deleted file mode 100644 index 9f57155895c89..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SecurityPinBaseTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.SecurityPinBase; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SecurityPinBaseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityPinBase model - = BinaryData.fromString("{\"resourceGuardOperationRequests\":[\"yajguqfhwygzlv\",\"nk\"]}") - .toObject(SecurityPinBase.class); - Assertions.assertEquals("yajguqfhwygzlv", model.resourceGuardOperationRequests().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityPinBase model - = new SecurityPinBase().withResourceGuardOperationRequests(Arrays.asList("yajguqfhwygzlv", "nk")); - model = BinaryData.fromObject(model).toObject(SecurityPinBase.class); - Assertions.assertEquals("yajguqfhwygzlv", model.resourceGuardOperationRequests().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SettingsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SettingsTests.java deleted file mode 100644 index 9f869af96a002..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SettingsTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.Settings; -import org.junit.jupiter.api.Assertions; - -public final class SettingsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Settings model - = BinaryData.fromString("{\"timeZone\":\"ljyxgtczhe\",\"issqlcompression\":true,\"isCompression\":true}") - .toObject(Settings.class); - Assertions.assertEquals("ljyxgtczhe", model.timeZone()); - Assertions.assertEquals(true, model.issqlcompression()); - Assertions.assertEquals(true, model.isCompression()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Settings model = new Settings().withTimeZone("ljyxgtczhe").withIssqlcompression(true).withIsCompression(true); - model = BinaryData.fromObject(model).toObject(Settings.class); - Assertions.assertEquals("ljyxgtczhe", model.timeZone()); - Assertions.assertEquals(true, model.issqlcompression()); - Assertions.assertEquals(true, model.isCompression()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleRetentionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleRetentionPolicyTests.java deleted file mode 100644 index 3c993990a9167..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleRetentionPolicyTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SimpleRetentionPolicy; -import org.junit.jupiter.api.Assertions; - -public final class SimpleRetentionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SimpleRetentionPolicy model = BinaryData.fromString( - "{\"retentionPolicyType\":\"SimpleRetentionPolicy\",\"retentionDuration\":{\"count\":592038420,\"durationType\":\"Months\"}}") - .toObject(SimpleRetentionPolicy.class); - Assertions.assertEquals(592038420, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.MONTHS, model.retentionDuration().durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SimpleRetentionPolicy model = new SimpleRetentionPolicy().withRetentionDuration( - new RetentionDuration().withCount(592038420).withDurationType(RetentionDurationType.MONTHS)); - model = BinaryData.fromObject(model).toObject(SimpleRetentionPolicy.class); - Assertions.assertEquals(592038420, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.MONTHS, model.retentionDuration().durationType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleSchedulePolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleSchedulePolicyTests.java deleted file mode 100644 index 4eeb491d0cabb..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleSchedulePolicyTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.HourlySchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.ScheduleRunType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SimpleSchedulePolicy; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SimpleSchedulePolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SimpleSchedulePolicy model = BinaryData.fromString( - "{\"schedulePolicyType\":\"SimpleSchedulePolicy\",\"scheduleRunFrequency\":\"Invalid\",\"scheduleRunDays\":[\"Friday\",\"Thursday\",\"Wednesday\",\"Wednesday\"],\"scheduleRunTimes\":[\"2021-09-06T01:44:02Z\"],\"hourlySchedule\":{\"interval\":1687110835,\"scheduleWindowStartTime\":\"2021-03-22T14:29:01Z\",\"scheduleWindowDuration\":982777727},\"scheduleWeeklyFrequency\":1314772316}") - .toObject(SimpleSchedulePolicy.class); - Assertions.assertEquals(ScheduleRunType.INVALID, model.scheduleRunFrequency()); - Assertions.assertEquals(DayOfWeek.FRIDAY, model.scheduleRunDays().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-06T01:44:02Z"), model.scheduleRunTimes().get(0)); - Assertions.assertEquals(1687110835, model.hourlySchedule().interval()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-22T14:29:01Z"), - model.hourlySchedule().scheduleWindowStartTime()); - Assertions.assertEquals(982777727, model.hourlySchedule().scheduleWindowDuration()); - Assertions.assertEquals(1314772316, model.scheduleWeeklyFrequency()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SimpleSchedulePolicy model = new SimpleSchedulePolicy().withScheduleRunFrequency(ScheduleRunType.INVALID) - .withScheduleRunDays( - Arrays.asList(DayOfWeek.FRIDAY, DayOfWeek.THURSDAY, DayOfWeek.WEDNESDAY, DayOfWeek.WEDNESDAY)) - .withScheduleRunTimes(Arrays.asList(OffsetDateTime.parse("2021-09-06T01:44:02Z"))) - .withHourlySchedule(new HourlySchedule().withInterval(1687110835) - .withScheduleWindowStartTime(OffsetDateTime.parse("2021-03-22T14:29:01Z")) - .withScheduleWindowDuration(982777727)) - .withScheduleWeeklyFrequency(1314772316); - model = BinaryData.fromObject(model).toObject(SimpleSchedulePolicy.class); - Assertions.assertEquals(ScheduleRunType.INVALID, model.scheduleRunFrequency()); - Assertions.assertEquals(DayOfWeek.FRIDAY, model.scheduleRunDays().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-06T01:44:02Z"), model.scheduleRunTimes().get(0)); - Assertions.assertEquals(1687110835, model.hourlySchedule().interval()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-22T14:29:01Z"), - model.hourlySchedule().scheduleWindowStartTime()); - Assertions.assertEquals(982777727, model.hourlySchedule().scheduleWindowDuration()); - Assertions.assertEquals(1314772316, model.scheduleWeeklyFrequency()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleSchedulePolicyV2Tests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleSchedulePolicyV2Tests.java deleted file mode 100644 index 7950ccd5c6c60..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SimpleSchedulePolicyV2Tests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailySchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.HourlySchedule; -import com.azure.resourcemanager.recoveryservicesbackup.models.ScheduleRunType; -import com.azure.resourcemanager.recoveryservicesbackup.models.SimpleSchedulePolicyV2; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklySchedule; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SimpleSchedulePolicyV2Tests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SimpleSchedulePolicyV2 model = BinaryData.fromString( - "{\"schedulePolicyType\":\"SimpleSchedulePolicyV2\",\"scheduleRunFrequency\":\"Hourly\",\"hourlySchedule\":{\"interval\":118504398,\"scheduleWindowStartTime\":\"2021-05-26T00:13:29Z\",\"scheduleWindowDuration\":1699127103},\"dailySchedule\":{\"scheduleRunTimes\":[\"2021-09-29T23:38:37Z\"]},\"weeklySchedule\":{\"scheduleRunDays\":[\"Thursday\",\"Tuesday\",\"Friday\"],\"scheduleRunTimes\":[\"2021-03-08T07:10:50Z\",\"2021-08-20T17:36:59Z\"]}}") - .toObject(SimpleSchedulePolicyV2.class); - Assertions.assertEquals(ScheduleRunType.HOURLY, model.scheduleRunFrequency()); - Assertions.assertEquals(118504398, model.hourlySchedule().interval()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-26T00:13:29Z"), - model.hourlySchedule().scheduleWindowStartTime()); - Assertions.assertEquals(1699127103, model.hourlySchedule().scheduleWindowDuration()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-29T23:38:37Z"), - model.dailySchedule().scheduleRunTimes().get(0)); - Assertions.assertEquals(DayOfWeek.THURSDAY, model.weeklySchedule().scheduleRunDays().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-08T07:10:50Z"), - model.weeklySchedule().scheduleRunTimes().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SimpleSchedulePolicyV2 model = new SimpleSchedulePolicyV2().withScheduleRunFrequency(ScheduleRunType.HOURLY) - .withHourlySchedule(new HourlySchedule().withInterval(118504398) - .withScheduleWindowStartTime(OffsetDateTime.parse("2021-05-26T00:13:29Z")) - .withScheduleWindowDuration(1699127103)) - .withDailySchedule( - new DailySchedule().withScheduleRunTimes(Arrays.asList(OffsetDateTime.parse("2021-09-29T23:38:37Z")))) - .withWeeklySchedule(new WeeklySchedule() - .withScheduleRunDays(Arrays.asList(DayOfWeek.THURSDAY, DayOfWeek.TUESDAY, DayOfWeek.FRIDAY)) - .withScheduleRunTimes(Arrays.asList(OffsetDateTime.parse("2021-03-08T07:10:50Z"), - OffsetDateTime.parse("2021-08-20T17:36:59Z")))); - model = BinaryData.fromObject(model).toObject(SimpleSchedulePolicyV2.class); - Assertions.assertEquals(ScheduleRunType.HOURLY, model.scheduleRunFrequency()); - Assertions.assertEquals(118504398, model.hourlySchedule().interval()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-26T00:13:29Z"), - model.hourlySchedule().scheduleWindowStartTime()); - Assertions.assertEquals(1699127103, model.hourlySchedule().scheduleWindowDuration()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-29T23:38:37Z"), - model.dailySchedule().scheduleRunTimes().get(0)); - Assertions.assertEquals(DayOfWeek.THURSDAY, model.weeklySchedule().scheduleRunDays().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-08T07:10:50Z"), - model.weeklySchedule().scheduleRunTimes().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SnapshotBackupAdditionalDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SnapshotBackupAdditionalDetailsTests.java deleted file mode 100644 index 22571b1045966..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SnapshotBackupAdditionalDetailsTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotBackupAdditionalDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import org.junit.jupiter.api.Assertions; - -public final class SnapshotBackupAdditionalDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SnapshotBackupAdditionalDetails model = BinaryData.fromString( - "{\"instantRpRetentionRangeInDays\":751350709,\"instantRPDetails\":\"kdl\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"fbumlkx\",\"identityName\":\"qjfsmlmbtxhw\",\"userAssignedIdentityProperties\":{\"clientId\":\"srtawcoezbr\",\"principalId\":\"bskhudygoookkqfq\"}}}") - .toObject(SnapshotBackupAdditionalDetails.class); - Assertions.assertEquals(751350709, model.instantRpRetentionRangeInDays()); - Assertions.assertEquals("kdl", model.instantRPDetails()); - Assertions.assertEquals("fbumlkx", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("qjfsmlmbtxhw", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("srtawcoezbr", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("bskhudygoookkqfq", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SnapshotBackupAdditionalDetails model - = new SnapshotBackupAdditionalDetails().withInstantRpRetentionRangeInDays(751350709) - .withInstantRPDetails("kdl") - .withUserAssignedManagedIdentityDetails(new UserAssignedManagedIdentityDetails() - .withIdentityArmId("fbumlkx") - .withIdentityName("qjfsmlmbtxhw") - .withUserAssignedIdentityProperties(new UserAssignedIdentityProperties().withClientId("srtawcoezbr") - .withPrincipalId("bskhudygoookkqfq"))); - model = BinaryData.fromObject(model).toObject(SnapshotBackupAdditionalDetails.class); - Assertions.assertEquals(751350709, model.instantRpRetentionRangeInDays()); - Assertions.assertEquals("kdl", model.instantRPDetails()); - Assertions.assertEquals("fbumlkx", model.userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("qjfsmlmbtxhw", model.userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("srtawcoezbr", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("bskhudygoookkqfq", - model.userAssignedManagedIdentityDetails().userAssignedIdentityProperties().principalId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SnapshotRestoreParametersTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SnapshotRestoreParametersTests.java deleted file mode 100644 index 1a0301e3e6f67..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SnapshotRestoreParametersTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotRestoreParameters; -import org.junit.jupiter.api.Assertions; - -public final class SnapshotRestoreParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SnapshotRestoreParameters model - = BinaryData.fromString("{\"skipAttachAndMount\":false,\"logPointInTimeForDBRecovery\":\"ljlageuaulxu\"}") - .toObject(SnapshotRestoreParameters.class); - Assertions.assertEquals(false, model.skipAttachAndMount()); - Assertions.assertEquals("ljlageuaulxu", model.logPointInTimeForDBRecovery()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SnapshotRestoreParameters model = new SnapshotRestoreParameters().withSkipAttachAndMount(false) - .withLogPointInTimeForDBRecovery("ljlageuaulxu"); - model = BinaryData.fromObject(model).toObject(SnapshotRestoreParameters.class); - Assertions.assertEquals(false, model.skipAttachAndMount()); - Assertions.assertEquals("ljlageuaulxu", model.logPointInTimeForDBRecovery()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SqlDataDirectoryMappingTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SqlDataDirectoryMappingTests.java deleted file mode 100644 index edc2c0ef13f3e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SqlDataDirectoryMappingTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryMapping; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import org.junit.jupiter.api.Assertions; - -public final class SqlDataDirectoryMappingTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlDataDirectoryMapping model = BinaryData.fromString( - "{\"mappingType\":\"Log\",\"sourceLogicalName\":\"mik\",\"sourcePath\":\"tbzbkiwbuqnyophz\",\"targetPath\":\"l\"}") - .toObject(SqlDataDirectoryMapping.class); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.mappingType()); - Assertions.assertEquals("mik", model.sourceLogicalName()); - Assertions.assertEquals("tbzbkiwbuqnyophz", model.sourcePath()); - Assertions.assertEquals("l", model.targetPath()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlDataDirectoryMapping model = new SqlDataDirectoryMapping().withMappingType(SqlDataDirectoryType.LOG) - .withSourceLogicalName("mik") - .withSourcePath("tbzbkiwbuqnyophz") - .withTargetPath("l"); - model = BinaryData.fromObject(model).toObject(SqlDataDirectoryMapping.class); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.mappingType()); - Assertions.assertEquals("mik", model.sourceLogicalName()); - Assertions.assertEquals("tbzbkiwbuqnyophz", model.sourcePath()); - Assertions.assertEquals("l", model.targetPath()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SqlDataDirectoryTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SqlDataDirectoryTests.java deleted file mode 100644 index cf12f57a23a7b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SqlDataDirectoryTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectory; -import com.azure.resourcemanager.recoveryservicesbackup.models.SqlDataDirectoryType; -import org.junit.jupiter.api.Assertions; - -public final class SqlDataDirectoryTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlDataDirectory model - = BinaryData.fromString("{\"type\":\"Log\",\"path\":\"awopqh\",\"logicalName\":\"jptmcgsbost\"}") - .toObject(SqlDataDirectory.class); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.type()); - Assertions.assertEquals("awopqh", model.path()); - Assertions.assertEquals("jptmcgsbost", model.logicalName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlDataDirectory model = new SqlDataDirectory().withType(SqlDataDirectoryType.LOG) - .withPath("awopqh") - .withLogicalName("jptmcgsbost"); - model = BinaryData.fromObject(model).toObject(SqlDataDirectory.class); - Assertions.assertEquals(SqlDataDirectoryType.LOG, model.type()); - Assertions.assertEquals("awopqh", model.path()); - Assertions.assertEquals("jptmcgsbost", model.logicalName()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SubProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SubProtectionPolicyTests.java deleted file mode 100644 index 3793cdb6856a6..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/SubProtectionPolicyTests.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.PolicyType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.SnapshotBackupAdditionalDetails; -import com.azure.resourcemanager.recoveryservicesbackup.models.SubProtectionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SubProtectionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubProtectionPolicy model = BinaryData.fromString( - "{\"policyType\":\"Incremental\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"tieringPolicy\":{\"xu\":{\"tieringMode\":\"TierAfter\",\"duration\":250012247,\"durationType\":\"Months\"},\"htba\":{\"tieringMode\":\"TierAfter\",\"duration\":1576541562,\"durationType\":\"Invalid\"},\"ckpyklyhplu\":{\"tieringMode\":\"Invalid\",\"duration\":1532025762,\"durationType\":\"Invalid\"}},\"snapshotBackupAdditionalDetails\":{\"instantRpRetentionRangeInDays\":1007815098,\"instantRPDetails\":\"uudl\",\"userAssignedManagedIdentityDetails\":{\"identityArmId\":\"bth\",\"identityName\":\"tgk\",\"userAssignedIdentityProperties\":{\"clientId\":\"vdxec\",\"principalId\":\"edqbc\"}}}}") - .toObject(SubProtectionPolicy.class); - Assertions.assertEquals(PolicyType.INCREMENTAL, model.policyType()); - Assertions.assertEquals(TieringMode.TIER_AFTER, model.tieringPolicy().get("xu").tieringMode()); - Assertions.assertEquals(250012247, model.tieringPolicy().get("xu").duration()); - Assertions.assertEquals(RetentionDurationType.MONTHS, model.tieringPolicy().get("xu").durationType()); - Assertions.assertEquals(1007815098, model.snapshotBackupAdditionalDetails().instantRpRetentionRangeInDays()); - Assertions.assertEquals("uudl", model.snapshotBackupAdditionalDetails().instantRPDetails()); - Assertions.assertEquals("bth", - model.snapshotBackupAdditionalDetails().userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("tgk", - model.snapshotBackupAdditionalDetails().userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("vdxec", - model.snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .clientId()); - Assertions.assertEquals("edqbc", - model.snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .principalId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubProtectionPolicy model - = new SubProtectionPolicy().withPolicyType(PolicyType.INCREMENTAL) - .withSchedulePolicy(new SchedulePolicy()) - .withRetentionPolicy(new RetentionPolicy()) - .withTieringPolicy(mapOf("xu", - new TieringPolicy().withTieringMode(TieringMode.TIER_AFTER) - .withDuration(250012247) - .withDurationType(RetentionDurationType.MONTHS), - "htba", - new TieringPolicy().withTieringMode(TieringMode.TIER_AFTER) - .withDuration(1576541562) - .withDurationType(RetentionDurationType.INVALID), - "ckpyklyhplu", - new TieringPolicy().withTieringMode(TieringMode.INVALID) - .withDuration(1532025762) - .withDurationType(RetentionDurationType.INVALID))) - .withSnapshotBackupAdditionalDetails( - new SnapshotBackupAdditionalDetails().withInstantRpRetentionRangeInDays(1007815098) - .withInstantRPDetails("uudl") - .withUserAssignedManagedIdentityDetails(new UserAssignedManagedIdentityDetails() - .withIdentityArmId("bth") - .withIdentityName("tgk") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("vdxec").withPrincipalId("edqbc")))); - model = BinaryData.fromObject(model).toObject(SubProtectionPolicy.class); - Assertions.assertEquals(PolicyType.INCREMENTAL, model.policyType()); - Assertions.assertEquals(TieringMode.TIER_AFTER, model.tieringPolicy().get("xu").tieringMode()); - Assertions.assertEquals(250012247, model.tieringPolicy().get("xu").duration()); - Assertions.assertEquals(RetentionDurationType.MONTHS, model.tieringPolicy().get("xu").durationType()); - Assertions.assertEquals(1007815098, model.snapshotBackupAdditionalDetails().instantRpRetentionRangeInDays()); - Assertions.assertEquals("uudl", model.snapshotBackupAdditionalDetails().instantRPDetails()); - Assertions.assertEquals("bth", - model.snapshotBackupAdditionalDetails().userAssignedManagedIdentityDetails().identityArmId()); - Assertions.assertEquals("tgk", - model.snapshotBackupAdditionalDetails().userAssignedManagedIdentityDetails().identityName()); - Assertions.assertEquals("vdxec", - model.snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .clientId()); - Assertions.assertEquals("edqbc", - model.snapshotBackupAdditionalDetails() - .userAssignedManagedIdentityDetails() - .userAssignedIdentityProperties() - .principalId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetAfsRestoreInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetAfsRestoreInfoTests.java deleted file mode 100644 index 005613e60ed05..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetAfsRestoreInfoTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetAfsRestoreInfo; -import org.junit.jupiter.api.Assertions; - -public final class TargetAfsRestoreInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetAfsRestoreInfo model - = BinaryData.fromString("{\"name\":\"bibgjmfxumv\",\"targetResourceId\":\"luyovwxnbkfezzx\"}") - .toObject(TargetAfsRestoreInfo.class); - Assertions.assertEquals("bibgjmfxumv", model.name()); - Assertions.assertEquals("luyovwxnbkfezzx", model.targetResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetAfsRestoreInfo model - = new TargetAfsRestoreInfo().withName("bibgjmfxumv").withTargetResourceId("luyovwxnbkfezzx"); - model = BinaryData.fromObject(model).toObject(TargetAfsRestoreInfo.class); - Assertions.assertEquals("bibgjmfxumv", model.name()); - Assertions.assertEquals("luyovwxnbkfezzx", model.targetResourceId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetDiskNetworkAccessSettingsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetDiskNetworkAccessSettingsTests.java deleted file mode 100644 index 4a331001c122d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetDiskNetworkAccessSettingsTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessOption; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetworkAccessSettings; -import org.junit.jupiter.api.Assertions; - -public final class TargetDiskNetworkAccessSettingsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetDiskNetworkAccessSettings model = BinaryData.fromString( - "{\"targetDiskNetworkAccessOption\":\"EnablePublicAccessForAllDisks\",\"targetDiskAccessId\":\"jagmdi\"}") - .toObject(TargetDiskNetworkAccessSettings.class); - Assertions.assertEquals(TargetDiskNetworkAccessOption.ENABLE_PUBLIC_ACCESS_FOR_ALL_DISKS, - model.targetDiskNetworkAccessOption()); - Assertions.assertEquals("jagmdi", model.targetDiskAccessId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetDiskNetworkAccessSettings model = new TargetDiskNetworkAccessSettings() - .withTargetDiskNetworkAccessOption(TargetDiskNetworkAccessOption.ENABLE_PUBLIC_ACCESS_FOR_ALL_DISKS) - .withTargetDiskAccessId("jagmdi"); - model = BinaryData.fromObject(model).toObject(TargetDiskNetworkAccessSettings.class); - Assertions.assertEquals(TargetDiskNetworkAccessOption.ENABLE_PUBLIC_ACCESS_FOR_ALL_DISKS, - model.targetDiskNetworkAccessOption()); - Assertions.assertEquals("jagmdi", model.targetDiskAccessId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetRestoreInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetRestoreInfoTests.java deleted file mode 100644 index 2faff6f8b926b..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TargetRestoreInfoTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.OverwriteOptions; -import com.azure.resourcemanager.recoveryservicesbackup.models.TargetRestoreInfo; -import org.junit.jupiter.api.Assertions; - -public final class TargetRestoreInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetRestoreInfo model = BinaryData.fromString( - "{\"overwriteOption\":\"Overwrite\",\"containerId\":\"kzyb\",\"databaseName\":\"jid\",\"targetDirectoryForFileRestore\":\"syxkyxvxevblb\"}") - .toObject(TargetRestoreInfo.class); - Assertions.assertEquals(OverwriteOptions.OVERWRITE, model.overwriteOption()); - Assertions.assertEquals("kzyb", model.containerId()); - Assertions.assertEquals("jid", model.databaseName()); - Assertions.assertEquals("syxkyxvxevblb", model.targetDirectoryForFileRestore()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetRestoreInfo model = new TargetRestoreInfo().withOverwriteOption(OverwriteOptions.OVERWRITE) - .withContainerId("kzyb") - .withDatabaseName("jid") - .withTargetDirectoryForFileRestore("syxkyxvxevblb"); - model = BinaryData.fromObject(model).toObject(TargetRestoreInfo.class); - Assertions.assertEquals(OverwriteOptions.OVERWRITE, model.overwriteOption()); - Assertions.assertEquals("kzyb", model.containerId()); - Assertions.assertEquals("jid", model.databaseName()); - Assertions.assertEquals("syxkyxvxevblb", model.targetDirectoryForFileRestore()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostInfoInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostInfoInnerTests.java deleted file mode 100644 index 9d1ad2801a15a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostInfoInnerTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.TieringCostInfoInner; - -public final class TieringCostInfoInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TieringCostInfoInner model - = BinaryData.fromString("{\"objectType\":\"TieringCostInfo\"}").toObject(TieringCostInfoInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TieringCostInfoInner model = new TieringCostInfoInner(); - model = BinaryData.fromObject(model).toObject(TieringCostInfoInner.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostRehydrationInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostRehydrationInfoTests.java deleted file mode 100644 index 21962754fc364..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostRehydrationInfoTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostRehydrationInfo; -import org.junit.jupiter.api.Assertions; - -public final class TieringCostRehydrationInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TieringCostRehydrationInfo model = BinaryData.fromString( - "{\"objectType\":\"TieringCostRehydrationInfo\",\"rehydrationSizeInBytes\":1068598055053483626,\"retailRehydrationCostPerGBPerMonth\":63.147314650239416}") - .toObject(TieringCostRehydrationInfo.class); - Assertions.assertEquals(1068598055053483626L, model.rehydrationSizeInBytes()); - Assertions.assertEquals(63.147314650239416, model.retailRehydrationCostPerGBPerMonth()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TieringCostRehydrationInfo model - = new TieringCostRehydrationInfo().withRehydrationSizeInBytes(1068598055053483626L) - .withRetailRehydrationCostPerGBPerMonth(63.147314650239416); - model = BinaryData.fromObject(model).toObject(TieringCostRehydrationInfo.class); - Assertions.assertEquals(1068598055053483626L, model.rehydrationSizeInBytes()); - Assertions.assertEquals(63.147314650239416, model.retailRehydrationCostPerGBPerMonth()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostSavingInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostSavingInfoTests.java deleted file mode 100644 index 2300793fb3731..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringCostSavingInfoTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringCostSavingInfo; -import org.junit.jupiter.api.Assertions; - -public final class TieringCostSavingInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TieringCostSavingInfo model = BinaryData.fromString( - "{\"objectType\":\"TieringCostSavingInfo\",\"sourceTierSizeReductionInBytes\":9183916699849922244,\"targetTierSizeIncreaseInBytes\":2529635671942446169,\"retailSourceTierCostPerGBPerMonth\":0.6256204485399541,\"retailTargetTierCostPerGBPerMonth\":22.763356722216656}") - .toObject(TieringCostSavingInfo.class); - Assertions.assertEquals(9183916699849922244L, model.sourceTierSizeReductionInBytes()); - Assertions.assertEquals(2529635671942446169L, model.targetTierSizeIncreaseInBytes()); - Assertions.assertEquals(0.6256204485399541, model.retailSourceTierCostPerGBPerMonth()); - Assertions.assertEquals(22.763356722216656, model.retailTargetTierCostPerGBPerMonth()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TieringCostSavingInfo model - = new TieringCostSavingInfo().withSourceTierSizeReductionInBytes(9183916699849922244L) - .withTargetTierSizeIncreaseInBytes(2529635671942446169L) - .withRetailSourceTierCostPerGBPerMonth(0.6256204485399541) - .withRetailTargetTierCostPerGBPerMonth(22.763356722216656); - model = BinaryData.fromObject(model).toObject(TieringCostSavingInfo.class); - Assertions.assertEquals(9183916699849922244L, model.sourceTierSizeReductionInBytes()); - Assertions.assertEquals(2529635671942446169L, model.targetTierSizeIncreaseInBytes()); - Assertions.assertEquals(0.6256204485399541, model.retailSourceTierCostPerGBPerMonth()); - Assertions.assertEquals(22.763356722216656, model.retailTargetTierCostPerGBPerMonth()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringPolicyTests.java deleted file mode 100644 index 9b835137f7c17..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TieringPolicyTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringMode; -import com.azure.resourcemanager.recoveryservicesbackup.models.TieringPolicy; -import org.junit.jupiter.api.Assertions; - -public final class TieringPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TieringPolicy model - = BinaryData.fromString("{\"tieringMode\":\"Invalid\",\"duration\":55110922,\"durationType\":\"Invalid\"}") - .toObject(TieringPolicy.class); - Assertions.assertEquals(TieringMode.INVALID, model.tieringMode()); - Assertions.assertEquals(55110922, model.duration()); - Assertions.assertEquals(RetentionDurationType.INVALID, model.durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TieringPolicy model = new TieringPolicy().withTieringMode(TieringMode.INVALID) - .withDuration(55110922) - .withDurationType(RetentionDurationType.INVALID); - model = BinaryData.fromObject(model).toObject(TieringPolicy.class); - Assertions.assertEquals(TieringMode.INVALID, model.tieringMode()); - Assertions.assertEquals(55110922, model.duration()); - Assertions.assertEquals(RetentionDurationType.INVALID, model.durationType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TriggerDataMoveRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TriggerDataMoveRequestTests.java deleted file mode 100644 index 5906b717d6ad0..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/TriggerDataMoveRequestTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DataMoveLevel; -import com.azure.resourcemanager.recoveryservicesbackup.models.TriggerDataMoveRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class TriggerDataMoveRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TriggerDataMoveRequest model = BinaryData.fromString( - "{\"sourceResourceId\":\"amdecte\",\"sourceRegion\":\"f\",\"dataMoveLevel\":\"Container\",\"correlationId\":\"scjeypv\",\"sourceContainerArmIds\":[\"rkgqhcjrefo\",\"gm\",\"qsl\",\"yyvxyqjpkcattpn\"],\"pauseGC\":false}") - .toObject(TriggerDataMoveRequest.class); - Assertions.assertEquals("amdecte", model.sourceResourceId()); - Assertions.assertEquals("f", model.sourceRegion()); - Assertions.assertEquals(DataMoveLevel.CONTAINER, model.dataMoveLevel()); - Assertions.assertEquals("scjeypv", model.correlationId()); - Assertions.assertEquals("rkgqhcjrefo", model.sourceContainerArmIds().get(0)); - Assertions.assertEquals(false, model.pauseGC()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TriggerDataMoveRequest model = new TriggerDataMoveRequest().withSourceResourceId("amdecte") - .withSourceRegion("f") - .withDataMoveLevel(DataMoveLevel.CONTAINER) - .withCorrelationId("scjeypv") - .withSourceContainerArmIds(Arrays.asList("rkgqhcjrefo", "gm", "qsl", "yyvxyqjpkcattpn")) - .withPauseGC(false); - model = BinaryData.fromObject(model).toObject(TriggerDataMoveRequest.class); - Assertions.assertEquals("amdecte", model.sourceResourceId()); - Assertions.assertEquals("f", model.sourceRegion()); - Assertions.assertEquals(DataMoveLevel.CONTAINER, model.dataMoveLevel()); - Assertions.assertEquals("scjeypv", model.correlationId()); - Assertions.assertEquals("rkgqhcjrefo", model.sourceContainerArmIds().get(0)); - Assertions.assertEquals(false, model.pauseGC()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UnlockDeleteRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UnlockDeleteRequestTests.java deleted file mode 100644 index ce51430fa3ca8..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UnlockDeleteRequestTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.UnlockDeleteRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class UnlockDeleteRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UnlockDeleteRequest model = BinaryData.fromString( - "{\"resourceGuardOperationRequests\":[\"qqmtedltmmji\",\"yeozphvwauyqncy\"],\"resourceToBeDeleted\":\"p\"}") - .toObject(UnlockDeleteRequest.class); - Assertions.assertEquals("qqmtedltmmji", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("p", model.resourceToBeDeleted()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UnlockDeleteRequest model = new UnlockDeleteRequest() - .withResourceGuardOperationRequests(Arrays.asList("qqmtedltmmji", "yeozphvwauyqncy")) - .withResourceToBeDeleted("p"); - model = BinaryData.fromObject(model).toObject(UnlockDeleteRequest.class); - Assertions.assertEquals("qqmtedltmmji", model.resourceGuardOperationRequests().get(0)); - Assertions.assertEquals("p", model.resourceToBeDeleted()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UnlockDeleteResponseInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UnlockDeleteResponseInnerTests.java deleted file mode 100644 index 0dfef95e4edd0..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UnlockDeleteResponseInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.UnlockDeleteResponseInner; -import org.junit.jupiter.api.Assertions; - -public final class UnlockDeleteResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UnlockDeleteResponseInner model = BinaryData.fromString("{\"unlockDeleteExpiryTime\":\"ipmdscwx\"}") - .toObject(UnlockDeleteResponseInner.class); - Assertions.assertEquals("ipmdscwx", model.unlockDeleteExpiryTime()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UnlockDeleteResponseInner model = new UnlockDeleteResponseInner().withUnlockDeleteExpiryTime("ipmdscwx"); - model = BinaryData.fromObject(model).toObject(UnlockDeleteResponseInner.class); - Assertions.assertEquals("ipmdscwx", model.unlockDeleteExpiryTime()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UserAssignedIdentityPropertiesTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UserAssignedIdentityPropertiesTests.java deleted file mode 100644 index 860be1edb2fe9..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UserAssignedIdentityPropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import org.junit.jupiter.api.Assertions; - -public final class UserAssignedIdentityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserAssignedIdentityProperties model - = BinaryData.fromString("{\"clientId\":\"kq\",\"principalId\":\"qgzsles\"}") - .toObject(UserAssignedIdentityProperties.class); - Assertions.assertEquals("kq", model.clientId()); - Assertions.assertEquals("qgzsles", model.principalId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserAssignedIdentityProperties model - = new UserAssignedIdentityProperties().withClientId("kq").withPrincipalId("qgzsles"); - model = BinaryData.fromObject(model).toObject(UserAssignedIdentityProperties.class); - Assertions.assertEquals("kq", model.clientId()); - Assertions.assertEquals("qgzsles", model.principalId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UserAssignedManagedIdentityDetailsTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UserAssignedManagedIdentityDetailsTests.java deleted file mode 100644 index 1bf4580cfb6a4..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/UserAssignedManagedIdentityDetailsTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedIdentityProperties; -import com.azure.resourcemanager.recoveryservicesbackup.models.UserAssignedManagedIdentityDetails; -import org.junit.jupiter.api.Assertions; - -public final class UserAssignedManagedIdentityDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserAssignedManagedIdentityDetails model = BinaryData.fromString( - "{\"identityArmId\":\"vleo\",\"identityName\":\"ml\",\"userAssignedIdentityProperties\":{\"clientId\":\"tqzfavyv\",\"principalId\":\"qybaryeua\"}}") - .toObject(UserAssignedManagedIdentityDetails.class); - Assertions.assertEquals("vleo", model.identityArmId()); - Assertions.assertEquals("ml", model.identityName()); - Assertions.assertEquals("tqzfavyv", model.userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("qybaryeua", model.userAssignedIdentityProperties().principalId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserAssignedManagedIdentityDetails model = new UserAssignedManagedIdentityDetails().withIdentityArmId("vleo") - .withIdentityName("ml") - .withUserAssignedIdentityProperties( - new UserAssignedIdentityProperties().withClientId("tqzfavyv").withPrincipalId("qybaryeua")); - model = BinaryData.fromObject(model).toObject(UserAssignedManagedIdentityDetails.class); - Assertions.assertEquals("vleo", model.identityArmId()); - Assertions.assertEquals("ml", model.identityName()); - Assertions.assertEquals("tqzfavyv", model.userAssignedIdentityProperties().clientId()); - Assertions.assertEquals("qybaryeua", model.userAssignedIdentityProperties().principalId()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateIaasVMRestoreOperationRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateIaasVMRestoreOperationRequestTests.java deleted file mode 100644 index 896430b9adf89..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateIaasVMRestoreOperationRequestTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateIaasVMRestoreOperationRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ValidateIaasVMRestoreOperationRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ValidateIaasVMRestoreOperationRequest model = BinaryData.fromString( - "{\"objectType\":\"ValidateIaasVMRestoreOperationRequest\",\"restoreRequest\":{\"objectType\":\"RestoreRequest\",\"resourceGuardOperationRequests\":[\"memhooclutnpq\"]}}") - .toObject(ValidateIaasVMRestoreOperationRequest.class); - Assertions.assertEquals("memhooclutnpq", model.restoreRequest().resourceGuardOperationRequests().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ValidateIaasVMRestoreOperationRequest model = new ValidateIaasVMRestoreOperationRequest().withRestoreRequest( - new RestoreRequest().withResourceGuardOperationRequests(Arrays.asList("memhooclutnpq"))); - model = BinaryData.fromObject(model).toObject(ValidateIaasVMRestoreOperationRequest.class); - Assertions.assertEquals("memhooclutnpq", model.restoreRequest().resourceGuardOperationRequests().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationRequestResourceTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationRequestResourceTests.java deleted file mode 100644 index d26d6250da034..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationRequestResourceTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationRequestResource; -import org.junit.jupiter.api.Assertions; - -public final class ValidateOperationRequestResourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ValidateOperationRequestResource model = BinaryData - .fromString("{\"id\":\"uvwbhsqfs\",\"properties\":{\"objectType\":\"ValidateOperationRequest\"}}") - .toObject(ValidateOperationRequestResource.class); - Assertions.assertEquals("uvwbhsqfs", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ValidateOperationRequestResource model - = new ValidateOperationRequestResource().withId("uvwbhsqfs").withProperties(new ValidateOperationRequest()); - model = BinaryData.fromObject(model).toObject(ValidateOperationRequestResource.class); - Assertions.assertEquals("uvwbhsqfs", model.id()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationRequestTests.java deleted file mode 100644 index 9e3f165e3823a..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateOperationRequestTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateOperationRequest; - -public final class ValidateOperationRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ValidateOperationRequest model = BinaryData.fromString("{\"objectType\":\"ValidateOperationRequest\"}") - .toObject(ValidateOperationRequest.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ValidateOperationRequest model = new ValidateOperationRequest(); - model = BinaryData.fromObject(model).toObject(ValidateOperationRequest.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateRestoreOperationRequestTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateRestoreOperationRequestTests.java deleted file mode 100644 index f289d96ff2542..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ValidateRestoreOperationRequestTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequest; -import com.azure.resourcemanager.recoveryservicesbackup.models.ValidateRestoreOperationRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ValidateRestoreOperationRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ValidateRestoreOperationRequest model = BinaryData.fromString( - "{\"objectType\":\"ValidateRestoreOperationRequest\",\"restoreRequest\":{\"objectType\":\"RestoreRequest\",\"resourceGuardOperationRequests\":[\"zjkmmykyujxs\"]}}") - .toObject(ValidateRestoreOperationRequest.class); - Assertions.assertEquals("zjkmmykyujxs", model.restoreRequest().resourceGuardOperationRequests().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ValidateRestoreOperationRequest model = new ValidateRestoreOperationRequest() - .withRestoreRequest(new RestoreRequest().withResourceGuardOperationRequests(Arrays.asList("zjkmmykyujxs"))); - model = BinaryData.fromObject(model).toObject(ValidateRestoreOperationRequest.class); - Assertions.assertEquals("zjkmmykyujxs", model.restoreRequest().resourceGuardOperationRequests().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultJobExtendedInfoTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultJobExtendedInfoTests.java deleted file mode 100644 index 64ced30b3330d..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultJobExtendedInfoTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultJobExtendedInfo; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class VaultJobExtendedInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VaultJobExtendedInfo model = BinaryData.fromString( - "{\"propertyBag\":{\"grfihotjewlp\":\"kzudn\",\"hqo\":\"uzzjgnrefq\",\"diw\":\"oihiqak\",\"hcspo\":\"brkwpzdqt\"}}") - .toObject(VaultJobExtendedInfo.class); - Assertions.assertEquals("kzudn", model.propertyBag().get("grfihotjewlp")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VaultJobExtendedInfo model = new VaultJobExtendedInfo().withPropertyBag( - mapOf("grfihotjewlp", "kzudn", "hqo", "uzzjgnrefq", "diw", "oihiqak", "hcspo", "brkwpzdqt")); - model = BinaryData.fromObject(model).toObject(VaultJobExtendedInfo.class); - Assertions.assertEquals("kzudn", model.propertyBag().get("grfihotjewlp")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultRetentionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultRetentionPolicyTests.java deleted file mode 100644 index b2a104b26d78c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultRetentionPolicyTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; -import com.azure.resourcemanager.recoveryservicesbackup.models.VaultRetentionPolicy; -import org.junit.jupiter.api.Assertions; - -public final class VaultRetentionPolicyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VaultRetentionPolicy model = BinaryData.fromString( - "{\"vaultRetention\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"snapshotRetentionInDays\":1041320877}") - .toObject(VaultRetentionPolicy.class); - Assertions.assertEquals(1041320877, model.snapshotRetentionInDays()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VaultRetentionPolicy model = new VaultRetentionPolicy().withVaultRetention(new RetentionPolicy()) - .withSnapshotRetentionInDays(1041320877); - model = BinaryData.fromObject(model).toObject(VaultRetentionPolicy.class); - Assertions.assertEquals(1041320877, model.snapshotRetentionInDays()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultStorageConfigOperationResultResponseInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultStorageConfigOperationResultResponseInnerTests.java deleted file mode 100644 index c881e7f198e8e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/VaultStorageConfigOperationResultResponseInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.VaultStorageConfigOperationResultResponseInner; - -public final class VaultStorageConfigOperationResultResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VaultStorageConfigOperationResultResponseInner model - = BinaryData.fromString("{\"objectType\":\"VaultStorageConfigOperationResultResponse\"}") - .toObject(VaultStorageConfigOperationResultResponseInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VaultStorageConfigOperationResultResponseInner model = new VaultStorageConfigOperationResultResponseInner(); - model = BinaryData.fromObject(model).toObject(VaultStorageConfigOperationResultResponseInner.class); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyRetentionFormatTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyRetentionFormatTests.java deleted file mode 100644 index 41bb8e3401d1c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyRetentionFormatTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class WeeklyRetentionFormatTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WeeklyRetentionFormat model = BinaryData.fromString( - "{\"daysOfTheWeek\":[\"Saturday\",\"Tuesday\",\"Sunday\"],\"weeksOfTheMonth\":[\"Second\",\"Last\",\"Last\",\"Third\"]}") - .toObject(WeeklyRetentionFormat.class); - Assertions.assertEquals(DayOfWeek.SATURDAY, model.daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.SECOND, model.weeksOfTheMonth().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WeeklyRetentionFormat model = new WeeklyRetentionFormat() - .withDaysOfTheWeek(Arrays.asList(DayOfWeek.SATURDAY, DayOfWeek.TUESDAY, DayOfWeek.SUNDAY)) - .withWeeksOfTheMonth( - Arrays.asList(WeekOfMonth.SECOND, WeekOfMonth.LAST, WeekOfMonth.LAST, WeekOfMonth.THIRD)); - model = BinaryData.fromObject(model).toObject(WeeklyRetentionFormat.class); - Assertions.assertEquals(DayOfWeek.SATURDAY, model.daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.SECOND, model.weeksOfTheMonth().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyRetentionScheduleTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyRetentionScheduleTests.java deleted file mode 100644 index d384552e1fc2c..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyRetentionScheduleTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionSchedule; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class WeeklyRetentionScheduleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WeeklyRetentionSchedule model = BinaryData.fromString( - "{\"daysOfTheWeek\":[\"Saturday\",\"Thursday\",\"Friday\",\"Saturday\"],\"retentionTimes\":[\"2021-03-10T14:35:52Z\",\"2021-01-02T08:52:54Z\",\"2021-07-26T06:33:37Z\"],\"retentionDuration\":{\"count\":1813299630,\"durationType\":\"Days\"}}") - .toObject(WeeklyRetentionSchedule.class); - Assertions.assertEquals(DayOfWeek.SATURDAY, model.daysOfTheWeek().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-10T14:35:52Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(1813299630, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.DAYS, model.retentionDuration().durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WeeklyRetentionSchedule model = new WeeklyRetentionSchedule() - .withDaysOfTheWeek( - Arrays.asList(DayOfWeek.SATURDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY)) - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-03-10T14:35:52Z"), - OffsetDateTime.parse("2021-01-02T08:52:54Z"), OffsetDateTime.parse("2021-07-26T06:33:37Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(1813299630).withDurationType(RetentionDurationType.DAYS)); - model = BinaryData.fromObject(model).toObject(WeeklyRetentionSchedule.class); - Assertions.assertEquals(DayOfWeek.SATURDAY, model.daysOfTheWeek().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-10T14:35:52Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(1813299630, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.DAYS, model.retentionDuration().durationType()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyScheduleTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyScheduleTests.java deleted file mode 100644 index 67c5b5a682461..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WeeklyScheduleTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklySchedule; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class WeeklyScheduleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WeeklySchedule model = BinaryData.fromString( - "{\"scheduleRunDays\":[\"Thursday\",\"Sunday\",\"Sunday\"],\"scheduleRunTimes\":[\"2020-12-23T16:49:38Z\"]}") - .toObject(WeeklySchedule.class); - Assertions.assertEquals(DayOfWeek.THURSDAY, model.scheduleRunDays().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T16:49:38Z"), model.scheduleRunTimes().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WeeklySchedule model = new WeeklySchedule() - .withScheduleRunDays(Arrays.asList(DayOfWeek.THURSDAY, DayOfWeek.SUNDAY, DayOfWeek.SUNDAY)) - .withScheduleRunTimes(Arrays.asList(OffsetDateTime.parse("2020-12-23T16:49:38Z"))); - model = BinaryData.fromObject(model).toObject(WeeklySchedule.class); - Assertions.assertEquals(DayOfWeek.THURSDAY, model.scheduleRunDays().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T16:49:38Z"), model.scheduleRunTimes().get(0)); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemResourceInnerTests.java deleted file mode 100644 index 5a34227bc2402..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemResourceInnerTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadItemResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItem; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class WorkloadItemResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WorkloadItemResourceInner model = BinaryData.fromString( - "{\"properties\":{\"workloadItemType\":\"WorkloadItem\",\"backupManagementType\":\"patdooaojkniodko\",\"workloadType\":\"bw\",\"friendlyName\":\"jhemms\",\"protectionState\":\"Protected\"},\"eTag\":\"c\",\"location\":\"odtji\",\"tags\":{\"akggkfpag\":\"jlfltkacjvefkdlf\"},\"id\":\"owpulpq\",\"name\":\"lyls\",\"type\":\"xkqjnsjervt\"}") - .toObject(WorkloadItemResourceInner.class); - Assertions.assertEquals("odtji", model.location()); - Assertions.assertEquals("jlfltkacjvefkdlf", model.tags().get("akggkfpag")); - Assertions.assertEquals("patdooaojkniodko", model.properties().backupManagementType()); - Assertions.assertEquals("bw", model.properties().workloadType()); - Assertions.assertEquals("jhemms", model.properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.properties().protectionState()); - Assertions.assertEquals("c", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WorkloadItemResourceInner model = new WorkloadItemResourceInner().withLocation("odtji") - .withTags(mapOf("akggkfpag", "jlfltkacjvefkdlf")) - .withProperties(new WorkloadItem().withBackupManagementType("patdooaojkniodko") - .withWorkloadType("bw") - .withFriendlyName("jhemms") - .withProtectionState(ProtectionStatus.PROTECTED)) - .withEtag("c"); - model = BinaryData.fromObject(model).toObject(WorkloadItemResourceInner.class); - Assertions.assertEquals("odtji", model.location()); - Assertions.assertEquals("jlfltkacjvefkdlf", model.tags().get("akggkfpag")); - Assertions.assertEquals("patdooaojkniodko", model.properties().backupManagementType()); - Assertions.assertEquals("bw", model.properties().workloadType()); - Assertions.assertEquals("jhemms", model.properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTED, model.properties().protectionState()); - Assertions.assertEquals("c", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemResourceListTests.java deleted file mode 100644 index b83f8bc1c5995..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemResourceListTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadItemResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItemResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class WorkloadItemResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WorkloadItemResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"workloadItemType\":\"WorkloadItem\",\"backupManagementType\":\"qugjhkycube\",\"workloadType\":\"gssofwq\",\"friendlyName\":\"qal\",\"protectionState\":\"ProtectionFailed\"},\"eTag\":\"jijpxac\",\"location\":\"qudf\",\"tags\":{\"yffimrzrtuzqogs\":\"xbaaabjyv\",\"mewzsyyc\":\"xnevfdnwn\",\"judpfrxt\":\"uzsoi\",\"paxh\":\"thzvaytdwkqbrqu\"},\"id\":\"xiilivpdtiirqt\",\"name\":\"qoaxoruzfgs\",\"type\":\"uyfxrxxleptramxj\"}],\"nextLink\":\"wlwnwxuqlcv\"}") - .toObject(WorkloadItemResourceList.class); - Assertions.assertEquals("wlwnwxuqlcv", model.nextLink()); - Assertions.assertEquals("qudf", model.value().get(0).location()); - Assertions.assertEquals("xbaaabjyv", model.value().get(0).tags().get("yffimrzrtuzqogs")); - Assertions.assertEquals("qugjhkycube", model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("gssofwq", model.value().get(0).properties().workloadType()); - Assertions.assertEquals("qal", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, - model.value().get(0).properties().protectionState()); - Assertions.assertEquals("jijpxac", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WorkloadItemResourceList model = new WorkloadItemResourceList().withNextLink("wlwnwxuqlcv") - .withValue(Arrays.asList(new WorkloadItemResourceInner().withLocation("qudf") - .withTags(mapOf("yffimrzrtuzqogs", "xbaaabjyv", "mewzsyyc", "xnevfdnwn", "judpfrxt", "uzsoi", "paxh", - "thzvaytdwkqbrqu")) - .withProperties(new WorkloadItem().withBackupManagementType("qugjhkycube") - .withWorkloadType("gssofwq") - .withFriendlyName("qal") - .withProtectionState(ProtectionStatus.PROTECTION_FAILED)) - .withEtag("jijpxac"))); - model = BinaryData.fromObject(model).toObject(WorkloadItemResourceList.class); - Assertions.assertEquals("wlwnwxuqlcv", model.nextLink()); - Assertions.assertEquals("qudf", model.value().get(0).location()); - Assertions.assertEquals("xbaaabjyv", model.value().get(0).tags().get("yffimrzrtuzqogs")); - Assertions.assertEquals("qugjhkycube", model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("gssofwq", model.value().get(0).properties().workloadType()); - Assertions.assertEquals("qal", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, - model.value().get(0).properties().protectionState()); - Assertions.assertEquals("jijpxac", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemTests.java deleted file mode 100644 index e2a3a385782ce..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadItemTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadItem; -import org.junit.jupiter.api.Assertions; - -public final class WorkloadItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WorkloadItem model = BinaryData.fromString( - "{\"workloadItemType\":\"WorkloadItem\",\"backupManagementType\":\"gxsds\",\"workloadType\":\"e\",\"friendlyName\":\"sbzkf\",\"protectionState\":\"Protecting\"}") - .toObject(WorkloadItem.class); - Assertions.assertEquals("gxsds", model.backupManagementType()); - Assertions.assertEquals("e", model.workloadType()); - Assertions.assertEquals("sbzkf", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WorkloadItem model = new WorkloadItem().withBackupManagementType("gxsds") - .withWorkloadType("e") - .withFriendlyName("sbzkf") - .withProtectionState(ProtectionStatus.PROTECTING); - model = BinaryData.fromObject(model).toObject(WorkloadItem.class); - Assertions.assertEquals("gxsds", model.backupManagementType()); - Assertions.assertEquals("e", model.workloadType()); - Assertions.assertEquals("sbzkf", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTING, model.protectionState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemResourceInnerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemResourceInnerTests.java deleted file mode 100644 index 1fa373ec2bb38..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemResourceInnerTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadProtectableItemResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItem; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class WorkloadProtectableItemResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WorkloadProtectableItemResourceInner model = BinaryData.fromString( - "{\"properties\":{\"protectableItemType\":\"WorkloadProtectableItem\",\"backupManagementType\":\"cxnavv\",\"workloadType\":\"qiby\",\"friendlyName\":\"nyowxwlmdjrkvfg\",\"protectionState\":\"Invalid\"},\"eTag\":\"p\",\"location\":\"bodacizsjq\",\"tags\":{\"ibqipqkg\":\"rribd\",\"mkrefajpjorwkq\":\"vxndz\",\"sjabibs\":\"yhgbijtjivfx\"},\"id\":\"stawfsdjpvkv\",\"name\":\"bjxbkzbzk\",\"type\":\"vncjabudurgk\"}") - .toObject(WorkloadProtectableItemResourceInner.class); - Assertions.assertEquals("bodacizsjq", model.location()); - Assertions.assertEquals("rribd", model.tags().get("ibqipqkg")); - Assertions.assertEquals("cxnavv", model.properties().backupManagementType()); - Assertions.assertEquals("qiby", model.properties().workloadType()); - Assertions.assertEquals("nyowxwlmdjrkvfg", model.properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.INVALID, model.properties().protectionState()); - Assertions.assertEquals("p", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WorkloadProtectableItemResourceInner model - = new WorkloadProtectableItemResourceInner().withLocation("bodacizsjq") - .withTags(mapOf("ibqipqkg", "rribd", "mkrefajpjorwkq", "vxndz", "sjabibs", "yhgbijtjivfx")) - .withProperties(new WorkloadProtectableItem().withBackupManagementType("cxnavv") - .withWorkloadType("qiby") - .withFriendlyName("nyowxwlmdjrkvfg") - .withProtectionState(ProtectionStatus.INVALID)) - .withEtag("p"); - model = BinaryData.fromObject(model).toObject(WorkloadProtectableItemResourceInner.class); - Assertions.assertEquals("bodacizsjq", model.location()); - Assertions.assertEquals("rribd", model.tags().get("ibqipqkg")); - Assertions.assertEquals("cxnavv", model.properties().backupManagementType()); - Assertions.assertEquals("qiby", model.properties().workloadType()); - Assertions.assertEquals("nyowxwlmdjrkvfg", model.properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.INVALID, model.properties().protectionState()); - Assertions.assertEquals("p", model.etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemResourceListTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemResourceListTests.java deleted file mode 100644 index 3efd64a15cd90..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemResourceListTests.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.WorkloadProtectableItemResourceInner; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItem; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItemResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class WorkloadProtectableItemResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WorkloadProtectableItemResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"protectableItemType\":\"WorkloadProtectableItem\",\"backupManagementType\":\"hmk\",\"workloadType\":\"grauwjuetaebur\",\"friendlyName\":\"dmovsm\",\"protectionState\":\"NotProtected\"},\"eTag\":\"ab\",\"location\":\"q\",\"tags\":{\"vtpuqujmqlgk\":\"kif\",\"ongbjcnt\":\"btndo\"},\"id\":\"jitcjedftwwaez\",\"name\":\"ojvdcpzfoqo\",\"type\":\"i\"},{\"properties\":{\"protectableItemType\":\"WorkloadProtectableItem\",\"backupManagementType\":\"xarzgszufoxciq\",\"workloadType\":\"idoamciodhkha\",\"friendlyName\":\"khnzbonlw\",\"protectionState\":\"ProtectionFailed\"},\"eTag\":\"gokdwbwhks\",\"location\":\"zcmrvexztvb\",\"tags\":{\"wtl\":\"sfraoyzko\",\"uximerqfobw\":\"nguxawqaldsy\",\"r\":\"znkbykutwpfhpagm\"},\"id\":\"kdsnfdsdoakgtdl\",\"name\":\"kkze\",\"type\":\"dlhewp\"},{\"properties\":{\"protectableItemType\":\"WorkloadProtectableItem\",\"backupManagementType\":\"sttwvogvbbe\",\"workloadType\":\"cngqqmoakufgmjz\",\"friendlyName\":\"rdgrtw\",\"protectionState\":\"NotProtected\"},\"eTag\":\"uzkopbminrfd\",\"location\":\"oyuhhziui\",\"tags\":{\"smlmzqhoftrm\":\"zbhd\",\"hxicslfaoqz\":\"equi\",\"kaivwit\":\"iyylhalnswhccsp\"},\"id\":\"scywuggwoluhc\",\"name\":\"bwemhairs\",\"type\":\"rgzdwmsweyp\"},{\"properties\":{\"protectableItemType\":\"WorkloadProtectableItem\",\"backupManagementType\":\"xggicccnxqhuexmk\",\"workloadType\":\"lstvlzywe\",\"friendlyName\":\"zrncsdt\",\"protectionState\":\"Protected\"},\"eTag\":\"iypbsfgytgusl\",\"location\":\"eadcygqukyhejhz\",\"tags\":{\"jzraehtwdwrf\":\"gfpelolppvksrpqv\",\"dl\":\"swibyr\",\"hfwpracstwit\":\"h\"},\"id\":\"khevxccedc\",\"name\":\"nmdyodnwzxl\",\"type\":\"jc\"}],\"nextLink\":\"hlt\"}") - .toObject(WorkloadProtectableItemResourceList.class); - Assertions.assertEquals("hlt", model.nextLink()); - Assertions.assertEquals("q", model.value().get(0).location()); - Assertions.assertEquals("kif", model.value().get(0).tags().get("vtpuqujmqlgk")); - Assertions.assertEquals("hmk", model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("grauwjuetaebur", model.value().get(0).properties().workloadType()); - Assertions.assertEquals("dmovsm", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.value().get(0).properties().protectionState()); - Assertions.assertEquals("ab", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WorkloadProtectableItemResourceList model = new WorkloadProtectableItemResourceList().withNextLink("hlt") - .withValue(Arrays.asList( - new WorkloadProtectableItemResourceInner().withLocation("q") - .withTags(mapOf("vtpuqujmqlgk", "kif", "ongbjcnt", "btndo")) - .withProperties(new WorkloadProtectableItem().withBackupManagementType("hmk") - .withWorkloadType("grauwjuetaebur") - .withFriendlyName("dmovsm") - .withProtectionState(ProtectionStatus.NOT_PROTECTED)) - .withEtag("ab"), - new WorkloadProtectableItemResourceInner().withLocation("zcmrvexztvb") - .withTags(mapOf("wtl", "sfraoyzko", "uximerqfobw", "nguxawqaldsy", "r", "znkbykutwpfhpagm")) - .withProperties(new WorkloadProtectableItem().withBackupManagementType("xarzgszufoxciq") - .withWorkloadType("idoamciodhkha") - .withFriendlyName("khnzbonlw") - .withProtectionState(ProtectionStatus.PROTECTION_FAILED)) - .withEtag("gokdwbwhks"), - new WorkloadProtectableItemResourceInner().withLocation("oyuhhziui") - .withTags(mapOf("smlmzqhoftrm", "zbhd", "hxicslfaoqz", "equi", "kaivwit", "iyylhalnswhccsp")) - .withProperties(new WorkloadProtectableItem().withBackupManagementType("sttwvogvbbe") - .withWorkloadType("cngqqmoakufgmjz") - .withFriendlyName("rdgrtw") - .withProtectionState(ProtectionStatus.NOT_PROTECTED)) - .withEtag("uzkopbminrfd"), - new WorkloadProtectableItemResourceInner().withLocation("eadcygqukyhejhz") - .withTags(mapOf("jzraehtwdwrf", "gfpelolppvksrpqv", "dl", "swibyr", "hfwpracstwit", "h")) - .withProperties(new WorkloadProtectableItem().withBackupManagementType("xggicccnxqhuexmk") - .withWorkloadType("lstvlzywe") - .withFriendlyName("zrncsdt") - .withProtectionState(ProtectionStatus.PROTECTED)) - .withEtag("iypbsfgytgusl"))); - model = BinaryData.fromObject(model).toObject(WorkloadProtectableItemResourceList.class); - Assertions.assertEquals("hlt", model.nextLink()); - Assertions.assertEquals("q", model.value().get(0).location()); - Assertions.assertEquals("kif", model.value().get(0).tags().get("vtpuqujmqlgk")); - Assertions.assertEquals("hmk", model.value().get(0).properties().backupManagementType()); - Assertions.assertEquals("grauwjuetaebur", model.value().get(0).properties().workloadType()); - Assertions.assertEquals("dmovsm", model.value().get(0).properties().friendlyName()); - Assertions.assertEquals(ProtectionStatus.NOT_PROTECTED, model.value().get(0).properties().protectionState()); - Assertions.assertEquals("ab", model.value().get(0).etag()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemTests.java deleted file mode 100644 index 0825f2bf83af7..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/WorkloadProtectableItemTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionStatus; -import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadProtectableItem; -import org.junit.jupiter.api.Assertions; - -public final class WorkloadProtectableItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - WorkloadProtectableItem model = BinaryData.fromString( - "{\"protectableItemType\":\"WorkloadProtectableItem\",\"backupManagementType\":\"mokzhjjklf\",\"workloadType\":\"mouwqlgzrfzeey\",\"friendlyName\":\"izikayuhq\",\"protectionState\":\"ProtectionFailed\"}") - .toObject(WorkloadProtectableItem.class); - Assertions.assertEquals("mokzhjjklf", model.backupManagementType()); - Assertions.assertEquals("mouwqlgzrfzeey", model.workloadType()); - Assertions.assertEquals("izikayuhq", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - WorkloadProtectableItem model = new WorkloadProtectableItem().withBackupManagementType("mokzhjjklf") - .withWorkloadType("mouwqlgzrfzeey") - .withFriendlyName("izikayuhq") - .withProtectionState(ProtectionStatus.PROTECTION_FAILED); - model = BinaryData.fromObject(model).toObject(WorkloadProtectableItem.class); - Assertions.assertEquals("mokzhjjklf", model.backupManagementType()); - Assertions.assertEquals("mouwqlgzrfzeey", model.workloadType()); - Assertions.assertEquals("izikayuhq", model.friendlyName()); - Assertions.assertEquals(ProtectionStatus.PROTECTION_FAILED, model.protectionState()); - } -} diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/YearlyRetentionScheduleTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/YearlyRetentionScheduleTests.java deleted file mode 100644 index 4838caefb0a4e..0000000000000 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/YearlyRetentionScheduleTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.recoveryservicesbackup.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.recoveryservicesbackup.models.DailyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.Day; -import com.azure.resourcemanager.recoveryservicesbackup.models.DayOfWeek; -import com.azure.resourcemanager.recoveryservicesbackup.models.MonthOfYear; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDuration; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; -import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionScheduleFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat; -import com.azure.resourcemanager.recoveryservicesbackup.models.WeekOfMonth; -import com.azure.resourcemanager.recoveryservicesbackup.models.YearlyRetentionSchedule; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class YearlyRetentionScheduleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - YearlyRetentionSchedule model = BinaryData.fromString( - "{\"retentionScheduleFormatType\":\"Weekly\",\"monthsOfYear\":[\"October\",\"September\",\"October\"],\"retentionScheduleDaily\":{\"daysOfTheMonth\":[{\"date\":2140826215,\"isLast\":false},{\"date\":239575108,\"isLast\":true}]},\"retentionScheduleWeekly\":{\"daysOfTheWeek\":[\"Tuesday\",\"Saturday\",\"Tuesday\",\"Friday\"],\"weeksOfTheMonth\":[\"Third\",\"Invalid\",\"Last\"]},\"retentionTimes\":[\"2021-07-30T21:21:05Z\",\"2021-09-15T22:09:06Z\",\"2021-07-27T13:55:01Z\",\"2021-07-13T21:11:26Z\"],\"retentionDuration\":{\"count\":1248753250,\"durationType\":\"Weeks\"}}") - .toObject(YearlyRetentionSchedule.class); - Assertions.assertEquals(RetentionScheduleFormat.WEEKLY, model.retentionScheduleFormatType()); - Assertions.assertEquals(MonthOfYear.OCTOBER, model.monthsOfYear().get(0)); - Assertions.assertEquals(2140826215, model.retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, model.retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.TUESDAY, model.retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.THIRD, model.retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-30T21:21:05Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(1248753250, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.retentionDuration().durationType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - YearlyRetentionSchedule model - = new YearlyRetentionSchedule().withRetentionScheduleFormatType(RetentionScheduleFormat.WEEKLY) - .withMonthsOfYear(Arrays.asList(MonthOfYear.OCTOBER, MonthOfYear.SEPTEMBER, MonthOfYear.OCTOBER)) - .withRetentionScheduleDaily(new DailyRetentionFormat().withDaysOfTheMonth(Arrays.asList( - new Day().withDate(2140826215).withIsLast(false), new Day().withDate(239575108).withIsLast(true)))) - .withRetentionScheduleWeekly(new WeeklyRetentionFormat() - .withDaysOfTheWeek( - Arrays.asList(DayOfWeek.TUESDAY, DayOfWeek.SATURDAY, DayOfWeek.TUESDAY, DayOfWeek.FRIDAY)) - .withWeeksOfTheMonth(Arrays.asList(WeekOfMonth.THIRD, WeekOfMonth.INVALID, WeekOfMonth.LAST))) - .withRetentionTimes(Arrays.asList(OffsetDateTime.parse("2021-07-30T21:21:05Z"), - OffsetDateTime.parse("2021-09-15T22:09:06Z"), OffsetDateTime.parse("2021-07-27T13:55:01Z"), - OffsetDateTime.parse("2021-07-13T21:11:26Z"))) - .withRetentionDuration( - new RetentionDuration().withCount(1248753250).withDurationType(RetentionDurationType.WEEKS)); - model = BinaryData.fromObject(model).toObject(YearlyRetentionSchedule.class); - Assertions.assertEquals(RetentionScheduleFormat.WEEKLY, model.retentionScheduleFormatType()); - Assertions.assertEquals(MonthOfYear.OCTOBER, model.monthsOfYear().get(0)); - Assertions.assertEquals(2140826215, model.retentionScheduleDaily().daysOfTheMonth().get(0).date()); - Assertions.assertEquals(false, model.retentionScheduleDaily().daysOfTheMonth().get(0).isLast()); - Assertions.assertEquals(DayOfWeek.TUESDAY, model.retentionScheduleWeekly().daysOfTheWeek().get(0)); - Assertions.assertEquals(WeekOfMonth.THIRD, model.retentionScheduleWeekly().weeksOfTheMonth().get(0)); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-30T21:21:05Z"), model.retentionTimes().get(0)); - Assertions.assertEquals(1248753250, model.retentionDuration().count()); - Assertions.assertEquals(RetentionDurationType.WEEKS, model.retentionDuration().durationType()); - } -}