public async virtual Task <Response <IReadOnlyList <SubResource> > > GetNamespacesAsync(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("EventHubCluster.GetNamespaces"); scope.Start(); try { var response = await _clustersRestClient.ListNamespacesAsync(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 <SubResource> GetNamespacesAsync(CancellationToken cancellationToken = default) { async Task <Page <SubResource> > FirstPageFunc(int?pageSizeHint) { using var scope = _eventHubClusterClustersClientDiagnostics.CreateScope("EventHubClusterResource.GetNamespaces"); scope.Start(); try { var response = await _eventHubClusterClustersRestClient.ListNamespacesAsync(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)); }