Example #1
0
        public async virtual Task <Response <IReadOnlyList <ServiceAssociationLink> > > GetServiceAssociationLinksAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("Subnet.GetServiceAssociationLinks");
            scope.Start();
            try
            {
                var response = await _serviceAssociationLinksRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);

                return(Response.FromValue(response.Value.Value, response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #2
0
        public virtual AsyncPageable <ServiceAssociationLink> GetServiceAssociationLinksAsync(CancellationToken cancellationToken = default)
        {
            async Task <Page <ServiceAssociationLink> > FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _serviceAssociationLinksClientDiagnostics.CreateScope("Subnet.GetServiceAssociationLinks");
                scope.Start();
                try
                {
                    var response = await _serviceAssociationLinksRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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));
        }