public virtual Response <IReadOnlyList <ExpressRouteGateway> > GetAll(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ExpressRouteGatewayCollection.GetAll"); scope.Start(); try { var response = _expressRouteGatewaysRestClient.ListByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken); return(Response.FromValue(response.Value.Value.Select(value => new ExpressRouteGateway(Parent, value)).ToArray() as IReadOnlyList <ExpressRouteGateway>, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Pageable <ExpressRouteGateway> GetAll(CancellationToken cancellationToken = default) { Page <ExpressRouteGateway> FirstPageFunc(int?pageSizeHint) { using var scope = _expressRouteGatewayClientDiagnostics.CreateScope("ExpressRouteGatewayCollection.GetAll"); scope.Start(); try { var response = _expressRouteGatewayRestClient.ListByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new ExpressRouteGateway(Client, value)), null, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, null)); }