internal ArtifactTagProperties(string repositoryName, string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, TagWriteableProperties writeableProperties)
        {
            if (repositoryName == null)
            {
                throw new ArgumentNullException(nameof(repositoryName));
            }
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (digest == null)
            {
                throw new ArgumentNullException(nameof(digest));
            }
            if (writeableProperties == null)
            {
                throw new ArgumentNullException(nameof(writeableProperties));
            }

            RepositoryName      = repositoryName;
            Name                = name;
            Digest              = digest;
            CreatedOn           = createdOn;
            LastUpdatedOn       = lastUpdatedOn;
            WriteableProperties = writeableProperties;
        }
Пример #2
0
        internal static ArtifactTagProperties DeserializeArtifactTagProperties(JsonElement element)
        {
            string                 imageName            = default;
            string                 name                 = default;
            string                 digest               = default;
            DateTimeOffset         createdTime          = default;
            DateTimeOffset         lastUpdateTime       = default;
            TagWriteableProperties 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 = TagWriteableProperties.DeserializeTagWriteableProperties(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ArtifactTagProperties(imageName, name, digest, createdTime, lastUpdateTime, changeableAttributes));
        }
Пример #3
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, TagWriteableProperties 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;
            }
        }
        internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, TagWriteableProperties 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;
        }
Пример #5
0
        internal static TagAttributesBase DeserializeTagAttributesBase(JsonElement element)
        {
            string                 name                 = default;
            string                 digest               = default;
            DateTimeOffset         createdTime          = default;
            DateTimeOffset         lastUpdateTime       = default;
            TagWriteableProperties 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 = TagWriteableProperties.DeserializeTagWriteableProperties(property.Value);
                    continue;
                }
            }
            return(new TagAttributesBase(name, digest, createdTime, lastUpdateTime, changeableAttributes));
        }