public async virtual Task <Response <IReadOnlyList <PrivateLinkResource> > > GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("EventHubNamespace.GetPrivateLinkResources"); scope.Start(); try { var response = await _privateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return(Response.FromValue(response.Value.Value, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual AsyncPageable <PrivateLinkResource> GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) { async Task <Page <PrivateLinkResource> > FirstPageFunc(int?pageSizeHint) { using var scope = _privateLinkResourcesClientDiagnostics.CreateScope("EventHubNamespaceResource.GetPrivateLinkResources"); scope.Start(); try { var response = await _privateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value, null, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null)); }