Ejemplo n.º 1
0
        internal static TagAttributesBase DeserializeTagAttributesBase(JsonElement element)
        {
            Optional <string> name           = default;
            Optional <string> digest         = default;
            Optional <string> createdTime    = default;
            Optional <string> lastUpdateTime = default;
            Optional <bool>   signed         = default;
            Optional <ChangeableAttributes> changeableAttributes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("digest"))
                {
                    digest = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("createdTime"))
                {
                    createdTime = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastUpdateTime"))
                {
                    lastUpdateTime = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("signed"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    signed = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("changeableAttributes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    changeableAttributes = ChangeableAttributes.DeserializeChangeableAttributes(property.Value);
                    continue;
                }
            }
            return(new TagAttributesBase(name.Value, digest.Value, createdTime.Value, lastUpdateTime.Value, Optional.ToNullable(signed), changeableAttributes.Value));
        }
Ejemplo n.º 2
0
 internal ManifestAttributesBase(string digest, long?imageSize, string createdTime, string lastUpdateTime, string architecture, string os, string mediaType, string configMediaType, IReadOnlyList <string> tags, ChangeableAttributes changeableAttributes)
 {
     Digest               = digest;
     ImageSize            = imageSize;
     CreatedTime          = createdTime;
     LastUpdateTime       = lastUpdateTime;
     Architecture         = architecture;
     Os                   = os;
     MediaType            = mediaType;
     ConfigMediaType      = configMediaType;
     Tags                 = tags;
     ChangeableAttributes = changeableAttributes;
 }
Ejemplo n.º 3
0
        internal static ManifestAttributesBase DeserializeManifestAttributesBase(JsonElement element)
        {
            Optional <string> digest                = default;
            Optional <long>   imageSize             = default;
            Optional <string> createdTime           = default;
            Optional <string> lastUpdateTime        = default;
            Optional <string> architecture          = default;
            Optional <string> os                    = default;
            Optional <string> mediaType             = default;
            Optional <string> configMediaType       = default;
            Optional <IReadOnlyList <string> > tags = default;
            Optional <ChangeableAttributes>    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"))
                {
                    createdTime = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastUpdateTime"))
                {
                    lastUpdateTime = property.Value.GetString();
                    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 = ChangeableAttributes.DeserializeChangeableAttributes(property.Value);
                    continue;
                }
            }
            return(new ManifestAttributesBase(digest.Value, Optional.ToNullable(imageSize), createdTime.Value, lastUpdateTime.Value, architecture.Value, os.Value, mediaType.Value, configMediaType.Value, Optional.ToList(tags), changeableAttributes.Value));
        }
Ejemplo n.º 4
0
        internal static RepositoryAttributes DeserializeRepositoryAttributes(JsonElement element)
        {
            Optional <string> registry       = default;
            Optional <string> imageName      = default;
            Optional <string> createdTime    = default;
            Optional <string> lastUpdateTime = default;
            Optional <int>    manifestCount  = default;
            Optional <int>    tagCount       = default;
            Optional <ChangeableAttributes> 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"))
                {
                    createdTime = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastUpdateTime"))
                {
                    lastUpdateTime = property.Value.GetString();
                    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 = ChangeableAttributes.DeserializeChangeableAttributes(property.Value);
                    continue;
                }
            }
            return(new RepositoryAttributes(registry.Value, imageName.Value, createdTime.Value, lastUpdateTime.Value, Optional.ToNullable(manifestCount), Optional.ToNullable(tagCount), changeableAttributes.Value));
        }