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