Exemplo n.º 1
0
        public async virtual Task <Response <IReadOnlyList <Models.Sku> > > GetSkusAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("WebPubSub.GetSkus");
            scope.Start();
            try
            {
                var response = await _webPubSubRestClient.ListSkusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);

                return(Response.FromValue(response.Value.Value, response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemplo n.º 2
0
        public virtual AsyncPageable <Sku> GetSkusAsync(CancellationToken cancellationToken = default)
        {
            async Task <Page <Sku> > FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _webPubSubClientDiagnostics.CreateScope("WebPubSub.GetSkus");
                scope.Start();
                try
                {
                    var response = await _webPubSubRestClient.ListSkusAsync(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));
        }