internal RegistryArtifactProperties(string repository, string digest, IEnumerable <string> tags, ContentProperties manifestProperties)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            if (digest == null)
            {
                throw new ArgumentNullException(nameof(digest));
            }
            if (tags == null)
            {
                throw new ArgumentNullException(nameof(tags));
            }
            if (manifestProperties == null)
            {
                throw new ArgumentNullException(nameof(manifestProperties));
            }

            Repository        = repository;
            Digest            = digest;
            RegistryArtifacts = new ChangeTrackingList <ManifestAttributesManifestReferences>();
            Tags = tags.ToList();
            ManifestProperties = manifestProperties;
        }
        internal ArtifactTagProperties(string repository, string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ContentProperties writeableProperties)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (digest == null)
            {
                throw new ArgumentNullException(nameof(digest));
            }
            if (writeableProperties == null)
            {
                throw new ArgumentNullException(nameof(writeableProperties));
            }

            Repository          = repository;
            Name                = name;
            Digest              = digest;
            CreatedOn           = createdOn;
            LastUpdatedOn       = lastUpdatedOn;
            WriteableProperties = writeableProperties;
        }
 internal TagAttributesBase(string name, string digest, DateTimeOffset?createdOn, DateTimeOffset?lastUpdatedOn, ContentProperties modifiableProperties)
 {
     Name                 = name;
     Digest               = digest;
     CreatedOn            = createdOn;
     LastUpdatedOn        = lastUpdatedOn;
     ModifiableProperties = modifiableProperties;
 }
Exemple #4
0
 internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ContentProperties writeableProperties)
 {
     Name                = name;
     Digest              = digest;
     CreatedOn           = createdOn;
     LastUpdatedOn       = lastUpdatedOn;
     WriteableProperties = writeableProperties;
 }
 internal TagProperties(string repository, string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ContentProperties writeableProperties)
 {
     Repository          = repository;
     Name                = name;
     Digest              = digest;
     CreatedOn           = createdOn;
     LastUpdatedOn       = lastUpdatedOn;
     WriteableProperties = writeableProperties;
 }
Exemple #6
0
 internal RepositoryProperties(string name, DateTimeOffset createdOn, DateTimeOffset?lastUpdatedOn, int registryArtifactCount, int tagCount, ContentProperties writeableProperties)
 {
     Name                  = name;
     CreatedOn             = createdOn;
     LastUpdatedOn         = lastUpdatedOn;
     RegistryArtifactCount = registryArtifactCount;
     TagCount              = tagCount;
     WriteableProperties   = writeableProperties;
 }
        internal static ArtifactTagProperties DeserializeArtifactTagProperties(JsonElement element)
        {
            string            imageName            = default;
            string            name                 = default;
            string            digest               = default;
            DateTimeOffset    createdTime          = default;
            DateTimeOffset    lastUpdateTime       = default;
            ContentProperties changeableAttributes = default;

            foreach (var property in element.EnumerateObject())
            {
                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"))
                        {
                            createdTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("lastUpdateTime"))
                        {
                            lastUpdateTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("changeableAttributes"))
                        {
                            changeableAttributes = ContentProperties.DeserializeContentProperties(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ArtifactTagProperties(imageName, name, digest, createdTime, lastUpdateTime, changeableAttributes));
        }
Exemple #8
0
 internal RepositoryProperties(string registry, string name, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, int registryArtifactCount, int tagCount, ContentProperties modifiableProperties)
 {
     Registry              = registry;
     Name                  = name;
     CreatedOn             = createdOn;
     LastUpdatedOn         = lastUpdatedOn;
     RegistryArtifactCount = registryArtifactCount;
     TagCount              = tagCount;
     ModifiableProperties  = modifiableProperties;
 }
Exemple #9
0
 internal TagProperties(string registry, string repository, string name, string digest, DateTimeOffset?createdOn, DateTimeOffset?lastUpdatedOn, ContentProperties modifiableProperties)
 {
     Registry             = registry;
     Repository           = repository;
     Name                 = name;
     Digest               = digest;
     CreatedOn            = createdOn;
     LastUpdatedOn        = lastUpdatedOn;
     ModifiableProperties = modifiableProperties;
 }
        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 <ContentProperties> 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 = ContentProperties.DeserializeContentProperties(property.Value);
                    continue;
                }
            }
            return(new TagAttributesBase(name.Value, digest.Value, createdTime.Value, lastUpdateTime.Value, Optional.ToNullable(signed), changeableAttributes.Value));
        }
 internal ManifestAttributesBase(string digest, long?size, DateTimeOffset?createdOn, DateTimeOffset?lastUpdatedOn, string cpuArchitecture, string operatingSystem, IReadOnlyList <ManifestAttributesManifestReferences> references, IReadOnlyList <string> tags, ContentProperties writeableProperties)
 {
     Digest              = digest;
     Size                = size;
     CreatedOn           = createdOn;
     LastUpdatedOn       = lastUpdatedOn;
     CpuArchitecture     = cpuArchitecture;
     OperatingSystem     = operatingSystem;
     References          = references;
     Tags                = tags;
     WriteableProperties = writeableProperties;
 }
 internal ManifestAttributesBase(string digest, long?imageSize, string createdTime, string lastUpdateTime, string architecture, string os, string mediaType, string configMediaType, IReadOnlyList <string> tags, ContentProperties changeableAttributes)
 {
     Digest               = digest;
     ImageSize            = imageSize;
     CreatedTime          = createdTime;
     LastUpdateTime       = lastUpdateTime;
     Architecture         = architecture;
     Os                   = os;
     MediaType            = mediaType;
     ConfigMediaType      = configMediaType;
     Tags                 = tags;
     ChangeableAttributes = changeableAttributes;
 }
Exemple #13
0
 internal ArtifactManifestProperties(string repositoryName, string digest, long?size, DateTimeOffset?createdOn, DateTimeOffset?lastUpdatedOn, ArtifactArchitecture?architecture, ArtifactOperatingSystem?operatingSystem, IReadOnlyList <ManifestAttributesManifestReferences> references, IReadOnlyList <string> tags, ContentProperties writeableProperties)
 {
     RepositoryName      = repositoryName;
     Digest              = digest;
     Size                = size;
     CreatedOn           = createdOn;
     LastUpdatedOn       = lastUpdatedOn;
     Architecture        = architecture;
     OperatingSystem     = operatingSystem;
     References          = references;
     Tags                = tags;
     WriteableProperties = writeableProperties;
 }
 internal ManifestAttributesBase(string digest, long?size, DateTimeOffset?createdOn, DateTimeOffset?lastUpdatedOn, string cpuArchitecture, string operatingSystem, string manifestMediaType, string configMediaType, IReadOnlyList <string> tags, ContentProperties manifestProperties)
 {
     Digest             = digest;
     Size               = size;
     CreatedOn          = createdOn;
     LastUpdatedOn      = lastUpdatedOn;
     CpuArchitecture    = cpuArchitecture;
     OperatingSystem    = operatingSystem;
     ManifestMediaType  = manifestMediaType;
     ConfigMediaType    = configMediaType;
     Tags               = tags;
     ManifestProperties = manifestProperties;
 }
 internal RegistryArtifactProperties(string repository, string digest, long?size, DateTimeOffset?createdOn, DateTimeOffset?lastUpdatedOn, string cpuArchitecture, string operatingSystem, IReadOnlyList <ManifestAttributesManifestReferences> registryArtifacts, IReadOnlyList <string> tags, ContentProperties manifestProperties)
 {
     Repository         = repository;
     Digest             = digest;
     Size               = size;
     CreatedOn          = createdOn;
     LastUpdatedOn      = lastUpdatedOn;
     CpuArchitecture    = cpuArchitecture;
     OperatingSystem    = operatingSystem;
     RegistryArtifacts  = registryArtifacts;
     Tags               = tags;
     ManifestProperties = manifestProperties;
 }
 /// <summary> Update the attribute identified by `name` where `reference` is the name of the repository. </summary>
 /// <param name="value"> Repository attribute value. </param>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 public virtual async Task <Response> SetPropertiesAsync(ContentProperties value, CancellationToken cancellationToken = default)
 {
     using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepositoryClient)}.{nameof(SetProperties)}");
     scope.Start();
     try
     {
         return(await _restClient.SetPropertiesAsync(_repository, value, cancellationToken).ConfigureAwait(false));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
 /// <summary> Update tag attributes. </summary>
 /// <param name="tag"> Tag name. </param>
 /// <param name="value"> Tag property value. </param>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 public virtual Response SetTagProperties(string tag, ContentProperties value, CancellationToken cancellationToken = default)
 {
     using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepositoryClient)}.{nameof(SetTagProperties)}");
     scope.Start();
     try
     {
         return(_restClient.UpdateTagAttributes(_repository, tag, value, cancellationToken));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        internal static RepositoryProperties DeserializeRepositoryProperties(JsonElement element)
        {
            string                    imageName      = default;
            DateTimeOffset            createdTime    = default;
            Optional <DateTimeOffset> lastUpdateTime = default;
            int manifestCount = default;
            int tagCount      = default;
            ContentProperties changeableAttributes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("imageName"))
                {
                    imageName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("createdTime"))
                {
                    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("manifestCount"))
                {
                    manifestCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("tagCount"))
                {
                    tagCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("changeableAttributes"))
                {
                    changeableAttributes = ContentProperties.DeserializeContentProperties(property.Value);
                    continue;
                }
            }
            return(new RepositoryProperties(imageName, createdTime, Optional.ToNullable(lastUpdateTime), manifestCount, tagCount, changeableAttributes));
        }
Exemple #19
0
 internal RegistryArtifactProperties(string registry, string repository, string digest, long?size, DateTimeOffset?createdOn, DateTimeOffset?lastUpdatedOn, string cpuArchitecture, string operatingSystem, string manifestMediaType, string configMediaType, IReadOnlyList <string> tags, ContentProperties manifestProperties)
 {
     Registry           = registry;
     Repository         = repository;
     Digest             = digest;
     Size               = size;
     CreatedOn          = createdOn;
     LastUpdatedOn      = lastUpdatedOn;
     CpuArchitecture    = cpuArchitecture;
     OperatingSystem    = operatingSystem;
     ManifestMediaType  = manifestMediaType;
     ConfigMediaType    = configMediaType;
     Tags               = tags;
     ManifestProperties = manifestProperties;
 }
Exemple #20
0
        /// <summary>Update the repository properties.</summary>
        /// <param name="value"> Repository properties to set. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public virtual Response <RepositoryProperties> SetProperties(ContentProperties value, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(value, nameof(value));

            using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepositoryClient)}.{nameof(SetProperties)}");
            scope.Start();
            try
            {
                return(_restClient.SetProperties(Repository, value, cancellationToken));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #21
0
        /// <summary> Update manifest attributes. </summary>
        /// <param name="value"> Manifest properties value. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> Thrown when <paramref name="value"/> is null. </exception>
        /// <exception cref="RequestFailedException">Thrown when a failure is returned by the Container Registry service.</exception>
        public virtual Response <ArtifactManifestProperties> SetManifestProperties(ContentProperties value, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(value, nameof(value));

            using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(RegistryArtifact)}.{nameof(SetManifestProperties)}");
            scope.Start();
            try
            {
                string digest = GetDigest(cancellationToken);
                return(_restClient.UpdateManifestProperties(_repositoryName, digest, value, cancellationToken));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #22
0
        internal RepositoryProperties(string name, DateTimeOffset createdOn, int registryArtifactCount, int tagCount, ContentProperties writeableProperties)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (writeableProperties == null)
            {
                throw new ArgumentNullException(nameof(writeableProperties));
            }

            Name                  = name;
            CreatedOn             = createdOn;
            RegistryArtifactCount = registryArtifactCount;
            TagCount              = tagCount;
            WriteableProperties   = writeableProperties;
        }
Exemple #23
0
        /// <summary> Update tag attributes. </summary>
        /// <param name="tag"> Tag name. </param>
        /// <param name="value"> Tag property value. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> Thrown when <paramref name="tag"/> is null. </exception>
        /// <exception cref="ArgumentException"> Thrown when <paramref name="tag"/> is empty. </exception>
        /// <exception cref="ArgumentNullException"> Thrown when <paramref name="value"/> is null. </exception>
        /// <exception cref="RequestFailedException">Thrown when a failure is returned by the Container Registry service.</exception>
        public virtual Response <ArtifactTagProperties> SetTagProperties(string tag, ContentProperties value, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(tag, nameof(tag));
            Argument.AssertNotNull(value, nameof(value));

            using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(RegistryArtifact)}.{nameof(SetTagProperties)}");
            scope.Start();
            try
            {
                return(_restClient.UpdateTagAttributes(_repositoryName, tag, value, cancellationToken));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #24
0
        internal RepositoryProperties(string name, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, int manifestCount, int tagCount, ContentProperties writeableProperties)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (writeableProperties == null)
            {
                throw new ArgumentNullException(nameof(writeableProperties));
            }

            Name                = name;
            CreatedOn           = createdOn;
            LastUpdatedOn       = lastUpdatedOn;
            ManifestCount       = manifestCount;
            TagCount            = tagCount;
            WriteableProperties = writeableProperties;
        }
        internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ContentProperties writeableProperties)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (digest == null)
            {
                throw new ArgumentNullException(nameof(digest));
            }
            if (writeableProperties == null)
            {
                throw new ArgumentNullException(nameof(writeableProperties));
            }

            Name                = name;
            Digest              = digest;
            CreatedOn           = createdOn;
            LastUpdatedOn       = lastUpdatedOn;
            WriteableProperties = writeableProperties;
        }
Exemple #26
0
        internal static TagAttributesBase DeserializeTagAttributesBase(JsonElement element)
        {
            string            name                 = default;
            string            digest               = default;
            DateTimeOffset    createdTime          = default;
            DateTimeOffset    lastUpdateTime       = default;
            ContentProperties 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.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastUpdateTime"))
                {
                    lastUpdateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("changeableAttributes"))
                {
                    changeableAttributes = ContentProperties.DeserializeContentProperties(property.Value);
                    continue;
                }
            }
            return(new TagAttributesBase(name, digest, createdTime, lastUpdateTime, changeableAttributes));
        }
Exemple #27
0
        /// <summary> Update tag attributes. </summary>
        /// <param name="tag"> Tag name. </param>
        /// <param name="value"> Tag property value. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public virtual async Task <Response <TagProperties> > SetTagPropertiesAsync(string tag, ContentProperties value, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(tag, nameof(tag));
            Argument.AssertNotNull(value, nameof(value));

            using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepositoryClient)}.{nameof(SetTagProperties)}");
            scope.Start();
            try
            {
                return(await _restClient.UpdateTagAttributesAsync(Repository, tag, value, cancellationToken).ConfigureAwait(false));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #28
0
        internal static RegistryArtifactProperties DeserializeRegistryArtifactProperties(JsonElement element)
        {
            Optional <string>         imageName      = default;
            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 <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"))
                        {
                            architecture = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("os"))
                        {
                            os = 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 RegistryArtifactProperties(imageName.Value, digest.Value, Optional.ToNullable(imageSize), Optional.ToNullable(createdTime), Optional.ToNullable(lastUpdateTime), architecture.Value, os.Value, Optional.ToList(references), Optional.ToList(tags), changeableAttributes.Value));
        }
Exemple #29
0
        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 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));
        }