internal static ManifestAttributes DeserializeManifestAttributes(JsonElement element)
        {
            Optional <string> registry  = default;
            Optional <string> imageName = default;
            Optional <ManifestAttributesBase> manifest = 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("manifest"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    manifest = ManifestAttributesBase.DeserializeManifestAttributesBase(property.Value);
                    continue;
                }
            }
            return(new ManifestAttributes(registry.Value, imageName.Value, manifest.Value));
        }
        internal static AcrManifests DeserializeAcrManifests(JsonElement element)
        {
            Optional <string> registry  = default;
            Optional <string> imageName = default;
            Optional <IReadOnlyList <ManifestAttributesBase> > manifests = 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("manifests"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ManifestAttributesBase> array = new List <ManifestAttributesBase>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ManifestAttributesBase.DeserializeManifestAttributesBase(item));
                    }
                    manifests = array;
                    continue;
                }
                if (property.NameEquals("link"))
                {
                    link = property.Value.GetString();
                    continue;
                }
            }
            return(new AcrManifests(registry.Value, imageName.Value, Optional.ToList(manifests), link.Value));
        }
Example #3
0
 internal static ArtifactManifestProperties FromManifestAttributesBase(string repository, ManifestAttributesBase attributesBase)
 {
     return(new ArtifactManifestProperties(
                repository,
                attributesBase.Digest,
                attributesBase.Size,
                attributesBase.CreatedOn,
                attributesBase.LastUpdatedOn,
                attributesBase.Architecture,
                attributesBase.OperatingSystem,
                attributesBase.References,
                attributesBase.Tags,
                attributesBase.WriteableProperties));
 }
 internal static ArtifactManifestProperties FromManifestAttributesBase(string registry, string repository, ManifestAttributesBase attributesBase)
 {
     return(new ArtifactManifestProperties(
                registry,
                repository,
                attributesBase.Digest,
                attributesBase.Size,
                attributesBase.CreatedOn,
                attributesBase.LastUpdatedOn,
                attributesBase.Architecture,
                attributesBase.OperatingSystem,
                attributesBase.RelatedArtifacts,
                attributesBase.Tags,
                attributesBase.CanDelete,
                attributesBase.CanWrite,
                attributesBase.CanList,
                attributesBase.CanRead));
 }