internal static TagProperties DeserializeTagProperties(JsonElement element) { Optional <string> registry = default; Optional <string> imageName = default; Optional <string> name = default; Optional <string> digest = default; Optional <DateTimeOffset> createdTime = default; Optional <DateTimeOffset> lastUpdateTime = default; Optional <ContentProperties> changeableAttributes = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry")) { registry = property.Value.GetString(); continue; } if (property.NameEquals("imageName")) { imageName = property.Value.GetString(); continue; } if (property.NameEquals("tag")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("name")) { name = property0.Value.GetString(); continue; } if (property0.NameEquals("digest")) { digest = property0.Value.GetString(); continue; } if (property0.NameEquals("createdTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } createdTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("lastUpdateTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } lastUpdateTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("changeableAttributes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } changeableAttributes = ContentProperties.DeserializeContentProperties(property0.Value); continue; } } continue; } } return(new TagProperties(registry.Value, imageName.Value, name.Value, digest.Value, Optional.ToNullable(createdTime), Optional.ToNullable(lastUpdateTime), changeableAttributes.Value)); }
internal static ManifestAttributesBase DeserializeManifestAttributesBase(JsonElement element) { Optional <string> digest = default; Optional <long> imageSize = default; Optional <DateTimeOffset> createdTime = default; Optional <DateTimeOffset> lastUpdateTime = default; Optional <string> architecture = default; Optional <string> os = default; Optional <string> mediaType = default; Optional <string> configMediaType = default; Optional <IReadOnlyList <string> > tags = default; Optional <ContentProperties> changeableAttributes = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("digest")) { digest = property.Value.GetString(); continue; } if (property.NameEquals("imageSize")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } imageSize = property.Value.GetInt64(); continue; } if (property.NameEquals("createdTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("lastUpdateTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } lastUpdateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("architecture")) { architecture = property.Value.GetString(); continue; } if (property.NameEquals("os")) { os = property.Value.GetString(); continue; } if (property.NameEquals("mediaType")) { mediaType = property.Value.GetString(); continue; } if (property.NameEquals("configMediaType")) { configMediaType = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { 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()); } tags = array; continue; } if (property.NameEquals("changeableAttributes")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } changeableAttributes = ContentProperties.DeserializeContentProperties(property.Value); continue; } } return(new ManifestAttributesBase(digest.Value, Optional.ToNullable(imageSize), Optional.ToNullable(createdTime), Optional.ToNullable(lastUpdateTime), architecture.Value, os.Value, mediaType.Value, configMediaType.Value, Optional.ToList(tags), changeableAttributes.Value)); }
internal static RepositoryProperties DeserializeRepositoryProperties(JsonElement element) { Optional <string> registry = default; Optional <string> imageName = default; Optional <DateTimeOffset> createdTime = default; Optional <DateTimeOffset> lastUpdateTime = default; Optional <int> manifestCount = default; Optional <int> tagCount = default; Optional <ContentProperties> changeableAttributes = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry")) { registry = property.Value.GetString(); continue; } if (property.NameEquals("imageName")) { imageName = property.Value.GetString(); continue; } if (property.NameEquals("createdTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createdTime = property.Value.GetDateTimeOffset(); continue; } if (property.NameEquals("lastUpdateTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } lastUpdateTime = property.Value.GetDateTimeOffset(); continue; } if (property.NameEquals("manifestCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } manifestCount = property.Value.GetInt32(); continue; } if (property.NameEquals("tagCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } tagCount = property.Value.GetInt32(); continue; } if (property.NameEquals("changeableAttributes")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } changeableAttributes = ContentProperties.DeserializeContentProperties(property.Value); continue; } } return(new RepositoryProperties(registry.Value, imageName.Value, createdTime, lastUpdateTime, manifestCount, tagCount, changeableAttributes.Value)); }
internal static ArtifactManifestProperties DeserializeArtifactManifestProperties(JsonElement element) { Optional <string> imageName = default; Optional <string> digest = default; Optional <long> imageSize = default; Optional <DateTimeOffset> createdTime = default; Optional <DateTimeOffset> lastUpdateTime = default; Optional <ArtifactArchitecture?> architecture = default; Optional <ArtifactOperatingSystem?> os = default; Optional <IReadOnlyList <ManifestAttributesManifestReferences> > references = default; Optional <IReadOnlyList <string> > tags = default; Optional <ContentProperties> changeableAttributes = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageName")) { imageName = property.Value.GetString(); continue; } if (property.NameEquals("manifest")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("digest")) { digest = property0.Value.GetString(); continue; } if (property0.NameEquals("imageSize")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } imageSize = property0.Value.GetInt64(); continue; } if (property0.NameEquals("createdTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } createdTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("lastUpdateTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } lastUpdateTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("architecture")) { if (property0.Value.ValueKind == JsonValueKind.Null) { architecture = null; continue; } architecture = new ArtifactArchitecture(property0.Value.GetString()); continue; } if (property0.NameEquals("os")) { if (property0.Value.ValueKind == JsonValueKind.Null) { os = null; continue; } os = new ArtifactOperatingSystem(property0.Value.GetString()); continue; } if (property0.NameEquals("references")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ManifestAttributesManifestReferences> array = new List <ManifestAttributesManifestReferences>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ManifestAttributesManifestReferences.DeserializeManifestAttributesManifestReferences(item)); } references = array; continue; } if (property0.NameEquals("tags")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } tags = array; continue; } if (property0.NameEquals("changeableAttributes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } changeableAttributes = ContentProperties.DeserializeContentProperties(property0.Value); continue; } } continue; } } return(new ArtifactManifestProperties(imageName.Value, digest.Value, Optional.ToNullable(imageSize), Optional.ToNullable(createdTime), Optional.ToNullable(lastUpdateTime), Optional.ToNullable(architecture), Optional.ToNullable(os), Optional.ToList(references), Optional.ToList(tags), changeableAttributes.Value)); }