Exemple #1
0
        public virtual Pageable <PrivateEndpointConnection> GetPrivateEndpointConnections(CancellationToken cancellationToken = default)
        {
            Page <PrivateEndpointConnection> FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _clientDiagnostics.CreateScope("PrivateLinkService.GetPrivateEndpointConnections");
                scope.Start();
                try
                {
                    var response = _restClient.GetPrivateEndpointConnections(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken);
                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

            Page <PrivateEndpointConnection> NextPageFunc(string nextLink, int?pageSizeHint)
            {
                using var scope = _clientDiagnostics.CreateScope("PrivateLinkService.GetPrivateEndpointConnections");
                scope.Start();
                try
                {
                    var response = _restClient.GetPrivateEndpointConnectionsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken);
                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

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