示例#1
0
 private static ManifestWriteableProperties GetManifestWriteableProperties(ArtifactManifestProperties value)
 {
     return(new ManifestWriteableProperties()
     {
         CanDelete = value.CanDelete,
         CanList = value.CanList,
         CanRead = value.CanRead,
         CanWrite = value.CanWrite,
         QuarantineDetails = value.QuarantineDetails,
         QuarantineState = value.QuarantineState
     });
 }
        /// <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(ArtifactManifestProperties 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, GetManifestWriteableProperties(value), cancellationToken));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }