internal static GalleryImageData DeserializeGalleryImageData(JsonElement element) { IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <string> description = default; Optional <string> eula = default; Optional <string> privacyStatementUri = default; Optional <string> releaseNoteUri = default; Optional <OperatingSystemTypes> osType = default; Optional <OperatingSystemStateTypes> osState = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <DateTimeOffset> endOfLifeDate = default; Optional <GalleryImageIdentifier> identifier = default; Optional <RecommendedMachineConfiguration> recommended = default; Optional <Disallowed> disallowed = default; Optional <ImagePurchasePlan> purchasePlan = default; Optional <GalleryImagePropertiesProvisioningState> provisioningState = default; Optional <IList <GalleryImageFeature> > features = default; foreach (var property in element.EnumerateObject()) { 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("description")) { description = property0.Value.GetString(); continue; } if (property0.NameEquals("eula")) { eula = property0.Value.GetString(); continue; } if (property0.NameEquals("privacyStatementUri")) { privacyStatementUri = property0.Value.GetString(); continue; } if (property0.NameEquals("releaseNoteUri")) { releaseNoteUri = property0.Value.GetString(); continue; } if (property0.NameEquals("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("osState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osState = property0.Value.GetString().ToOperatingSystemStateTypes(); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("endOfLifeDate")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } endOfLifeDate = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("identifier")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } identifier = GalleryImageIdentifier.DeserializeGalleryImageIdentifier(property0.Value); continue; } if (property0.NameEquals("recommended")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } recommended = RecommendedMachineConfiguration.DeserializeRecommendedMachineConfiguration(property0.Value); continue; } if (property0.NameEquals("disallowed")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } disallowed = Disallowed.DeserializeDisallowed(property0.Value); continue; } if (property0.NameEquals("purchasePlan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } purchasePlan = ImagePurchasePlan.DeserializeImagePurchasePlan(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new GalleryImagePropertiesProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("features")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <GalleryImageFeature> array = new List <GalleryImageFeature>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(GalleryImageFeature.DeserializeGalleryImageFeature(item)); } features = array; continue; } } continue; } } return(new GalleryImageData(id, name, type, systemData, tags, location, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(hyperVGeneration), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, purchasePlan.Value, Optional.ToNullable(provisioningState), Optional.ToList(features))); }
internal static CommunityGalleryImageData DeserializeCommunityGalleryImageData(JsonElement element) { Optional <string> name = default; Optional <AzureLocation> location = default; Optional <ResourceType> type = default; Optional <OperatingSystemTypes> osType = default; Optional <OperatingSystemStateTypes> osState = default; Optional <DateTimeOffset> endOfLifeDate = default; Optional <GalleryImageIdentifier> identifier = default; Optional <RecommendedMachineConfiguration> recommended = default; Optional <Disallowed> disallowed = default; Optional <HyperVGeneration> hyperVGeneration = default; Optional <IReadOnlyList <GalleryImageFeature> > features = default; Optional <ImagePurchasePlan> purchasePlan = default; Optional <ArchitectureTypes> architecture = default; Optional <Uri> privacyStatementUri = default; Optional <string> eula = default; Optional <string> uniqueId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("location")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } location = new AzureLocation(property.Value.GetString()); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = new ResourceType(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("osType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osType = property0.Value.GetString().ToOperatingSystemTypes(); continue; } if (property0.NameEquals("osState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } osState = property0.Value.GetString().ToOperatingSystemStateTypes(); continue; } if (property0.NameEquals("endOfLifeDate")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } endOfLifeDate = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("identifier")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } identifier = GalleryImageIdentifier.DeserializeGalleryImageIdentifier(property0.Value); continue; } if (property0.NameEquals("recommended")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } recommended = RecommendedMachineConfiguration.DeserializeRecommendedMachineConfiguration(property0.Value); continue; } if (property0.NameEquals("disallowed")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } disallowed = Disallowed.DeserializeDisallowed(property0.Value); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("features")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <GalleryImageFeature> array = new List <GalleryImageFeature>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(GalleryImageFeature.DeserializeGalleryImageFeature(item)); } features = array; continue; } if (property0.NameEquals("purchasePlan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } purchasePlan = ImagePurchasePlan.DeserializeImagePurchasePlan(property0.Value); continue; } if (property0.NameEquals("architecture")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } architecture = new ArchitectureTypes(property0.Value.GetString()); continue; } if (property0.NameEquals("privacyStatementUri")) { if (property0.Value.ValueKind == JsonValueKind.Null) { privacyStatementUri = null; continue; } privacyStatementUri = new Uri(property0.Value.GetString()); continue; } if (property0.NameEquals("eula")) { eula = property0.Value.GetString(); continue; } } continue; } if (property.NameEquals("identifier")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("uniqueId")) { uniqueId = property0.Value.GetString(); continue; } } continue; } } return(new CommunityGalleryImageData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, Optional.ToNullable(hyperVGeneration), Optional.ToList(features), purchasePlan.Value, Optional.ToNullable(architecture), privacyStatementUri.Value, eula.Value)); }