/// <summary> List the tags that uniquely identify this artifact and the properties of each. </summary> /// <param name="orderBy"> Requested order of tags 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 AsyncPageable <ArtifactTagProperties> GetTagPropertiesCollectionAsync(ArtifactTagOrderBy orderBy = ArtifactTagOrderBy.None, CancellationToken cancellationToken = default) { async Task <Page <ArtifactTagProperties> > FirstPageFunc(int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(RegistryArtifact)}.{nameof(GetTagPropertiesCollection)}"); scope.Start(); try { string digest = await GetDigestAsync(cancellationToken).ConfigureAwait(false); string order = orderBy == ArtifactTagOrderBy.None ? null : orderBy.ToSerialString(); var response = await _restClient.GetTagsAsync(_repositoryName, last : null, n : pageSizeHint, orderby : order, digest : digest, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Tags, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } async Task <Page <ArtifactTagProperties> > NextPageFunc(string nextLink, int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(RegistryArtifact)}.{nameof(GetTagPropertiesCollection)}"); scope.Start(); try { string digest = await GetDigestAsync(cancellationToken).ConfigureAwait(false); string order = orderBy == ArtifactTagOrderBy.None ? null : orderBy.ToSerialString(); string uriReference = ContainerRegistryClient.ParseUriReferenceFromLinkHeader(nextLink); var response = await _restClient.GetTagsNextPageAsync(uriReference, _repositoryName, last : null, n : null, orderby : order, digest : digest, cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Tags, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }
/// <summary> List the tags that uniquely identify this artifact and the properties of each. </summary> /// <param name="tagOrder"> Requested order of tags 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 <ArtifactTagProperties> GetAllTagProperties(ArtifactTagOrder tagOrder = ArtifactTagOrder.None, CancellationToken cancellationToken = default) { Page <ArtifactTagProperties> FirstPageFunc(int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(RegistryArtifact)}.{nameof(GetAllTagProperties)}"); scope.Start(); try { string digest = GetDigest(cancellationToken); string order = tagOrder == ArtifactTagOrder.None ? null : tagOrder.ToSerialString(); var response = _restClient.GetTags(_repositoryName, last: null, n: pageSizeHint, orderby: order, digest: digest, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Tags, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <ArtifactTagProperties> NextPageFunc(string nextLink, int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(RegistryArtifact)}.{nameof(GetAllTagProperties)}"); scope.Start(); try { string digest = GetDigest(cancellationToken); string order = tagOrder == ArtifactTagOrder.None ? null : tagOrder.ToSerialString(); string uriReference = ContainerRegistryClient.ParseUriReferenceFromLinkHeader(nextLink); var response = _restClient.GetTagsNextPage(uriReference, _repositoryName, last: null, n: null, orderby: order, digest: digest, cancellationToken); return(Page.FromValues(response.Value.Tags, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }
/// <summary> Get the collection of tags for a repository. </summary> /// <param name="options"> Options to override default collection getting behavior. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> public virtual AsyncPageable <TagProperties> GetTagsAsync(GetTagsOptions options = null, CancellationToken cancellationToken = default) { async Task <Page <TagProperties> > FirstPageFunc(int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepositoryClient)}.{nameof(GetTags)}"); scope.Start(); try { var response = await _restClient.GetTagsAsync(Repository, last : null, n : pageSizeHint, orderby : options?.OrderBy.ToString(), digest : null, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Tags, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } async Task <Page <TagProperties> > NextPageFunc(string nextLink, int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepositoryClient)}.{nameof(GetTags)}"); scope.Start(); try { string uriReference = ContainerRegistryClient.ParseUriReferenceFromLinkHeader(nextLink); var response = await _restClient.GetTagsNextPageAsync(uriReference, Repository, last : null, n : null, orderby : options?.OrderBy.ToString(), digest : null, cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Tags, response.Headers.Link, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }
/// <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="orderBy"> 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> GetManifestPropertiesCollection(ArtifactManifestOrderBy orderBy = ArtifactManifestOrderBy.None, CancellationToken cancellationToken = default) { Page <ArtifactManifestProperties> FirstPageFunc(int?pageSizeHint) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ContainerRepository)}.{nameof(GetManifestPropertiesCollection)}"); scope.Start(); try { string order = orderBy == ArtifactManifestOrderBy.None ? null : orderBy.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(GetManifestPropertiesCollection)}"); scope.Start(); try { string order = orderBy == ArtifactManifestOrderBy.None ? null : orderBy.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)); }