Exemplo n.º 1
0
        public virtual AsyncPageable <DiagnosticSettingsResource> GetAllAsync(CancellationToken cancellationToken = default)
        {
            async Task <Page <DiagnosticSettingsResource> > FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _diagnosticSettingsDiagnosticSettingsClientDiagnostics.CreateScope("DiagnosticSettingsCollection.GetAll");
                scope.Start();
                try
                {
                    var response = await _diagnosticSettingsDiagnosticSettingsRestClient.ListAsync(Id, cancellationToken : cancellationToken).ConfigureAwait(false);

                    return(Page.FromValues(response.Value.Value.Select(value => new DiagnosticSettingsResource(Client, value)), null, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

            return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null));
        }