internal static SnapshotData DeserializeSnapshotData(JsonElement element) { Optional <string> managedBy = default; Optional <SnapshotSku> sku = default; Optional <ExtendedLocation> extendedLocation = default; IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <DateTimeOffset> timeCreated = default; Optional <OperatingSystemTypes> osType = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <DiskPurchasePlan> purchasePlan = default; Optional <SupportedCapabilities> supportedCapabilities = default; Optional <CreationData> creationData = default; Optional <int> diskSizeGB = default; Optional <long> diskSizeBytes = default; Optional <DiskState> diskState = default; Optional <string> uniqueId = default; Optional <EncryptionSettingsCollection> encryptionSettingsCollection = default; Optional <string> provisioningState = default; Optional <bool> incremental = default; Optional <Encryption> encryption = default; Optional <NetworkAccessPolicy> networkAccessPolicy = default; Optional <string> diskAccessId = default; Optional <DiskSecurityProfile> securityProfile = default; Optional <bool> supportsHibernation = default; Optional <PublicNetworkAccess> publicNetworkAccess = default; Optional <float> completionPercent = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = SnapshotSku.DeserializeSnapshotSku(property.Value); continue; } if (property.NameEquals("extendedLocation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("purchasePlan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } purchasePlan = DiskPurchasePlan.DeserializeDiskPurchasePlan(property0.Value); continue; } if (property0.NameEquals("supportedCapabilities")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportedCapabilities = SupportedCapabilities.DeserializeSupportedCapabilities(property0.Value); continue; } if (property0.NameEquals("creationData")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskState = new DiskState(property0.Value.GetString()); continue; } if (property0.NameEquals("uniqueId")) { uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("incremental")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } incremental = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("encryption")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryption = Encryption.DeserializeEncryption(property0.Value); continue; } if (property0.NameEquals("networkAccessPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } networkAccessPolicy = new NetworkAccessPolicy(property0.Value.GetString()); continue; } if (property0.NameEquals("diskAccessId")) { diskAccessId = property0.Value.GetString(); continue; } if (property0.NameEquals("securityProfile")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } securityProfile = DiskSecurityProfile.DeserializeDiskSecurityProfile(property0.Value); continue; } if (property0.NameEquals("supportsHibernation")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportsHibernation = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } if (property0.NameEquals("completionPercent")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } completionPercent = property0.Value.GetSingle(); continue; } } continue; } } return(new SnapshotData(id, name, type, systemData, tags, location, managedBy.Value, sku.Value, extendedLocation.Value, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), Optional.ToNullable(diskState), uniqueId.Value, encryptionSettingsCollection.Value, provisioningState.Value, Optional.ToNullable(incremental), encryption.Value, Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, securityProfile.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(completionPercent))); }
internal static DiskData DeserializeDiskData(JsonElement element) { Optional <string> managedBy = default; Optional <IReadOnlyList <string> > managedByExtended = default; Optional <DiskSku> sku = default; Optional <IList <string> > zones = default; Optional <ExtendedLocation> extendedLocation = default; IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional <DateTimeOffset> timeCreated = default; Optional <OperatingSystemTypes> osType = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <DiskPurchasePlan> purchasePlan = default; Optional <SupportedCapabilities> supportedCapabilities = default; Optional <CreationData> creationData = default; Optional <int> diskSizeGB = default; Optional <long> diskSizeBytes = default; Optional <string> uniqueId = default; Optional <EncryptionSettingsCollection> encryptionSettingsCollection = default; Optional <string> provisioningState = default; Optional <long> diskIOPSReadWrite = default; Optional <long> diskMBpsReadWrite = default; Optional <long> diskIOPSReadOnly = default; Optional <long> diskMBpsReadOnly = default; Optional <DiskState> diskState = default; Optional <Encryption> encryption = default; Optional <int> maxShares = default; Optional <IReadOnlyList <ShareInfoElement> > shareInfo = default; Optional <NetworkAccessPolicy> networkAccessPolicy = default; Optional <string> diskAccessId = default; Optional <string> tier = default; Optional <bool> burstingEnabled = default; Optional <PropertyUpdatesInProgress> propertyUpdatesInProgress = default; Optional <bool> supportsHibernation = default; Optional <DiskSecurityProfile> securityProfile = default; Optional <float> completionPercent = default; Optional <PublicNetworkAccess> publicNetworkAccess = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("managedByExtended")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } managedByExtended = array; continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = DiskSku.DeserializeDiskSku(property.Value); continue; } if (property.NameEquals("zones")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } zones = array; continue; } if (property.NameEquals("extendedLocation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("timeCreated")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } timeCreated = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("purchasePlan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } purchasePlan = DiskPurchasePlan.DeserializeDiskPurchasePlan(property0.Value); continue; } if (property0.NameEquals("supportedCapabilities")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportedCapabilities = SupportedCapabilities.DeserializeSupportedCapabilities(property0.Value); continue; } if (property0.NameEquals("creationData")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } creationData = CreationData.DeserializeCreationData(property0.Value); continue; } if (property0.NameEquals("diskSizeGB")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeGB = property0.Value.GetInt32(); continue; } if (property0.NameEquals("diskSizeBytes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("uniqueId")) { uniqueId = property0.Value.GetString(); continue; } if (property0.NameEquals("encryptionSettingsCollection")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryptionSettingsCollection = EncryptionSettingsCollection.DeserializeEncryptionSettingsCollection(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("diskIOPSReadWrite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskIOPSReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadWrite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskMBpsReadWrite = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskIOPSReadOnly")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskIOPSReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskMBpsReadOnly")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskMBpsReadOnly = property0.Value.GetInt64(); continue; } if (property0.NameEquals("diskState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } diskState = new DiskState(property0.Value.GetString()); continue; } if (property0.NameEquals("encryption")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encryption = Encryption.DeserializeEncryption(property0.Value); continue; } if (property0.NameEquals("maxShares")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } maxShares = property0.Value.GetInt32(); continue; } if (property0.NameEquals("shareInfo")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ShareInfoElement> array = new List <ShareInfoElement>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ShareInfoElement.DeserializeShareInfoElement(item)); } shareInfo = array; continue; } if (property0.NameEquals("networkAccessPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } networkAccessPolicy = new NetworkAccessPolicy(property0.Value.GetString()); continue; } if (property0.NameEquals("diskAccessId")) { diskAccessId = property0.Value.GetString(); continue; } if (property0.NameEquals("tier")) { tier = property0.Value.GetString(); continue; } if (property0.NameEquals("burstingEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } burstingEnabled = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("propertyUpdatesInProgress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } propertyUpdatesInProgress = PropertyUpdatesInProgress.DeserializePropertyUpdatesInProgress(property0.Value); continue; } if (property0.NameEquals("supportsHibernation")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } supportsHibernation = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("securityProfile")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } securityProfile = DiskSecurityProfile.DeserializeDiskSecurityProfile(property0.Value); continue; } if (property0.NameEquals("completionPercent")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } completionPercent = property0.Value.GetSingle(); continue; } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } } continue; } } return(new DiskData(id, name, type, tags, location, managedBy.Value, Optional.ToList(managedByExtended), sku.Value, Optional.ToList(zones), extendedLocation.Value, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), uniqueId.Value, encryptionSettingsCollection.Value, provisioningState.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(diskIOPSReadOnly), Optional.ToNullable(diskMBpsReadOnly), Optional.ToNullable(diskState), encryption.Value, Optional.ToNullable(maxShares), Optional.ToList(shareInfo), Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, tier.Value, Optional.ToNullable(burstingEnabled), propertyUpdatesInProgress.Value, Optional.ToNullable(supportsHibernation), securityProfile.Value, Optional.ToNullable(completionPercent), Optional.ToNullable(publicNetworkAccess))); }