internal static TagList DeserializeTagList(JsonElement element)
        {
            string imageName = default;
            IReadOnlyList <TagAttributesBase> tags = default;
            Optional <string> link = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("imageName"))
                {
                    imageName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    List <TagAttributesBase> array = new List <TagAttributesBase>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TagAttributesBase.DeserializeTagAttributesBase(item));
                    }
                    tags = array;
                    continue;
                }
                if (property.NameEquals("link"))
                {
                    link = property.Value.GetString();
                    continue;
                }
            }
            return(new TagList(imageName, tags, link.Value));
        }
示例#2
0
        internal static TagAttributes DeserializeTagAttributes(JsonElement element)
        {
            Optional <string>            registry  = default;
            Optional <string>            imageName = default;
            Optional <TagAttributesBase> tag       = 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;
                    }
                    tag = TagAttributesBase.DeserializeTagAttributesBase(property.Value);
                    continue;
                }
            }
            return(new TagAttributes(registry.Value, imageName.Value, tag.Value));
        }
示例#3
0
 internal static TagProperties FromTagAttributesBase(string repository, TagAttributesBase attributesBase)
 {
     return(new TagProperties(
                repository,
                attributesBase.Name,
                attributesBase.Digest,
                attributesBase.CreatedOn,
                attributesBase.LastUpdatedOn,
                attributesBase.WriteableProperties));
 }
        internal static TagList DeserializeTagList(JsonElement element)
        {
            Optional <string> registry  = default;
            Optional <string> imageName = default;
            Optional <IReadOnlyList <TagAttributesBase> > tags = default;
            Optional <string> link = 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("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TagAttributesBase> array = new List <TagAttributesBase>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TagAttributesBase.DeserializeTagAttributesBase(item));
                    }
                    tags = array;
                    continue;
                }
                if (property.NameEquals("link"))
                {
                    link = property.Value.GetString();
                    continue;
                }
            }
            return(new TagList(registry.Value, imageName.Value, Optional.ToList(tags), link.Value));
        }
示例#5
0
 internal static ArtifactTagProperties FromTagAttributesBase(string registry, string repository, TagAttributesBase attributesBase)
 {
     return(new ArtifactTagProperties(
                registry,
                repository,
                attributesBase.Name,
                attributesBase.Digest,
                attributesBase.CreatedOn,
                attributesBase.LastUpdatedOn,
                attributesBase.CanDelete,
                attributesBase.CanWrite,
                attributesBase.CanList,
                attributesBase.CanRead));
 }