Exemplo n.º 1
0
        public virtual AsyncPageable <SyncFullSchemaProperties> GetMemberSchemasAsync(CancellationToken cancellationToken = default)
        {
            async Task <Page <SyncFullSchemaProperties> > FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _syncMemberClientDiagnostics.CreateScope("SyncMemberResource.GetMemberSchemas");
                scope.Start();
                try
                {
                    var response = await _syncMemberRestClient.ListMemberSchemasAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken : cancellationToken).ConfigureAwait(false);

                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

            async Task <Page <SyncFullSchemaProperties> > NextPageFunc(string nextLink, int?pageSizeHint)
            {
                using var scope = _syncMemberClientDiagnostics.CreateScope("SyncMemberResource.GetMemberSchemas");
                scope.Start();
                try
                {
                    var response = await _syncMemberRestClient.ListMemberSchemasNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken : cancellationToken).ConfigureAwait(false);

                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

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