From 5fe56c4f8779d8456c95b6a8d33e392273cbea0b Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:41:01 -0800 Subject: [PATCH] [Automation] Generate Fluent Lite from Swagger recoveryservicesbackup#package-2024-04 (#43481) --- eng/versioning/version_client.txt | 2 +- .../CHANGELOG.md | 48 +- .../README.md | 136 +- .../SAMPLE.md | 422 +++- .../pom.xml | 8 +- .../RecoveryServicesBackupManager.java | 16 +- ...VMResourceFeatureSupportResponseInner.java | 48 +- .../models/BackupEngineBaseResourceInner.java | 106 +- .../models/BackupManagementUsageInner.java | 69 +- .../BackupResourceConfigResourceInner.java | 106 +- ...EncryptionConfigExtendedResourceInner.java | 108 +- ...ackupResourceVaultConfigResourceInner.java | 107 +- .../models/BackupStatusResponseInner.java | 89 +- ...ClientDiscoveryValueForSingleApiInner.java | 60 +- .../fluent/models/JobResourceInner.java | 105 +- .../OperationResultInfoBaseResourceInner.java | 55 +- .../fluent/models/OperationStatusInner.java | 75 +- .../PreValidateEnableBackupResponseInner.java | 71 +- ...rivateEndpointConnectionResourceInner.java | 107 +- .../ProtectableContainerResourceInner.java | 106 +- .../models/ProtectedItemResourceInner.java | 105 +- .../ProtectionContainerResourceInner.java | 106 +- .../models/ProtectionIntentResourceInner.java | 106 +- .../models/ProtectionPolicyResourceInner.java | 106 +- .../models/RecoveryPointResourceInner.java | 105 +- .../ResourceGuardProxyBaseResourceInner.java | 107 +- .../fluent/models/TieringCostInfoInner.java | 92 +- .../fluent/models/TokenInformationInner.java | 53 +- .../models/UnlockDeleteResponseInner.java | 45 +- .../ValidateOperationsResponseInner.java | 47 +- ...ageConfigOperationResultResponseInner.java | 91 +- .../models/WorkloadItemResourceInner.java | 105 +- .../WorkloadProtectableItemResourceInner.java | 107 +- .../BackupEnginesClientImpl.java | 8 +- .../implementation/BackupJobsClientImpl.java | 8 +- .../BackupPoliciesClientImpl.java | 8 +- .../BackupProtectableItemsClientImpl.java | 8 +- .../BackupProtectedItemsClientImpl.java | 8 +- .../BackupProtectionContainersClientImpl.java | 8 +- .../BackupProtectionIntentsClientImpl.java | 8 +- .../BackupWorkloadItemsClientImpl.java | 8 +- ...DeletedProtectionContainersClientImpl.java | 8 +- .../implementation/OperationsClientImpl.java | 8 +- .../ProtectableContainersClientImpl.java | 8 +- .../RecoveryPointsClientImpl.java | 8 +- ...ryPointsRecommendedForMovesClientImpl.java | 8 +- .../RecoveryServicesBackupClientImpl.java | 6 +- .../ResourceGuardProxiesClientImpl.java | 8 +- .../implementation/SecurityPINsImpl.java | 2 +- .../models/AcquireStorageAccountLock.java | 2 - .../AzureBackupGoalFeatureSupportRequest.java | 54 +- .../models/AzureBackupServerContainer.java | 105 +- .../models/AzureBackupServerEngine.java | 98 +- .../models/AzureFileShareBackupRequest.java | 66 +- .../models/AzureFileShareProtectableItem.java | 81 +- .../AzureFileShareProtectionPolicy.java | 89 +- .../AzureFileShareProvisionIlrRequest.java | 65 +- .../models/AzureFileShareRecoveryPoint.java | 84 +- .../models/AzureFileShareRestoreRequest.java | 91 +- .../models/AzureFileShareType.java | 2 - .../models/AzureFileshareProtectedItem.java | 158 +- ...ureFileshareProtectedItemExtendedInfo.java | 72 +- .../AzureIaaSClassicComputeVMContainer.java | 84 +- ...reIaaSClassicComputeVMProtectableItem.java | 76 +- ...zureIaaSClassicComputeVMProtectedItem.java | 181 +- .../models/AzureIaaSComputeVMContainer.java | 83 +- .../AzureIaaSComputeVMProtectableItem.java | 76 +- .../AzureIaaSComputeVMProtectedItem.java | 180 +- .../models/AzureIaaSvmErrorInfo.java | 54 +- .../models/AzureIaaSvmHealthDetails.java | 108 +- .../models/AzureIaaSvmJob.java | 115 +- .../models/AzureIaaSvmJobExtendedInfo.java | 74 +- .../models/AzureIaaSvmJobTaskDetails.java | 81 +- .../models/AzureIaaSvmJobV2.java | 111 +- .../models/AzureIaaSvmProtectedItem.java | 262 ++- .../AzureIaaSvmProtectedItemExtendedInfo.java | 87 +- .../models/AzureIaaSvmProtectionPolicy.java | 107 +- ...eRecoveryServiceVaultProtectionIntent.java | 105 +- .../models/AzureResourceProtectionIntent.java | 78 +- .../models/AzureSqlContainer.java | 74 +- .../models/AzureSqlProtectedItem.java | 133 +- .../AzureSqlProtectedItemExtendedInfo.java | 61 +- .../models/AzureSqlProtectionPolicy.java | 70 +- ...gWorkloadContainerProtectionContainer.java | 102 +- .../models/AzureStorageContainer.java | 96 +- .../models/AzureStorageErrorInfo.java | 55 +- .../models/AzureStorageJob.java | 115 +- .../models/AzureStorageJobExtendedInfo.java | 58 +- .../models/AzureStorageJobTaskDetails.java | 49 +- .../AzureStorageProtectableContainer.java | 70 +- ...ureVMAppContainerProtectableContainer.java | 70 +- ...zureVMAppContainerProtectionContainer.java | 100 +- .../AzureVMResourceFeatureSupportRequest.java | 62 +- .../models/AzureVmWorkloadItem.java | 129 +- .../AzureVmWorkloadProtectableItem.java | 160 +- .../models/AzureVmWorkloadProtectedItem.java | 256 ++- ...reVmWorkloadProtectedItemExtendedInfo.java | 90 +- .../AzureVmWorkloadProtectionPolicy.java | 88 +- ...VmWorkloadSapAseDatabaseProtectedItem.java | 195 +- ...eVmWorkloadSapAseDatabaseWorkloadItem.java | 85 +- ...VmWorkloadSapAseSystemProtectableItem.java | 103 +- ...ureVmWorkloadSapAseSystemWorkloadItem.java | 85 +- .../AzureVmWorkloadSapHanaDBInstance.java | 103 +- ...orkloadSapHanaDBInstanceProtectedItem.java | 195 +- ...orkloadSapHanaDatabaseProtectableItem.java | 104 +- ...mWorkloadSapHanaDatabaseProtectedItem.java | 195 +- ...VmWorkloadSapHanaDatabaseWorkloadItem.java | 85 +- .../models/AzureVmWorkloadSapHanaHsr.java | 100 +- ...mWorkloadSapHanaSystemProtectableItem.java | 104 +- ...reVmWorkloadSapHanaSystemWorkloadItem.java | 85 +- ...adSqlAvailabilityGroupProtectableItem.java | 113 +- ...eVmWorkloadSqlDatabaseProtectableItem.java | 103 +- ...ureVmWorkloadSqlDatabaseProtectedItem.java | 195 +- ...zureVmWorkloadSqlDatabaseWorkloadItem.java | 85 +- ...eVmWorkloadSqlInstanceProtectableItem.java | 103 +- ...zureVmWorkloadSqlInstanceWorkloadItem.java | 92 +- .../AzureWorkloadAutoProtectionIntent.java | 104 +- .../models/AzureWorkloadBackupRequest.java | 75 +- .../models/AzureWorkloadContainer.java | 130 +- ...WorkloadContainerAutoProtectionIntent.java | 74 +- .../AzureWorkloadContainerExtendedInfo.java | 56 +- .../models/AzureWorkloadErrorInfo.java | 63 +- .../models/AzureWorkloadJob.java | 107 +- .../models/AzureWorkloadJobExtendedInfo.java | 58 +- .../models/AzureWorkloadJobTaskDetails.java | 49 +- ...AzureWorkloadPointInTimeRecoveryPoint.java | 136 +- ...zureWorkloadPointInTimeRestoreRequest.java | 113 +- .../models/AzureWorkloadRecoveryPoint.java | 132 +- .../models/AzureWorkloadRestoreRequest.java | 152 +- ...rkloadSapHanaPointInTimeRecoveryPoint.java | 108 +- ...kloadSapHanaPointInTimeRestoreRequest.java | 146 +- ...ointInTimeRestoreWithRehydrateRequest.java | 123 +- .../AzureWorkloadSapHanaRecoveryPoint.java | 101 +- .../AzureWorkloadSapHanaRestoreRequest.java | 142 +- ...oadSapHanaRestoreWithRehydrateRequest.java | 113 +- .../AzureWorkloadSqlAutoProtectionIntent.java | 80 +- ...reWorkloadSqlPointInTimeRecoveryPoint.java | 113 +- ...eWorkloadSqlPointInTimeRestoreRequest.java | 164 +- ...ointInTimeRestoreWithRehydrateRequest.java | 139 +- .../models/AzureWorkloadSqlRecoveryPoint.java | 134 +- ...eWorkloadSqlRecoveryPointExtendedInfo.java | 60 +- .../AzureWorkloadSqlRestoreRequest.java | 158 +- ...orkloadSqlRestoreWithRehydrateRequest.java | 130 +- .../models/BackupEngineBase.java | 141 +- .../models/BackupEngineBaseResourceList.java | 48 +- .../models/BackupEngineExtendedInfo.java | 78 +- .../models/BackupEngineType.java | 2 - .../models/BackupItemType.java | 2 - .../models/BackupManagementType.java | 2 - .../models/BackupManagementUsageList.java | 47 +- .../models/BackupRequest.java | 91 +- .../models/BackupRequestResource.java | 105 +- .../models/BackupResourceConfig.java | 68 +- .../BackupResourceEncryptionConfig.java | 68 +- ...ackupResourceEncryptionConfigExtended.java | 70 +- ...ackupResourceEncryptionConfigResource.java | 107 +- .../models/BackupResourceVaultConfig.java | 85 +- .../models/BackupStatusRequest.java | 53 +- .../models/BackupType.java | 2 - .../models/BekDetails.java | 53 +- .../models/ClientDiscoveryDisplay.java | 57 +- .../ClientDiscoveryForLogSpecification.java | 54 +- .../models/ClientDiscoveryForProperties.java | 46 +- ...lientDiscoveryForServiceSpecification.java | 50 +- .../models/ClientDiscoveryResponse.java | 51 +- .../models/ClientScriptForConnect.java | 61 +- .../models/ContainerIdentityInfo.java | 57 +- .../models/CopyOptions.java | 2 - .../models/CreateMode.java | 2 - .../models/DailyRetentionFormat.java | 47 +- .../models/DailyRetentionSchedule.java | 54 +- .../models/DailySchedule.java | 50 +- .../models/DataMoveLevel.java | 2 - .../models/DataSourceType.java | 2 - .../recoveryservicesbackup/models/Day.java | 49 +- .../models/DayOfWeek.java | 5 - .../models/DedupState.java | 2 - .../models/DiskExclusionProperties.java | 50 +- .../models/DiskInformation.java | 49 +- .../models/DistributedNodesInfo.java | 57 +- .../models/DpmBackupEngine.java | 96 +- .../models/DpmContainer.java | 129 +- .../models/DpmContainerExtendedInfo.java | 49 +- .../models/DpmErrorInfo.java | 51 +- .../recoveryservicesbackup/models/DpmJob.java | 117 +- .../models/DpmJobExtendedInfo.java | 58 +- .../models/DpmJobTaskDetails.java | 68 +- .../models/DpmProtectedItem.java | 134 +- .../models/DpmProtectedItemExtendedInfo.java | 121 +- .../models/EncryptionAtRestType.java | 2 - .../models/EncryptionDetails.java | 61 +- .../models/EnhancedSecurityState.java | 2 - .../models/ErrorDetail.java | 51 +- .../models/ExportJobsOperationResultInfo.java | 73 +- .../models/ExtendedLocation.java | 49 +- .../models/ExtendedProperties.java | 49 +- .../models/FabricName.java | 2 - .../models/FeatureSupportRequest.java | 89 +- ...hTieringCostInfoForRehydrationRequest.java | 94 +- .../models/FetchTieringCostInfoRequest.java | 119 +- ...ieringCostSavingsInfoForPolicyRequest.java | 80 +- ...ostSavingsInfoForProtectedItemRequest.java | 86 +- ...TieringCostSavingsInfoForVaultRequest.java | 79 +- .../models/GenericContainer.java | 82 +- .../models/GenericContainerExtendedInfo.java | 58 +- .../models/GenericProtectedItem.java | 147 +- .../models/GenericProtectionPolicy.java | 80 +- .../models/GenericRecoveryPoint.java | 82 +- .../models/HealthStatus.java | 2 - .../models/HourlySchedule.java | 61 +- .../models/HttpStatusCode.java | 5 - .../models/IaaSvmContainer.java | 118 +- .../models/IaaSvmProtectableItem.java | 111 +- .../models/IaasVMBackupRequest.java | 66 +- .../models/IaasVMRecoveryPoint.java | 152 +- .../models/IaasVMRestoreRequest.java | 193 +- .../IaasVMRestoreWithRehydrationRequest.java | 167 +- .../models/IaasVMSnapshotConsistencyType.java | 2 - .../models/IaasVmilrRegistrationRequest.java | 73 +- .../models/IaasvmPolicyType.java | 2 - .../models/IdentityBasedRestoreDetails.java | 49 +- .../models/IdentityInfo.java | 49 +- .../models/IlrRequest.java | 88 +- .../models/IlrRequestResource.java | 105 +- .../models/InfrastructureEncryptionState.java | 2 - .../models/InquiryInfo.java | 56 +- .../models/InquiryStatus.java | 2 - .../models/InquiryValidation.java | 55 +- .../models/InstantItemRecoveryTarget.java | 47 +- .../models/InstantRPAdditionalDetails.java | 49 +- .../recoveryservicesbackup/models/Job.java | 138 +- .../models/JobResourceList.java | 47 +- .../models/JobSupportedAction.java | 5 - .../models/KekDetails.java | 53 +- .../models/KeyAndSecretDetails.java | 53 +- .../models/KpiResourceHealthDetails.java | 54 +- .../models/LastBackupStatus.java | 2 - .../models/LastUpdateStatus.java | 2 - ...coveryPointsRecommendedForMoveRequest.java | 53 +- .../models/LogSchedulePolicy.java | 60 +- .../models/LongTermRetentionPolicy.java | 72 +- .../models/LongTermSchedulePolicy.java | 56 +- .../models/MabContainer.java | 100 +- .../models/MabContainerExtendedInfo.java | 67 +- .../models/MabContainerHealthDetails.java | 59 +- .../models/MabErrorInfo.java | 48 +- .../models/MabFileFolderProtectedItem.java | 153 +- ...abFileFolderProtectedItemExtendedInfo.java | 64 +- .../recoveryservicesbackup/models/MabJob.java | 113 +- .../models/MabJobExtendedInfo.java | 58 +- .../models/MabJobTaskDetails.java | 68 +- .../models/MabProtectionPolicy.java | 72 +- .../models/MabServerType.java | 2 - .../models/MonthOfYear.java | 5 - .../models/MonthlyRetentionSchedule.java | 69 +- .../models/MoveRPAcrossTiersRequest.java | 57 +- .../models/NameInfo.java | 49 +- .../models/OperationResultInfo.java | 61 +- .../models/OperationResultInfoBase.java | 92 +- .../models/OperationStatusError.java | 49 +- .../models/OperationStatusExtendedInfo.java | 102 +- .../OperationStatusJobExtendedInfo.java | 61 +- .../OperationStatusJobsExtendedInfo.java | 70 +- ...erationStatusProvisionIlrExtendedInfo.java | 62 +- ...onStatusValidateOperationExtendedInfo.java | 62 +- .../models/OperationStatusValues.java | 2 - .../models/OperationType.java | 2 - .../models/OperationWorkerResponse.java | 54 +- .../models/OverwriteOptions.java | 2 - .../models/PointInTimeRange.java | 55 +- .../models/PolicyType.java | 2 - .../models/PreBackupValidation.java | 53 +- .../PreValidateEnableBackupRequest.java | 59 +- .../models/PrepareDataMoveRequest.java | 64 +- .../models/PrepareDataMoveResponse.java | 68 +- .../models/PrivateEndpoint.java | 45 +- .../models/PrivateEndpointConnection.java | 63 +- .../PrivateEndpointConnectionStatus.java | 2 - .../PrivateLinkServiceConnectionState.java | 55 +- .../models/ProtectableContainer.java | 107 +- .../ProtectableContainerResourceList.java | 49 +- .../models/ProtectableContainerType.java | 5 - .../models/ProtectedItem.java | 232 ++- .../models/ProtectedItemHealthStatus.java | 2 - .../models/ProtectedItemResourceList.java | 48 +- .../models/ProtectedItemState.java | 2 - .../models/ProtectionContainer.java | 138 +- .../ProtectionContainerResourceList.java | 49 +- .../models/ProtectionIntent.java | 123 +- .../models/ProtectionIntentItemType.java | 2 - .../models/ProtectionIntentResourceList.java | 48 +- .../models/ProtectionPolicy.java | 114 +- .../models/ProtectionPolicyResourceList.java | 48 +- .../models/ProtectionState.java | 2 - .../models/ProtectionStatus.java | 2 - .../models/ProvisioningState.java | 2 - .../models/RecoveryMode.java | 2 - .../models/RecoveryPoint.java | 104 +- .../RecoveryPointDiskConfiguration.java | 66 +- .../RecoveryPointMoveReadinessInfo.java | 51 +- .../models/RecoveryPointProperties.java | 53 +- .../models/RecoveryPointRehydrationInfo.java | 51 +- .../models/RecoveryPointResourceList.java | 48 +- .../models/RecoveryPointTierInformation.java | 58 +- .../RecoveryPointTierInformationV2.java | 51 +- .../models/RecoveryPointTierStatus.java | 5 - .../models/RecoveryPointTierType.java | 5 - .../models/RecoveryType.java | 2 - .../models/RehydrationPriority.java | 2 - .../models/ResourceGuardOperationDetail.java | 49 +- .../models/ResourceGuardProxyBase.java | 61 +- .../ResourceGuardProxyBaseResourceList.java | 49 +- .../models/ResourceHealthDetails.java | 98 +- .../models/ResourceHealthStatus.java | 2 - .../models/ResourceList.java | 45 +- .../models/RestoreFileSpecs.java | 53 +- .../models/RestorePointType.java | 2 - .../models/RestoreRequest.java | 118 +- .../models/RestoreRequestResource.java | 105 +- .../models/RestoreRequestType.java | 2 - .../models/RetentionDuration.java | 49 +- .../models/RetentionDurationType.java | 2 - .../models/RetentionPolicy.java | 92 +- .../models/RetentionScheduleFormat.java | 2 - .../models/SchedulePolicy.java | 98 +- .../models/ScheduleRunType.java | 2 - .../models/SecuredVMDetails.java | 45 +- .../models/SecurityPinBase.java | 47 +- .../models/Settings.java | 53 +- .../models/SimpleRetentionPolicy.java | 60 +- .../models/SimpleSchedulePolicy.java | 86 +- .../models/SimpleSchedulePolicyV2.java | 74 +- .../SnapshotBackupAdditionalDetails.java | 56 +- .../models/SnapshotRestoreParameters.java | 50 +- .../models/SoftDeleteFeatureState.java | 2 - .../models/SqlDataDirectory.java | 53 +- .../models/SqlDataDirectoryMapping.java | 58 +- .../models/SqlDataDirectoryType.java | 2 - .../models/StorageType.java | 2 - .../models/StorageTypeState.java | 2 - .../models/SubProtectionPolicy.java | 66 +- .../models/SupportStatus.java | 2 - .../models/TargetAfsRestoreInfo.java | 49 +- .../models/TargetDiskNetworkAccessOption.java | 5 - .../TargetDiskNetworkAccessSettings.java | 55 +- .../models/TargetRestoreInfo.java | 58 +- .../models/TieringCostRehydrationInfo.java | 65 +- .../models/TieringCostSavingInfo.java | 73 +- .../models/TieringMode.java | 2 - .../models/TieringPolicy.java | 53 +- .../models/TriggerDataMoveRequest.java | 68 +- .../models/UnlockDeleteRequest.java | 51 +- .../models/UsagesUnit.java | 2 - .../UserAssignedIdentityProperties.java | 50 +- .../UserAssignedManagedIdentityDetails.java | 55 +- ...ValidateIaasVMRestoreOperationRequest.java | 64 +- .../models/ValidateOperationRequest.java | 91 +- .../ValidateOperationRequestResource.java | 51 +- .../models/ValidateOperationResponse.java | 47 +- .../ValidateRestoreOperationRequest.java | 91 +- .../models/ValidationStatus.java | 2 - .../models/VaultJob.java | 102 +- .../models/VaultJobErrorInfo.java | 55 +- .../models/VaultJobExtendedInfo.java | 48 +- .../models/VaultRetentionPolicy.java | 50 +- .../models/VaultSubResourceType.java | 2 - .../models/WeekOfMonth.java | 5 - .../models/WeeklyRetentionFormat.java | 55 +- .../models/WeeklyRetentionSchedule.java | 61 +- .../models/WeeklySchedule.java | 57 +- .../models/WorkloadInquiryDetails.java | 53 +- .../models/WorkloadItem.java | 114 +- .../models/WorkloadItemResourceList.java | 48 +- .../models/WorkloadItemType.java | 2 - .../models/WorkloadProtectableItem.java | 130 +- .../WorkloadProtectableItemResourceList.java | 49 +- .../models/WorkloadType.java | 2 - .../models/XcoolState.java | 2 - .../models/YearlyRetentionSchedule.java | 76 +- .../src/main/java/module-info.java | 5 +- .../proxy-config.json | 2 +- .../reflect-config.json | 1787 +---------------- .../generated/BackupEnginesGetSamples.java | 4 +- .../generated/BackupEnginesListSamples.java | 4 +- .../generated/BackupJobsListSamples.java | 12 +- .../BackupOperationResultsGetSamples.java | 4 +- .../BackupOperationStatusesGetSamples.java | 4 +- .../generated/BackupPoliciesListSamples.java | 12 +- .../BackupProtectableItemsListSamples.java | 4 +- .../BackupProtectedItemsListSamples.java | 4 +- ...BackupProtectionContainersListSamples.java | 4 +- .../BackupProtectionIntentListSamples.java | 4 +- ...upResourceEncryptionConfigsGetSamples.java | 4 +- ...esourceEncryptionConfigsUpdateSamples.java | 4 +- ...esourceStorageConfigsNonCrrGetSamples.java | 4 +- ...ourceStorageConfigsNonCrrPatchSamples.java | 4 +- ...urceStorageConfigsNonCrrUpdateSamples.java | 4 +- .../BackupResourceVaultConfigsGetSamples.java | 4 +- .../BackupResourceVaultConfigsPutSamples.java | 4 +- ...ckupResourceVaultConfigsUpdateSamples.java | 4 +- .../generated/BackupStatusGetSamples.java | 4 +- .../BackupUsageSummariesListSamples.java | 8 +- .../BackupWorkloadItemsListSamples.java | 4 +- .../generated/BackupsTriggerSamples.java | 4 +- ...pareDataMoveOperationResultGetSamples.java | 4 +- ...eletedProtectionContainersListSamples.java | 4 +- .../ExportJobsOperationResultsGetSamples.java | 4 +- .../FeatureSupportValidateSamples.java | 4 +- .../FetchTieringCostPostSamples.java | 16 +- ...tTieringCostOperationResultGetSamples.java | 4 +- ...elRecoveryConnectionsProvisionSamples.java | 4 +- ...LevelRecoveryConnectionsRevokeSamples.java | 4 +- .../JobCancellationsTriggerSamples.java | 4 +- .../generated/JobDetailsGetSamples.java | 4 +- .../JobOperationResultsGetSamples.java | 4 +- .../generated/JobsExportSamples.java | 4 +- .../OperationOperationValidateSamples.java | 8 +- .../generated/OperationsListSamples.java | 4 +- ...rivateEndpointConnectionDeleteSamples.java | 4 +- .../PrivateEndpointConnectionGetSamples.java | 4 +- .../PrivateEndpointConnectionPutSamples.java | 4 +- ...vateEndpointGetOperationStatusSamples.java | 4 +- .../ProtectableContainersListSamples.java | 4 +- ...otectedItemOperationResultsGetSamples.java | 4 +- ...tectedItemOperationStatusesGetSamples.java | 4 +- .../ProtectedItemsCreateOrUpdateSamples.java | 8 +- .../ProtectedItemsDeleteSamples.java | 4 +- .../generated/ProtectedItemsGetSamples.java | 8 +- ...onContainerOperationResultsGetSamples.java | 4 +- ...inerRefreshOperationResultsGetSamples.java | 4 +- .../ProtectionContainersGetSamples.java | 4 +- .../ProtectionContainersInquireSamples.java | 4 +- .../ProtectionContainersRefreshSamples.java | 4 +- .../ProtectionContainersRegisterSamples.java | 4 +- ...ProtectionContainersUnregisterSamples.java | 4 +- ...ProtectionIntentCreateOrUpdateSamples.java | 4 +- .../ProtectionIntentDeleteSamples.java | 4 +- .../generated/ProtectionIntentGetSamples.java | 4 +- .../ProtectionIntentValidateSamples.java | 4 +- ...otectionPoliciesCreateOrUpdateSamples.java | 38 +- .../ProtectionPoliciesDeleteSamples.java | 4 +- .../ProtectionPoliciesGetSamples.java | 8 +- ...ctionPolicyOperationResultsGetSamples.java | 4 +- ...tionPolicyOperationStatusesGetSamples.java | 4 +- .../generated/RecoveryPointsGetSamples.java | 4 +- .../generated/RecoveryPointsListSamples.java | 4 +- ...ryPointsRecommendedForMoveListSamples.java | 4 +- .../ResourceGuardProxiesGetSamples.java | 4 +- ...ourceGuardProxyOperationDeleteSamples.java | 4 +- ...ResourceGuardProxyOperationGetSamples.java | 4 +- ...ResourceGuardProxyOperationPutSamples.java | 4 +- ...uardProxyOperationUnlockDeleteSamples.java | 4 +- ...urceProviderBmsPrepareDataMoveSamples.java | 4 +- ...urceProviderBmsTriggerDataMoveSamples.java | 4 +- ...urceProviderGetOperationStatusSamples.java | 4 +- ...ourceProviderMoveRecoveryPointSamples.java | 4 +- .../generated/RestoresTriggerSamples.java | 24 +- .../generated/SecurityPINsGetSamples.java | 4 +- .../TieringCostOperationStatusGetSamples.java | 4 +- .../ValidateOperationResultsGetSamples.java | 4 +- .../ValidateOperationStatusesGetSamples.java | 4 +- .../ValidateOperationTriggerSamples.java | 4 +- .../AzureIaaSvmProtectionPolicyTests.java | 2 +- .../LongTermRetentionPolicyTests.java | 4 +- .../MonthlyRetentionScheduleTests.java | 2 +- .../generated/WeeklyRetentionFormatTests.java | 2 +- .../YearlyRetentionScheduleTests.java | 2 +- 467 files changed, 22275 insertions(+), 5645 deletions(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index f0af113441f73..95f6e98c1eba3 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -376,7 +376,7 @@ com.azure.resourcemanager:azure-resourcemanager-videoanalyzer;1.0.0-beta.5;1.0.0 com.azure.resourcemanager:azure-resourcemanager-imagebuilder;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-maps;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-botservice;1.0.0-beta.6;1.0.0-beta.7 -com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.4.0;1.5.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.4.0;1.5.0 com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.1.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-postgresqlflexibleserver;1.0.0;1.1.0-beta.5 com.azure.resourcemanager:azure-resourcemanager-elastic;1.0.0;1.1.0-beta.1 diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md index 37c95b5fb9244..1848c924a230e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/CHANGELOG.md @@ -1,14 +1,54 @@ # Release History -## 1.5.0-beta.1 (Unreleased) +## 1.5.0 (2024-12-19) -### 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-2024-04. 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 +#### Serialization/Deserialization change + +- `Jackson` is removed from dependency and no longer supported. + +##### Migration Guide + +If you are using `Jackson`/`ObjectMapper` for manual serialization/deserialization, configure your `ObjectMapper` for backward compatibility: +```java +objectMapper.registerModule(com.azure.core.serializer.json.jackson.JacksonJsonProvider.getJsonSerializableDatabindModule()); +``` + +### Features Added + +#### `models.RestoreRequestResource` was modified + +* `name()` was added +* `id()` was added +* `type()` was added + +#### `models.BackupResourceEncryptionConfigResource` was modified + +* `id()` was added +* `type()` was added +* `name()` was added + +#### `models.IlrRequestResource` was modified + +* `type()` was added +* `id()` was added +* `name()` was added + +#### `models.AzureIaaSvmHealthDetails` was modified + +* `message()` was added +* `recommendations()` was added +* `title()` was added +* `code()` was added + +#### `models.BackupRequestResource` was modified -### Other Changes +* `id()` was added +* `name()` was added +* `type()` 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..3153ebfaae462 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/README.md +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/README.md @@ -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 ``` [//]: # ({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..26ffa615f7623 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/SAMPLE.md @@ -247,7 +247,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/stable/2024-04-01/examples/Dpm/ + * BackupEngines_Get.json */ /** * Sample code: Get Dpm/AzureBackupServer/Lajolla Backup Engine Details. @@ -270,7 +272,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/stable/2024-04-01/examples/Dpm/ + * BackupEngines_List.json */ /** * Sample code: List Dpm/AzureBackupServer/Lajolla Backup Engines. @@ -292,7 +296,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/stable/2024-04-01/examples/ + * Common/ListJobs.json */ /** * Sample code: List All Jobs. @@ -305,7 +311,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/stable/2024-04-01/examples/ + * Common/ListJobsWithAllSupportedFilters.json */ /** * Sample code: List Jobs With Filters. @@ -321,7 +329,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/stable/2024-04-01/examples/ + * Common/ListJobsWithStartTimeAndEndTimeFilters.json */ /** * Sample code: List Jobs With Time Filter. @@ -346,7 +356,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/stable/2024-04-01/examples/ + * Common/ProtectedItem_Delete_OperationResult.json */ /** * Sample code: Get Result for Protected Item Delete Operation. @@ -370,7 +382,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/stable/2024-04-01/examples/ + * Common/ProtectedItem_Delete_OperationStatus.json */ /** * Sample code: Get Protected Item Delete Operation Status. @@ -394,7 +408,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/stable/2024-04-01/examples/ + * AzureWorkload/BackupPolicies_List.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureWorkload. @@ -409,7 +425,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/stable/2024-04-01/examples/ + * AzureIaasVm/V2Policy/v2-List-Policies.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureIaasVm with both V1 and V2 @@ -425,7 +443,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/stable/2024-04-01/examples/ + * AzureIaasVm/BackupPolicies_List.json */ /** * Sample code: List protection policies with backupManagementType filter as AzureIaasVm. @@ -449,7 +469,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/stable/2024-04-01/examples/ + * AzureIaasVm/BackupProtectableItems_List.json */ /** * Sample code: List protectable items with backupManagementType filter as AzureIaasVm. @@ -473,7 +495,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/stable/2024-04-01/examples/ + * AzureIaasVm/BackupProtectedItems_List.json */ /** * Sample code: List protected items with backupManagementType filter as AzureIaasVm. @@ -497,7 +521,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectionContainers_List.json */ /** * Sample code: List Backup Protection Containers. @@ -520,7 +546,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/stable/2024-04-01/examples/ + * AzureWorkload/BackupProtectionIntent_List.json */ /** * Sample code: List protection intent with backupManagementType filter. @@ -542,7 +570,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/stable/2024-04-01/examples/ + * BackupResourceEncryptionConfig_Get.json */ /** * Sample code: Get Vault Encryption Configuration. @@ -570,7 +600,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/stable/2024-04-01/examples/ + * BackupResourceEncryptionConfig_Put.json */ /** * Sample code: Update Vault Encryption Configuration. @@ -599,7 +631,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/stable/2024-04-01/examples/ + * Common/BackupStorageConfig_Get.json */ /** * Sample code: Get Vault Storage Configuration. @@ -627,7 +661,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/stable/2024-04-01/examples/ + * Common/BackupStorageConfig_Patch.json */ /** * Sample code: Update Vault Storage Configuration. @@ -659,7 +695,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/stable/2024-04-01/examples/ + * Common/BackupStorageConfig_Put.json */ /** * Sample code: Update Vault Storage Configuration. @@ -686,7 +724,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/stable/2024-04-01/examples/ + * Common/BackupResourceVaultConfigs_Get.json */ /** * Sample code: Get Vault Security Config. @@ -714,7 +754,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/stable/2024-04-01/examples/ + * Common/BackupResourceVaultConfigs_Put.json */ /** * Sample code: Update Vault Security Config. @@ -745,7 +787,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/stable/2024-04-01/examples/ + * Common/BackupResourceVaultConfigs_Patch.json */ /** * Sample code: Update Vault Security Config. @@ -774,7 +818,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.DataSourceType; */ 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/stable/2024-04-01/examples/ + * AzureIaasVm/GetBackupStatus.json */ /** * Sample code: Get Azure Virtual Machine Backup Status. @@ -800,7 +846,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/stable/2024-04-01/examples/ + * Common/BackupProtectedItem_UsageSummary_Get.json */ /** * Sample code: Get Protected Items Usages Summary. @@ -815,7 +863,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/stable/2024-04-01/examples/ + * Common/BackupProtectionContainers_UsageSummary_Get.json */ /** * Sample code: Get Protected Containers Usages Summary. @@ -839,7 +889,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/stable/2024-04-01/examples/ + * AzureWorkload/BackupWorkloadItems_List.json */ /** * Sample code: List Workload Items in Container. @@ -866,7 +918,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/stable/2024-04-01/examples/ + * Common/TriggerBackup_Post.json */ /** * Sample code: Trigger Backup. @@ -892,7 +946,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/stable/2024-04-01/examples/ + * BackupDataMove/PrepareDataMoveOperationResult_Get.json */ /** * Sample code: Get operation result for PrepareDataMove. @@ -916,7 +972,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/stable/2024-04-01/examples/ + * AzureStorage/SoftDeletedContainers_List.json */ /** * Sample code: List Backup Protection Containers. @@ -939,7 +997,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/stable/2024-04-01/examples/ + * Common/ExportJobsOperationResult.json */ /** * Sample code: Export Jobs Operation Results. @@ -965,7 +1025,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/stable/2024-04-01/examples/ + * AzureIaasVm/BackupFeature_Validate.json */ /** * Sample code: Check Azure Vm Backup Feature Support. @@ -997,7 +1059,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/stable/2024-04-01/examples/ + * TieringCost/FetchTieringCostForRehydrate.json */ /** * Sample code: Get the rehydration cost for recovery point. @@ -1018,7 +1082,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/stable/2024-04-01/examples/ + * TieringCost/FetchTieringCostForProtectedItem.json */ /** * Sample code: Get the tiering savings cost info for protected item. @@ -1038,7 +1104,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/stable/2024-04-01/examples/ + * TieringCost/FetchTieringCostForPolicy.json */ /** * Sample code: Get the tiering savings cost info for policy. @@ -1056,7 +1124,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/stable/2024-04-01/examples/ + * TieringCost/FetchTieringCostForVault.json */ /** * Sample code: Get the tiering savings cost info for vault. @@ -1082,7 +1152,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/stable/2024-04-01/examples/ + * TieringCost/GetTieringCostOperationResult.json */ /** * Sample code: Fetch Tiering Cost Operation Result. @@ -1109,7 +1181,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/stable/2024-04-01/examples/ + * AzureIaasVm/Provision_Ilr.json */ /** * Sample code: Provision Instant Item Level Recovery for Azure Vm. @@ -1141,7 +1215,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/stable/2024-04-01/examples/ + * AzureIaasVm/Revoke_Ilr.json */ /** * Sample code: Revoke Instant Item Level Recovery for Azure Vm. @@ -1166,7 +1242,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/stable/2024-04-01/examples/ + * Common/TriggerCancelJob.json */ /** * Sample code: Cancel Job. @@ -1190,7 +1268,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/stable/2024-04-01/examples/ + * Common/GetJobDetails.json */ /** * Sample code: Get Job Details. @@ -1214,7 +1294,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/stable/2024-04-01/examples/ + * Common/CancelJobOperationResult.json */ /** * Sample code: Cancel Job Operation Result. @@ -1238,7 +1320,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/stable/2024-04-01/examples/ + * Common/TriggerExportJobs.json */ /** * Sample code: Export Jobs. @@ -1268,7 +1352,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/stable/2024-04-01/examples/ + * AzureIaasVm/ValidateOperation_RestoreDisk.json */ /** * Sample code: Validate Operation. @@ -1298,7 +1384,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/stable/2024-04-01/examples/ + * AzureIaasVm/ValidateOperation_RestoreDisk_IdentityBasedRestoreDetails.json */ /** * Sample code: Validate Operation with identityBasedRestoreDetails. @@ -1337,7 +1425,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/stable/2024-04-01/examples/ + * ListOperations.json */ /** * Sample code: ListOperations. @@ -1359,7 +1449,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/stable/2024-04-01/examples/ + * PrivateEndpointConnection/GetPrivateEndpointConnectionOperationStatus.json */ /** * Sample code: Get OperationStatus. @@ -1384,7 +1476,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/stable/2024-04-01/examples/ + * PrivateEndpointConnection/DeletePrivateEndpointConnection.json */ /** * Sample code: Delete PrivateEndpointConnection. @@ -1408,7 +1502,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/stable/2024-04-01/examples/ + * PrivateEndpointConnection/GetPrivateEndpointConnection.json */ /** * Sample code: Get PrivateEndpointConnection. @@ -1441,7 +1537,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/stable/2024-04-01/examples/ + * PrivateEndpointConnection/PutPrivateEndpointConnection.json */ /** * Sample code: Update PrivateEndpointConnection. @@ -1475,7 +1573,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectableContainers_List.json */ /** * Sample code: List protectable items with backupManagementType filter as AzureStorage. @@ -1500,7 +1600,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectedItemOperationResults.json */ /** * Sample code: Get Operation Results of Protected Vm. @@ -1526,7 +1628,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectedItemOperationStatus.json */ /** * Sample code: Get Operation Status of Protected Vm. @@ -1555,7 +1659,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/stable/2024-04-01/examples/ + * AzureIaasVm/StopProtection.json */ /** * Sample code: Stop Protection with retain data on Azure IaasVm. @@ -1576,7 +1682,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/stable/2024-04-01/examples/ + * AzureIaasVm/ConfigureProtection.json */ /** * Sample code: Enable Protection on Azure IaasVm. @@ -1607,7 +1715,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/stable/2024-04-01/examples/ + * Common/ProtectedItem_Delete.json */ /** * Sample code: Delete Protection from Azure Virtual Machine. @@ -1632,7 +1742,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/stable/2024-04-01/examples/ + * AzureIaasVm/ClassicCompute_ProtectedItem_Get.json */ /** * Sample code: Get Protected Classic Virtual Machine Details. @@ -1648,7 +1760,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/stable/2024-04-01/examples/ + * AzureIaasVm/Compute_ProtectedItem_Get.json */ /** * Sample code: Get Protected Virtual Machine Details. @@ -1673,7 +1787,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectionContainers_Inquire_Result.json */ /** * Sample code: Get Azure Storage Protection Container Operation Result. @@ -1697,7 +1813,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/stable/2024-04-01/examples/ + * Common/RefreshContainers_OperationResults.json */ /** * Sample code: Azure Vm Discovery Operation Result. @@ -1721,7 +1839,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/stable/2024-04-01/examples/ + * AzureWorkload/ProtectionContainers_Get.json */ /** * Sample code: Get Protection Container Details. @@ -1745,7 +1865,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectionContainers_Inquire.json */ /** * Sample code: Inquire Azure Storage Protection Containers. @@ -1769,7 +1891,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/stable/2024-04-01/examples/ + * Common/RefreshContainers.json */ /** * Sample code: Trigger Azure Vm Discovery. @@ -1796,7 +1920,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectionContainers_Register.json */ /** * Sample code: RegisterAzure Storage ProtectionContainers. @@ -1827,7 +1953,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/stable/2024-04-01/examples/ + * AzureWorkload/ProtectionContainers_Unregister.json */ /** * Sample code: Unregister Protection Container. @@ -1853,7 +1981,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionIntent_CreateOrUpdate.json */ /** * Sample code: Create or Update Azure Vm Protection Intent. @@ -1883,7 +2013,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/stable/2024-04-01/examples/ + * AzureWorkload/BackupProtectionIntent_Delete.json */ /** * Sample code: Delete Protection intent from item. @@ -1907,7 +2039,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/stable/2024-04-01/examples/ + * AzureWorkload/BackupProtectionIntent_Get.json */ /** * Sample code: Get ProtectionIntent for an item. @@ -1934,7 +2068,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionIntent_Validate.json */ /** * Sample code: Validate Enable Protection on Azure Vm. @@ -1965,12 +2101,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 +2118,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 +2131,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/stable/2024-04-01/examples/ + * AzureWorkload/ProtectionPolicies_CreateOrUpdate_Complex.json */ /** * Sample code: Create or Update Full Azure Workload Protection Policy. @@ -2059,7 +2197,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Simple.json */ /** * Sample code: Create or Update Simple Azure Vm Protection Policy. @@ -2084,7 +2224,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectionPolicies_CreateOrUpdate_Daily.json */ /** * Sample code: Create or Update Daily Azure Storage Protection Policy. @@ -2135,7 +2277,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectionPolicies_CreateOrUpdate_Hardened.json */ /** * Sample code: Create or Update Azure Storage Vault Standard Protection Policy. @@ -2191,7 +2335,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/stable/2024-04-01/examples/ + * AzureStorage/ProtectionPolicies_CreateOrUpdate_Hourly.json */ /** * Sample code: Create or Update Hourly Azure Storage Protection Policy. @@ -2237,7 +2383,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Complex.json */ /** * Sample code: Create or Update Full Azure Vm Protection Policy. @@ -2288,7 +2436,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/stable/2024-04-01/examples/ + * AzureIaasVm/V2Policy/IaaS_v2_hourly.json */ /** * Sample code: Create or Update Enhanced Azure Vm Protection Policy with Hourly backup. @@ -2343,7 +2493,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/stable/2024-04-01/examples/ + * AzureIaasVm/V2Policy/IaaS_v2_daily.json */ /** * Sample code: Create or Update Enhanced Azure Vm Protection Policy with daily backup. @@ -2406,7 +2558,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionPolicies_Delete.json */ /** * Sample code: Delete Azure Vm Protection Policy. @@ -2429,7 +2583,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionPolicies_Get.json */ /** * Sample code: Get Azure IaasVm Protection Policy Details. @@ -2443,7 +2599,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/stable/2024-04-01/examples/ + * AzureIaasVm/V2Policy/v2-Get-Policy.json */ /** * Sample code: Get Azure IaasVm Enhanced Protection Policy Details. @@ -2466,7 +2624,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionPolicyOperationResults_Get.json */ /** * Sample code: Get Protection Policy Operation Results. @@ -2490,7 +2650,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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionPolicyOperationStatuses_Get.json */ /** * Sample code: Get Protection Policy Operation Status. @@ -2514,7 +2676,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/stable/2024-04-01/examples/ + * AzureIaasVm/RecoveryPoints_Get.json */ /** * Sample code: Get Azure Vm Recovery Point Details. @@ -2539,7 +2703,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/stable/2024-04-01/examples/ + * AzureIaasVm/RecoveryPoints_List.json */ /** * Sample code: Get Protected Azure Vm Recovery Points. @@ -2567,7 +2733,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/stable/2024-04-01/examples/ + * AzureIaasVm/RecoveryPointsRecommendedForMove_List.json */ /** * Sample code: Get Protected Azure Vm Recovery Points Recommended for Move. @@ -2596,7 +2764,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/stable/2024-04-01/examples/ + * ResourceGuardProxyCRUD/ListResourceGuardProxy.json */ /** * Sample code: Get VaultGuardProxies. @@ -2618,7 +2788,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/stable/2024-04-01/examples/ + * ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json */ /** * Sample code: Delete ResourceGuardProxy. @@ -2642,7 +2814,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/stable/2024-04-01/examples/ + * ResourceGuardProxyCRUD/GetResourceGuardProxy.json */ /** * Sample code: Get ResourceGuardProxy. @@ -2667,7 +2841,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/stable/2024-04-01/examples/ + * ResourceGuardProxyCRUD/PutResourceGuardProxy.json */ /** * Sample code: Create ResourceGuardProxy. @@ -2698,7 +2874,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/stable/2024-04-01/examples/ + * ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json */ /** * Sample code: UnlockDelete ResourceGuardProxy. @@ -2729,7 +2907,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/stable/2024-04-01/examples/ + * BackupDataMove/PrepareDataMove_Post.json */ /** * Sample code: Prepare Data Move. @@ -2758,7 +2938,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/stable/2024-04-01/examples/ + * BackupDataMove/TriggerDataMove_Post.json */ /** * Sample code: Trigger Data Move. @@ -2786,7 +2968,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/stable/2024-04-01/examples/ + * BackupDataMove/BackupDataMoveOperationStatus_Get.json */ /** * Sample code: Get OperationStatus. @@ -2813,7 +2997,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/stable/2024-04-01/examples/ + * TriggerRecoveryPointMove_Post.json */ /** * Sample code: Trigger RP Move Operation. @@ -2854,7 +3040,9 @@ import com.azure.resourcemanager.recoveryservicesbackup.models.TargetDiskNetwork */ 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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreWithRehydrationRequest. @@ -2893,7 +3081,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest. @@ -2930,7 +3120,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreWithRehydrationRequest. @@ -2961,7 +3153,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest with identityBasedRestoreDetails. @@ -2998,7 +3192,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreRequest. @@ -3034,7 +3230,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json */ /** * Sample code: Restore Disks with IaasVMRestoreRequest with IdentityBasedRestoreDetails. @@ -3075,7 +3273,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/stable/2024-04-01/examples/ + * Common/BackupSecurityPin_Get.json */ /** * Sample code: Get Vault Security Pin. @@ -3097,7 +3297,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/stable/2024-04-01/examples/ + * TieringCost/GetTieringCostOperationStatus.json */ /** * Sample code: Fetch Tiering Cost Operation Status. @@ -3128,7 +3330,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerValidateOperation_RestoreDisk.json */ /** * Sample code: Trigger Validate Operation. @@ -3167,7 +3371,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/stable/2024-04-01/examples/ + * AzureIaasVm/ValidateOperationResults.json */ /** * Sample code: Get Operation Results of Validate Operation. @@ -3191,7 +3397,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/stable/2024-04-01/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 6d233e21ff038..389e842d5108e 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -14,7 +14,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. com.azure.resourcemanager azure-resourcemanager-recoveryservicesbackup - 1.5.0-beta.1 + 1.5.0 jar Microsoft Azure SDK for RecoveryServicesBackup Management @@ -45,7 +45,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. UTF-8 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..30b878c524a4e 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,15 +11,15 @@ 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.BearerTokenAuthenticationPolicy; 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; import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -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.5.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -448,7 +448,7 @@ public RecoveryServicesBackupManager authenticate(TokenCredential credential, Az HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); 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..f8f53ca8d0858 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 @@ -493,9 +493,7 @@ public RecoveryPointResourceInner get(String vaultName, String resourceGroupName /** * 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. @@ -521,9 +519,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/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..11d631df4dfcc 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; 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..82c36698943e9 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,74 +5,59 @@ 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; /** @@ -373,7 +358,6 @@ public AzureFileshareProtectedItem withSoftDeleteRetentionPeriod(Integer softDel */ @Override public void validate() { - super.validate(); if (kpisHealths() != null) { kpisHealths().values().forEach(e -> { if (e != null) { @@ -385,4 +369,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureFileshareProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(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..2cbba7273e4b3 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,30 +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.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"; /** @@ -255,6 +249,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withFriendlyName(reader.getString()); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withVirtualMachineId(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 + .withHealthStatus(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.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("protectedItemDataId".equals(fieldName)) { + deserializedAzureIaaSClassicComputeVMProtectedItem.withProtectedItemDataId(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..21eec449fedf0 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,30 +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.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"; /** @@ -254,6 +248,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withFriendlyName(reader.getString()); + } else if ("virtualMachineId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withVirtualMachineId(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 + .withHealthStatus(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.withLastBackupTime(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("protectedItemDataId".equals(fieldName)) { + deserializedAzureIaaSComputeVMProtectedItem.withProtectedItemDataId(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..66de6e0e9cf31 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,110 +5,84 @@ 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; /** @@ -136,6 +110,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 +130,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 +190,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 +270,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 +290,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. * @@ -454,7 +483,6 @@ public AzureIaaSvmProtectedItem withSoftDeleteRetentionPeriod(Integer softDelete */ @Override public void validate() { - super.validate(); if (healthDetails() != null) { healthDetails().forEach(e -> e.validate()); } @@ -472,4 +500,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureIaaSvmProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(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..1a8d3a9699b17 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,47 +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; 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; /** @@ -268,9 +259,119 @@ 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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureSqlProtectedItem.withWorkloadType(DataSourceType.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.withVaultId(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/AzureVmWorkloadItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadItem.java index 630957362a934..f084d96134ee3 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,104 @@ 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 ("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/AzureVmWorkloadProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureVmWorkloadProtectableItem.java index 5a17a578d9735..891dd24c9241f 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,130 @@ 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 ("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..be47e091a2774 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,128 +5,94 @@ 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; /** @@ -154,6 +120,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 +200,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. * @@ -549,7 +537,6 @@ public AzureVmWorkloadProtectedItem withSoftDeleteRetentionPeriod(Integer softDe */ @Override public void validate() { - super.validate(); if (lastBackupErrorDetail() != null) { lastBackupErrorDetail().validate(); } @@ -567,4 +554,191 @@ 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 ("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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(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..61eada12878bc 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,41 @@ 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; /* * 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; /** @@ -176,7 +165,6 @@ public AzureVmWorkloadProtectionPolicy withProtectedItemsCount(Integer protected */ @Override public void validate() { - super.validate(); if (settings() != null) { settings().validate(); } @@ -184,4 +172,68 @@ 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.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 ("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..92a0997d0cd76 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,30 +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.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"; /** @@ -305,6 +299,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapAseDatabaseProtectedItem.withFriendlyName(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.withProtectionStatus(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..6acd0f260adb2 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,30 +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.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"; /** @@ -307,6 +301,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDBInstanceProtectedItem.withFriendlyName(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.withProtectionStatus(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..c5ac014111e06 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,30 +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.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"; /** @@ -306,6 +300,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSapHanaDatabaseProtectedItem.withFriendlyName(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.withProtectionStatus(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/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..78ba440953ea0 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,30 +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.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"; /** @@ -302,6 +296,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(reader.getString()); + } else if ("friendlyName".equals(fieldName)) { + deserializedAzureVmWorkloadSqlDatabaseProtectedItem.withFriendlyName(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.withProtectionStatus(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/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/AzureWorkloadPointInTimeRecoveryPoint.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/AzureWorkloadPointInTimeRecoveryPoint.java index 084613c6fe4a5..eb466e4f6d02f 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,116 @@ 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 { + 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..f7c23d5d109aa 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,100 @@ 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 ("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..7954921e4e306 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 ("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/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..027351989e698 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; /* * Entire ARM resource id of the resource */ - @JsonProperty(value = "resourceId") private String resourceId; /* * Protectable Item Logical Name */ - @JsonProperty(value = "poLogicalName") private String poLogicalName; /** @@ -103,4 +104,46 @@ 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 = DataSourceType.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 index 2cbd40f63be06..4896a9acbf533 100644 --- 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 @@ -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 DataSourceType() { * @param name a name to look for. * @return the corresponding DataSourceType. */ - @JsonCreator public static DataSourceType fromString(String name) { return fromString(name, DataSourceType.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..f5afda26a2d8b 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,53 +5,43 @@ 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; /** @@ -292,9 +282,119 @@ 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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedDpmProtectedItem.withWorkloadType(DataSourceType.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.withVaultId(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..af4318fbc4980 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,68 +5,54 @@ 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; /** @@ -349,6 +335,125 @@ 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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedGenericProtectedItem.withWorkloadType(DataSourceType.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.withVaultId(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..a676ba42f1cda 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,71 +5,58 @@ 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; /** @@ -370,9 +357,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 + .withBackupManagementType(BackupManagementType.fromString(reader.getString())); + } else if ("workloadType".equals(fieldName)) { + deserializedMabFileFolderProtectedItem + .withWorkloadType(DataSourceType.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.withVaultId(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/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..80c35f888b8a6 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; /* * 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; /** @@ -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 + = DataSourceType.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..019213440a8aa 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,48 @@ 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; /* * 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 +147,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..d9e87ec289ef3 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; /* * 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,6 +139,17 @@ 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. * @@ -181,6 +159,17 @@ public DataSourceType 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(DataSourceType 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,152 @@ 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 ("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 = DataSourceType.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..cc7336712b95c 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; /* * 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..1d82488013cc8 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,81 @@ 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 ("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/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..305645d80ce9a 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,95 @@ 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 ("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/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/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..548626f800bf8 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,90 @@ 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 ("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..4ae1b57c12458 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; /** @@ -67,7 +66,6 @@ public WorkloadItemType() { * @param name a name to look for. * @return the corresponding WorkloadItemType. */ - @JsonCreator public static WorkloadItemType fromString(String name) { return fromString(name, WorkloadItemType.class); } diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItem.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItem.java index b10ef98ec56e4..89551b72e6bf7 100644 --- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItem.java +++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/main/java/com/azure/resourcemanager/recoveryservicesbackup/models/WorkloadProtectableItem.java @@ -5,63 +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 = "protectableItemType", - defaultImpl = WorkloadProtectableItem.class, - visible = true) -@JsonTypeName("WorkloadProtectableItem") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureFileShare", value = AzureFileShareProtectableItem.class), - @JsonSubTypes.Type(name = "IaaSVMProtectableItem", value = IaaSvmProtectableItem.class), - @JsonSubTypes.Type(name = "AzureVmWorkloadProtectableItem", value = AzureVmWorkloadProtectableItem.class) }) @Fluent -public class WorkloadProtectableItem { +public class WorkloadProtectableItem implements JsonSerializable { /* * 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,103 @@ 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 ("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..b6e1f2f6a3fe8 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/stable/2024-04-01/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..cd7e5f300898f 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/stable/2024-04-01/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..4d4c1b87c3bc5 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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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..4d40bee14ff45 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/stable/2024-04-01/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..3359c1597d78c 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/stable/2024-04-01/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..3611ae2b083e0 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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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..64089535fa09b 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/stable/2024-04-01/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..ad89e79db5b95 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/stable/2024-04-01/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..2fbbde0053512 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/stable/2024-04-01/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..857ef69bb3760 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/stable/2024-04-01/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..ef3c344986810 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/stable/2024-04-01/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..470aa65253b19 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/stable/2024-04-01/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..126c1c49f2118 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/stable/2024-04-01/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..443aa42b45c2b 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/stable/2024-04-01/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..11b260edc24e3 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/stable/2024-04-01/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..62a7138616970 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/stable/2024-04-01/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..98fc2a2d0e8d2 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/stable/2024-04-01/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..e8cb531bfb460 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/stable/2024-04-01/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..b15dc4f238e88 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 @@ -12,7 +12,9 @@ */ 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/stable/2024-04-01/examples/ + * AzureIaasVm/GetBackupStatus.json */ /** * Sample code: Get Azure Virtual Machine Backup Status. 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..e72622b3a0981 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/stable/2024-04-01/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/stable/2024-04-01/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..4d73c38e8fba9 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/stable/2024-04-01/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..48ebbccdb13cb 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/stable/2024-04-01/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..f422122fd352a 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/stable/2024-04-01/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..9afa4c665b86b 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/stable/2024-04-01/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..1037c687fca1f 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/stable/2024-04-01/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..7f2ec3c2a9ff4 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/stable/2024-04-01/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..f005334455bcd 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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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..e62b68744db5f 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/stable/2024-04-01/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..4c5b807120a3d 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/stable/2024-04-01/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..2c99a1b8db59a 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/stable/2024-04-01/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..1c9a6d0bff766 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/stable/2024-04-01/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..083a1befcd423 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/stable/2024-04-01/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..26e5ebee71c2a 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/stable/2024-04-01/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..84f59ad06d610 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/stable/2024-04-01/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..7eae28e6ea810 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/stable/2024-04-01/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/stable/2024-04-01/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..25e234844f125 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/stable/2024-04-01/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..030b67edd0fcc 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/stable/2024-04-01/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..bf9f4e2ab9b04 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/stable/2024-04-01/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..75e22c4563f5d 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/stable/2024-04-01/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..e40b55d038170 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/stable/2024-04-01/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..68d86c6d9a05a 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/stable/2024-04-01/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..1fa53f10b86cc 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/stable/2024-04-01/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..05d2f87767926 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/stable/2024-04-01/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..5df042e78dbb9 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/stable/2024-04-01/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/stable/2024-04-01/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..dbc9c994ec53e 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/stable/2024-04-01/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..ffad0540b516f 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/stable/2024-04-01/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/stable/2024-04-01/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..0db6e47769052 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/stable/2024-04-01/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..8e3d2ce83048f 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/stable/2024-04-01/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..40b7a1678e5c0 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/stable/2024-04-01/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..da62bb7d1ea73 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/stable/2024-04-01/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..63962cb0571bf 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/stable/2024-04-01/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..684477a934486 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/stable/2024-04-01/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..1420cf76bc05e 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/stable/2024-04-01/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..a9c7a9e08d5ea 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/stable/2024-04-01/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..03ccfbcd6d65f 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/stable/2024-04-01/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..7f7b41933c2dc 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/stable/2024-04-01/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..abe242f07015d 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 @@ -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/stable/2024-04-01/examples/ + * AzureIaasVm/ProtectionIntent_Validate.json */ /** * Sample code: Validate Enable Protection on Azure Vm. 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..54e6b197eb9d5 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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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/stable/2024-04-01/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..45c9fd9e5cc74 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/stable/2024-04-01/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..115a6e16c8c1c 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/stable/2024-04-01/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/stable/2024-04-01/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..b251a662d15bf 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/stable/2024-04-01/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..dd69d32c512e8 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/stable/2024-04-01/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..1e8f66109e07c 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/stable/2024-04-01/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..d1199409f0e66 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/stable/2024-04-01/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..5b2ce79b8dc86 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/stable/2024-04-01/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/ResourceGuardProxiesGetSamples.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/samples/java/com/azure/resourcemanager/recoveryservicesbackup/generated/ResourceGuardProxiesGetSamples.java index b4643d506d708..73d5994287e90 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/stable/2024-04-01/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..78bcb82609fc8 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/stable/2024-04-01/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..03f18cda8db3c 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/stable/2024-04-01/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..3b79b98c59b57 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/stable/2024-04-01/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..5c1f6c50326f8 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/stable/2024-04-01/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..7fc4da64852ec 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/stable/2024-04-01/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..4d703e3dc5db8 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/stable/2024-04-01/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..c6418fd986e72 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/stable/2024-04-01/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..86b1b83dfa678 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/stable/2024-04-01/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..1335180b56b07 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 @@ -21,7 +21,9 @@ */ 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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreWithRehydrationRequest. @@ -60,7 +62,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest. @@ -97,7 +101,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreWithRehydrationRequest. @@ -128,7 +134,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json */ /** * Sample code: Restore to New Azure IaasVm with IaasVMRestoreRequest with identityBasedRestoreDetails. @@ -165,7 +173,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/stable/2024-04-01/examples/ + * AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json */ /** * Sample code: Restore Disks with IaasVMRestoreRequest. @@ -201,7 +211,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/stable/2024-04-01/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..37fc2afdf0f96 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/stable/2024-04-01/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..5d697c2b368bb 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/stable/2024-04-01/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..d73f2d1a10f41 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/stable/2024-04-01/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..96846c6deaaae 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/stable/2024-04-01/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..40a294fdb36fe 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/stable/2024-04-01/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/AzureIaaSvmProtectionPolicyTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/generated/AzureIaaSvmProtectionPolicyTests.java index 256d0df40831f..ff70fc748d685 100644 --- 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 @@ -6,8 +6,8 @@ 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.IaasvmPolicyType; import com.azure.resourcemanager.recoveryservicesbackup.models.InstantRPAdditionalDetails; import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionDurationType; import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy; 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 index 3d4770bf955d7..e2d12203541fe 100644 --- 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 @@ -10,14 +10,14 @@ 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.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.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.YearlyRetentionSchedule; import java.time.OffsetDateTime; import java.util.Arrays; 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 index 5469580bb3dfe..44465bfd591c0 100644 --- 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 @@ -12,8 +12,8 @@ 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.WeeklyRetentionFormat; import java.time.OffsetDateTime; import java.util.Arrays; import org.junit.jupiter.api.Assertions; 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 index 41bb8e3401d1c..e4734c524e390 100644 --- 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 @@ -6,8 +6,8 @@ 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 com.azure.resourcemanager.recoveryservicesbackup.models.WeeklyRetentionFormat; import java.util.Arrays; import org.junit.jupiter.api.Assertions; 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 index 4838caefb0a4e..5c2f71e6da737 100644 --- 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 @@ -12,8 +12,8 @@ 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.WeeklyRetentionFormat; import com.azure.resourcemanager.recoveryservicesbackup.models.YearlyRetentionSchedule; import java.time.OffsetDateTime; import java.util.Arrays;