/// <summary> List the manifests associated with this repository and the properties of each. /// This is useful for determining the collection of artifacts associated with this repository, as each artifact is uniquely identified by its manifest. </summary> /// <param name="manifestOrder"> Requested order of manifests in the collection. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="RequestFailedException">Thrown when a failure is returned by the Container Registry service.</exception> public virtual Pageable <ArtifactManifestProperties> GetAllManifestProperties(ArtifactManifestOrder manifestOrder = ArtifactManifestOrder.None, CancellationToken cancellationToken = default) { Page <ArtifactManifestProperties> FirstPageFunc(int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepository)}.{nameof(GetAllManifestProperties)}"); scope.Start(); try { string order = manifestOrder == ArtifactManifestOrder.None ? null : manifestOrder.ToSerialString(); var response = _restClient.GetManifests(Name, last: null, n: pageSizeHint, orderby: order, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.RegistryArtifacts, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <ArtifactManifestProperties> NextPageFunc(string nextLink, int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepository)}.{nameof(GetAllManifestProperties)}"); scope.Start(); try { string order = manifestOrder == ArtifactManifestOrder.None ? null : manifestOrder.ToSerialString(); string uriReference = ContainerRegistryClient.ParseUriReferenceFromLinkHeader(nextLink); var response = _restClient.GetManifestsNextPage(uriReference, Name, last: null, n: null, orderby: order, cancellationToken); return(Page.FromValues(response.Value.RegistryArtifacts, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }
public static string ToSerialString(this ArtifactManifestOrder value) => value switch {