/// <summary>Update the repository properties.</summary> /// <param name="value"> Repository properties to set. </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 <RepositoryProperties> SetProperties(RepositoryWriteableProperties value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(value, nameof(value)); using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepository)}.{nameof(SetProperties)}"); scope.Start(); try { return(_restClient.SetProperties(Name, value, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
internal RepositoryProperties(string name, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, int manifestCount, int tagCount, RepositoryWriteableProperties 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 static RepositoryProperties DeserializeRepositoryProperties(JsonElement element) { string imageName = default; DateTimeOffset createdTime = default; DateTimeOffset lastUpdateTime = default; int manifestCount = default; int tagCount = default; RepositoryWriteableProperties 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")) { 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 = RepositoryWriteableProperties.DeserializeRepositoryWriteableProperties(property.Value); continue; } } return(new RepositoryProperties(imageName, createdTime, lastUpdateTime, manifestCount, tagCount, changeableAttributes)); }