internal static GalleryApplicationVersionPublishingProfile DeserializeGalleryApplicationVersionPublishingProfile(JsonElement element) { UserArtifactSource source = default; Optional <UserArtifactManage> manageActions = default; Optional <UserArtifactSettings> settings = default; Optional <IDictionary <string, string> > advancedSettings = default; Optional <bool> enableHealthCheck = default; Optional <IList <TargetRegion> > targetRegions = default; Optional <int> replicaCount = default; Optional <bool> excludeFromLatest = default; Optional <DateTimeOffset> publishedDate = default; Optional <DateTimeOffset> endOfLifeDate = default; Optional <StorageAccountType> storageAccountType = default; Optional <ReplicationMode> replicationMode = default; Optional <IList <GalleryTargetExtendedLocation> > targetExtendedLocations = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("source")) { source = UserArtifactSource.DeserializeUserArtifactSource(property.Value); continue; } if (property.NameEquals("manageActions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } manageActions = UserArtifactManage.DeserializeUserArtifactManage(property.Value); continue; } if (property.NameEquals("settings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } settings = UserArtifactSettings.DeserializeUserArtifactSettings(property.Value); continue; } if (property.NameEquals("advancedSettings")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } advancedSettings = dictionary; continue; } if (property.NameEquals("enableHealthCheck")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enableHealthCheck = property.Value.GetBoolean(); continue; } if (property.NameEquals("targetRegions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <TargetRegion> array = new List <TargetRegion>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TargetRegion.DeserializeTargetRegion(item)); } targetRegions = array; continue; } if (property.NameEquals("replicaCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } replicaCount = property.Value.GetInt32(); continue; } if (property.NameEquals("excludeFromLatest")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } excludeFromLatest = property.Value.GetBoolean(); continue; } if (property.NameEquals("publishedDate")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } publishedDate = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("endOfLifeDate")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } endOfLifeDate = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("storageAccountType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } storageAccountType = new StorageAccountType(property.Value.GetString()); continue; } if (property.NameEquals("replicationMode")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } replicationMode = new ReplicationMode(property.Value.GetString()); continue; } if (property.NameEquals("targetExtendedLocations")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <GalleryTargetExtendedLocation> array = new List <GalleryTargetExtendedLocation>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(GalleryTargetExtendedLocation.DeserializeGalleryTargetExtendedLocation(item)); } targetExtendedLocations = array; continue; } } return(new GalleryApplicationVersionPublishingProfile(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations), source, manageActions.Value, settings.Value, Optional.ToDictionary(advancedSettings), Optional.ToNullable(enableHealthCheck))); }
internal static GalleryImageVersionPublishingProfile DeserializeGalleryImageVersionPublishingProfile(JsonElement element) { Optional <IList <TargetRegion> > targetRegions = default; Optional <int> replicaCount = default; Optional <bool> excludeFromLatest = default; Optional <DateTimeOffset> publishedDate = default; Optional <DateTimeOffset> endOfLifeDate = default; Optional <StorageAccountType> storageAccountType = default; Optional <ReplicationMode> replicationMode = default; Optional <IList <GalleryTargetExtendedLocation> > targetExtendedLocations = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetRegions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <TargetRegion> array = new List <TargetRegion>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TargetRegion.DeserializeTargetRegion(item)); } targetRegions = array; continue; } if (property.NameEquals("replicaCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } replicaCount = property.Value.GetInt32(); continue; } if (property.NameEquals("excludeFromLatest")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } excludeFromLatest = property.Value.GetBoolean(); continue; } if (property.NameEquals("publishedDate")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } publishedDate = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("endOfLifeDate")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } endOfLifeDate = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("storageAccountType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } storageAccountType = new StorageAccountType(property.Value.GetString()); continue; } if (property.NameEquals("replicationMode")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } replicationMode = new ReplicationMode(property.Value.GetString()); continue; } if (property.NameEquals("targetExtendedLocations")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <GalleryTargetExtendedLocation> array = new List <GalleryTargetExtendedLocation>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(GalleryTargetExtendedLocation.DeserializeGalleryTargetExtendedLocation(item)); } targetExtendedLocations = array; continue; } } return(new GalleryImageVersionPublishingProfile(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations))); }