|
26 | 26 | using Microsoft.Azure.Commands.Common.Strategies;
|
27 | 27 | using Microsoft.Azure.Commands.ContainerRegistry.Track2Models;
|
28 | 28 | using Azure;
|
| 29 | +using Azure.Core.Serialization; |
29 | 30 |
|
30 | 31 | namespace Microsoft.Azure.Commands.ContainerRegistry
|
31 | 32 | {
|
@@ -168,9 +169,35 @@ public PSRepositoryAttribute UpdateRepository(string repository, PSChangeableAtt
|
168 | 169 | return GetRepository(repository);
|
169 | 170 | }
|
170 | 171 |
|
171 |
| - public PSAcrManifest ListManifest(string repository) |
| 172 | + public PSAcrManifest ListManifest(string repositoryName) |
172 | 173 | {
|
173 |
| - return new ContainerRegistryManifestListOperation(this, repository).ProcessRequest(); |
| 174 | + ContainerRepository repository = _track2Client.GetRepository(repositoryName); |
| 175 | + Pageable<ArtifactManifestProperties> properties = repository.GetAllManifestProperties(); |
| 176 | + PSAcrManifest result = new PSAcrManifest(); |
| 177 | + IEnumerable<Page<ArtifactManifestProperties>> pages = properties.AsPages(); |
| 178 | + result.ManifestsAttributes = new List<PSManifestAttributeBase>(); |
| 179 | + foreach (Page<ArtifactManifestProperties> page in pages) |
| 180 | + { |
| 181 | + Response httpPageResponse = page.GetRawResponse(); |
| 182 | + dynamic pageContent = httpPageResponse.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase); |
| 183 | + result.ImageName = pageContent.ImageName; |
| 184 | + result.Registry = pageContent.registry; |
| 185 | + // Iterate over items in Manifests collection |
| 186 | + foreach (dynamic property in pageContent.Manifests) |
| 187 | + { |
| 188 | + List<string> tagList = new List<string>(); |
| 189 | + if (property.Tags != null) |
| 190 | + { |
| 191 | + tagList.AddRange((List<string>)property.Tags); |
| 192 | + } |
| 193 | + result.ManifestsAttributes.Add(new PSManifestAttributeBase(property.Digest, property.ImageSize, property.CreatedTime, property.LastUpdateTime, |
| 194 | + property.Architecture, property.Os,property.MediaType, property.ConfigMediaType, tagList, |
| 195 | + new PSChangeableAttribute(property.ChangeableAttributes.DeleteEnabled, property.ChangeableAttributes.WriteEnabled, property.ChangeableAttributes.ListEnabled, property.ChangeableAttributes.ReadEnabled))); |
| 196 | + } |
| 197 | + } |
| 198 | + |
| 199 | + |
| 200 | + return result; |
174 | 201 | }
|
175 | 202 |
|
176 | 203 | public PSManifestAttribute GetManifest(string repository, string manifest)
|
|
0 commit comments